Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Internal table - Issue

Former Member
0 Likes
902

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,,,,,,

9 REPLIES 9
Read only

Former Member
0 Likes
873

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

Read only

Former Member
0 Likes
873

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.

Read only

Former Member
0 Likes
873

loop at itab.

if itab-belnr = itab-augbl.

delete itab from itab.

endif.

endloop.

Regards,

Ajay

Read only

abdul_hakim
Active Contributor
0 Likes
873

Not Possible without Loop.

Read only

Former Member
0 Likes
873

hi,

no this can not be achieved without loop

Thanks

Saurabh.

Read only

Former Member
0 Likes
873

Hi,

Why you don't want to use a loop?

If using a loop, your case is much easier than expected.

Regards,

Chris Gu

Read only

Former Member
0 Likes
873

Do this for an internal table withe header line

DELETE ITAB WHERE BELNR = itab-AUGBL .

This will help!

Regards,

Prashant

Read only

0 Likes
873

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.

Read only

Former Member
0 Likes
873

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