Skip to Content
0
Former Member
Jan 29, 2010 at 09:24 AM

Need better solution

17 Views

Hi Gurus,

Please find the below code segment.

LOOP AT itab_vbap INTO wa_vbap.
READ TABLE itab_vbak INTO wa_vbak
         WITH KEY vbeln = wa_vbap-vbeln BINARY SEARCH.
IF wa_vbap-zshipdate NOT IN s_fsd.
          DELETE itab_vbap WHERE vbeln = wa_vbak-vbeln.
        ENDIF.
ENDLOOP.

The above code segment is working fine, but I need a better solution.

Reason: I feel the DELETE statement which is deleting entries from the ITAB vbap is inside the LOOP of vbap and thus this might result in some inconsistency.

The READ statement is written because to make sure those entries are deleted which are present in VBAK and VBAP and satisfies the given condition.

Please provide an alternative and better solution to this code.

Thanks !