Wednesday, 22 February 2017

ABAP OLE Programming for Excel


DATAh_excel TYPE ole2_object,        " Excel object
        h_mapl TYPE ole2_object,         " list of workbooks
        h_map TYPE ole2_object,          " workbook
        v_filename TYPE string VALUE 'C:\Users\phoonookan\Desktop\1111.xlsx'.

  CREATE OBJECT h_excel 'EXCEL.APPLICATION'.
  SET PROPERTY OF h_excel  'Visible' 1.
  CALL METHOD OF h_excel 'Workbooks' h_mapl.
  CALL METHOD OF h_mapl 'Open' h_map
    EXPORTING
    #1 v_filename.

*CALL METHOD OF h_map 'PrintOut'.
  CALL METHOD OF h_map 'PrintPreview'.
  CALL METHOD OF h_mapl 'Close'.

Tuesday, 14 February 2017

MS word editor in Smartforms


Go to se38
Run RSCPSETEDITOR
     Check is SAPscript and Smart Form boxes Active.
     Uncheck is SAPscript and Smart Form boxes Inactive.
And click in Activate button.

Monday, 23 January 2017

Emphasize in ALV

Emphasize is a 4-char field where :
     - 1st char = C (color property)
     - 2nd char = color code (from 0 to 7)
          0 = background color
          1 = blue
          2 = gray
          3 = yellow
          4 = blue/gray
          5 = green
          6 = red
          7 = orange
     - 3rd char = intensified (0=off, 1=on)
     - 4th char = inverse display (0=off, 1=on)

Tuesday, 16 August 2016

ABAP performance tuning for Nested Loop


SORT itab1 BY F1.
SORT itab2 BY F1.

LOOP AT itab1.
    
READ TABLE itab2 TRANSPORTING NO FIELDS 
    WITH KEY matnr itab1-F1 BINARY SEARCH.
    
IF sy-subrc <> 0.
      
CONTINUE.
    
ENDIF.
    v_indx 
sy-tabix.
    
LOOP AT itab2 FROM v_indx.
      
IF itab1-F1 <> itab2-F1.
        
EXIT.
      
ENDIF.
         
    ENDLOOP.

ENDLOOP.

Thursday, 2 July 2015

Spilt stream text

 

Use Class

CL_ABAP_CHAR_UTILITIES

Ex.

SPLIT v_remark at CL_ABAP_CHAR_UTILITIES=>CR_LF
into TABLE it_tmp.

Wednesday, 1 July 2015

Get Resolution Screen

 
DATA: lref_consumer type ref to cl_gui_props_consumer,

ls_metric_factors type cntl_metric_factors.
lref_consumer = cl_gui_props_consumer=>create_consumer( ).
ls_metric_factors = lref_consumer->get_metric_factors( ).
WRITE: ls_metric_factors-screen-x,

  ls_metric_factors-screen-y.