2009 Sep 30 3:44 PM
Hi,
Is there any one line syntax to delete entries from an internal table comparing the fields of another internal table.
Regards
mac
2009 Sep 30 3:49 PM
I dont think you can achieve it using any one line syntax.
u need to use this
DELETE itab [WHERE log_exp].Use this statement inside another loop with which u want to compare the table whose lines need to be deleted.
кu03B1ятu03B9к
Edited by: Kartik Tarla on Sep 30, 2009 8:19 PM
2009 Sep 30 3:51 PM
Hi
U need to insert the table to be deleted in a loop of main table:
LOOP AT ITAB1.
DELETE ITAB2 WHERE FIELD = ITAB1-FIELD.
ENDLOOP.Max
2009 Dec 16 10:44 AM
2011 Mar 09 5:14 AM
2014 Nov 28 10:10 AM
Hi,
You want to delete all records from it_tab_child which are present in it_tab_parent i.e. child has 100 records but you want to delete 50 records which are present in parent.
SORT it_tab_child BY key_field.
LOOP AT it_tab_parent ASSIGNING <fs_parent>.
"Warning: it_tab_child cannot have duplicate record on key_field!!!
READ TABLE it_tab_child ASSIGNING <fs_child> WHERE key_field = <fs_parent>-key_field
BINARY SEARCH.
IF sy-subrc EQ 0.
<fs_child>-key_field = space.
ENDLOOP.
DELETE it_tab_child WHERE key_field = space.
***This code has ~40% more efficient than deleting records inside the loop.
2014 Nov 29 7:23 AM
Make it_tab_child a HASHED table with a unique key, and it'll be even faster.
SORT/READ/BINARY SEARCH is so last millennium.
2023 Mar 07 10:21 AM
IF lt_tab1[] IS NOT INITIAL.
DATA(lr_vbeln) = VALUE psi_we_selopt_tt( FOR ls_tab1 IN lt_tab1
( sign = 'I'
option = 'EQ'
low = ls_tab1-vbeln ) ).
DELETE lt_tab2 WHERE vbeln in lr_vbeln.
ENDIF.