‎2008 Dec 10 7:20 AM
Hi all,
My internal table consist of following fields and documents.
BUKRS BELNR AUGBL
1000 100001 100023
1000 100001 100023
1000 100001 100001
1000 100001 100024
1000 100001 100024
For this I want to keep the documents under in condition BELNR = AUGBL in my internal table. Other documents in ITAB u2013 should be deleted..
i.e. Output of ITAB is like :
BUKRS BELNR AUGBL
1000 100001 100001
Other records I want delete without using loop. How to do this one,,,,
Thanks,,,,,,
‎2008 Dec 10 7:24 AM
Hi
Declare an extra flag in the Itab.
loop at itab
if itab-belnr = itab-aubel
else
flag = 'X'.
endif.
modify itab index sy-tabix.
endloop
delete itab wher flag = 'X'.
Best Regards
Ramchander Rao.K
‎2008 Dec 10 7:25 AM
Hi,
i think you cannot do without looping the table.
you can build the range for belnr and use the delete statement..like this
Delete itab where not augbl in r_belnr.
‎2008 Dec 10 7:25 AM
loop at itab.
if itab-belnr = itab-augbl.
delete itab from itab.
endif.
endloop.
Regards,
Ajay
‎2008 Dec 10 7:27 AM
‎2008 Dec 10 7:35 AM
‎2008 Dec 10 7:57 AM
Hi,
Why you don't want to use a loop?
If using a loop, your case is much easier than expected.
Regards,
Chris Gu
‎2008 Dec 10 8:47 AM
Do this for an internal table withe header line
DELETE ITAB WHERE BELNR = itab-AUGBL .
This will help!
Regards,
Prashant
‎2008 Dec 10 8:55 AM
HI Prashat,
NO,,,THIS STATMENT IS NOT WORKING BECAUSE itab-AUGBL IS BLANK ( DOESN'T HAVE ANY VALUE ) .ALSO NO NEED TO LOOP THIS ITAB . IF ANY OTHER WAY TO SOLVE THIS ISSUE.
‎2008 Dec 10 9:34 AM
Hi,
Try like this:
sort itab by bukrs belnr augbl.
loop at itab.
clear aug.
aug = itab-augbl.
delete itab where belnr = aug.
write:/ itab-bukrs, itab-belnr, itab-augbl.
endloop.
Regards,
Bhaskar