‎2010 May 03 9:21 AM
Hi
i am trying to delete multiple entries from table while keeping some data.
for example I have the following table
Plant Item
US101 777
US101 888
US101 999
US101 666
I want to keep the rows where the item is 777 and 888 for plant US101 and keep delete the rest data
I wrote the following code
Delete source_package where Plant = 'US101' and Item NE '777' or '888'.
but all the rows get deleted.
I tried deleting single row and it worked.
Delete source_package where Plant = 'US101' and Item NE '777' .
How can I delete multiple rows.
thanks
‎2010 May 03 9:33 AM
Delete source_package where Plant = 'US101' and Item NE '777' and '888'.
(use 'AND' instead of 'OR' for selecting item).
Edited by: vijetasap on May 3, 2010 10:33 AM
‎2010 May 03 9:33 AM
Delete source_package where Plant = 'US101' and Item NE '777' and '888'.
(use 'AND' instead of 'OR' for selecting item).
Edited by: vijetasap on May 3, 2010 10:33 AM
‎2010 May 03 11:01 AM
Hi Bhat Vaidya,
Plz refer the following code.. IT will solve ur problem..
REPORT ZSDN_TEST.
data: BEGIN OF it_data OCCURS 10,
plant(4),
item_num TYPE string,
END OF it_data.
data: str type string.
data: it_final like it_data OCCURS 10 WITH HEADER LINE.
it_data-plant = 'US01'. it_Data-item_num = 777. append it_data.
it_data-plant = 'US01'. it_Data-item_num = 888. append it_data.
it_data-plant = 'US01'. it_Data-item_num = 999. append it_data.
it_data-plant = 'US01'. it_Data-item_num = 666. append it_data.
delete it_data where plant = 'US01' and item_num ne 777 and item_num ne 888.
LOOP AT it_data.
write:it_data-plant,it_data-item_num.
skip.
ENDLOOP.Regards,
Apoorv