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

Delete Entries from Internal Table

Former Member
0 Likes
612

Hi experts ,

I need your help,

I have 2 internal tables

ITAB1

Vbeln posnr etenr

100 10 1

100 10 2

100 10 3

101 10 1

101 10 2

102 10 1

ITAB2

Vbeln posnr etenr

101 10 1

Now the Result should look like in Itab3

Vbeln posnr etenr

100 10 1

100 10 2

100 10 3

101 10 1

102 10 1

Means the values what we have in ITAB2 - etenr , if it is greater than 1 those entries should not be taken into consideration .

Can any one send the detailed code for the same.

Hi experts ,

I need your help,

I have 2 internal tables

ITAB1

Vbeln posnr etenr

100 10 1

100 10 2

100 10 3

101 10 1

101 10 2

102 10 1

ITAB2

Vbeln posnr etenr

101 10 1

Now the Result should look like in Itab3

Vbeln posnr etenr

100 10 1

100 10 2

100 10 3

101 10 1

102 10 1

Means the values what we have in ITAB2 - etenr , if it is greater than 1 those entries should not be taken into consideration .

Can any one send the detailed code for the same.

4 REPLIES 4
Read only

Former Member
0 Likes
593

Hi

declare itab1, itab2 and itab3 the final Itab.

Loop at itab1.

move-corresponding itab1 to itab3.

append itab3.

clear itab3.

endloop.

Loop at itab1.

read table itab2 with key vbeln = itab1-vbeln

posnr = itab1-posnr

etenr = itab1-etenr.

if sy-subrc = 0.

move-corresponding itab2 to itab3.

append itab3.

endif.

clear itab3.

endloop.

Regards

Anji

.

Read only

0 Likes
593

Hi Anji,

Thanks for your Reply .

The logic you suggested is not working.

my condition is that ITAB2-ETENR if its value is greater than 1 it should not consisderd for final Table Itab3

Read only

Former Member
0 Likes
593

Hi,

use this code.

itab3[] = itab1[].

loop at itab2.

loop at itab3 where vbeln = itab2-vbeln posnr = itab2-posnr etenr > 1.

delete itab3.

endloop.

endloop.

Reward if useful

Regards

ANUPAM

Read only

0 Likes
593

Hi Anupam,

Thanks for your Reply