Wednesday, September 16, 2009

when and where we can use parallel cursor


Loop AT i_primary into wa_primary.
Loop AT i_secondary into wa_secondary from lv_index.
If ( wa_primary-field1 NE wa_secondary-field1 ) or
( wa_primary-field2 NE wa_secondary-field2 ).
Lv_index = sy-tabix.
Endif.
“ your code comes here “
Endloop.
Endloop.
To use this following should be true
1)      Both tables should be sorted with the same key ( in the above case field1 and field2 )
2)      The mapping between primary to secondary tables should be
a.       one to many ( for one record in primary there are multiple records in secondary )
b.      one to one (for one record in primary there is only one in secondary )
Please note that other than the above 2 other 2 scenarios (many to many & many to one) will not work with the above logic and make sure you don’t use in such case.
3)      The secondary table should not contain a record which does not map to the primary table ( this will not happen if the secondary is fetched using for all entries from primary )
4)      Please make sure you do not delete any record from primary before using the logic which will make the point 3 false  
5)      If you were to use a 'AND' in where statement of the inner loop you should use or in the inner loop if condition in the above logic. 
 

Friday, September 11, 2009

Copy to Clipborad SAP

copy to clipborad

Bellow code is how to copy data to clipboard. This feature helps you when there is a BDC recording and you want to add selection extended options

    DATA: v_rc TYPE I,
       it_data TYPE STANDARD TABLE OF CHAR128,
       wa_data TYPE char128.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>CLIPBOARD_EXPORT
    IMPORTING DATA = it_data
    CHANGING RC = v_rc      .
Google