2008 Mar 12 11:09 AM
Hello everyone,
i have an internal table with fields
belnr,, ktosl, kunnr.
i want to delete the entries when
KTOSL NE 'VAT' OR KTOSL NE 'CST' OR KTOSL IS INITIAL.
tell me the syntax..
will be rewarded...
2008 Mar 12 11:15 AM
Hi,
Create a range :
ranges : gr_KTOSL for <tablename>-KTOSL.
gr_KTOSL-sign = 'I'.
gr_KTOSL-option = 'EQ'.
gr_KTOSL-low = 'VAT'.
append gr_KTOSL.
gr_KTOSL-sign = 'I'.
gr_KTOSL-option = 'EQ'.
gr_KTOSL-low = 'CST'.
append gr_KTOSL.
gr_KTOSL-sign = 'I'.
gr_KTOSL-option = 'EQ'.
gr_KTOSL-low = ''.
append gr_KTOSL.
delete itab where KTOSL not in gr_KTOSL.
Thanks,
Sriram Ponna.
2008 Mar 12 11:11 AM
Hi
delete itab[] where KTOSL NE 'VAT' OR KTOSL NE 'CST' OR KTOSL IS INITIAL.
Please check the syntax.
Regards
Shiva
2008 Mar 12 11:13 AM
loop at itab.
IF itab-KTOSL NE 'VAT'
OR itab-KTOSL NE 'CST'
OR itab-KTOSL IS INITIAL.
delete itab.
endif.
endloop.
2008 Mar 12 11:15 AM
Hi,
Create a range :
ranges : gr_KTOSL for <tablename>-KTOSL.
gr_KTOSL-sign = 'I'.
gr_KTOSL-option = 'EQ'.
gr_KTOSL-low = 'VAT'.
append gr_KTOSL.
gr_KTOSL-sign = 'I'.
gr_KTOSL-option = 'EQ'.
gr_KTOSL-low = 'CST'.
append gr_KTOSL.
gr_KTOSL-sign = 'I'.
gr_KTOSL-option = 'EQ'.
gr_KTOSL-low = ''.
append gr_KTOSL.
delete itab where KTOSL not in gr_KTOSL.
Thanks,
Sriram Ponna.
2008 Mar 12 11:16 AM
2008 Mar 12 11:18 AM
Hi,
Data : idx type sy-tabix.
loop at itab.
idx = sy-tabix.
if itab-kostl ne 'VAT' OR itab-kostl ne 'CST'
OR ITAB-KOSTL = SPACE.
DELETE ITAB INDEX IDX.
ENDIF.
endloop.
REGARDS,
V.BALAJI
2008 Mar 12 11:19 AM
Hello Samala,
KTOSL NE 'VAT' OR KTOSL NE 'CST' OR KTOSL IS INITIAL.
The standard syntax is:
DELETE itab WHERE <cond>.
in your case you can use like:
DELETE itab WHERE ktosl NE 'VAT' OR
ktosl NE 'CST' OR
ktosl EQ ' '.
If you are yusing a loop, the best way is:
LOOP AT itab.
.....................
IF itab-kosl IS INITIAL.
DELETE itab WHERE ktosl NE 'VAT' OR
ktosl NE 'CST'.
ENDIF.
.....................
ENDLOOP.
2008 Mar 12 2:44 PM
I think that the logical expression "KTOSL NE 'VAT' OR KTOSL NE 'CST' OR KTOSL IS INITIAL." is always true. So you will delete all entries in the table.