Application Development 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: 

delete from internal table based on select options

Former Member
0 Kudos

example :

selection-options : s_vbeln .

it has 1 to 10 low and high values

internal table it_vbeln has 1 - 20 vbeln values .

now i wanna delete entries which are not applicable as per s_vbeln.

that is from 11 to 20 must be deleted .

Please help.

1 ACCEPTED SOLUTION

Former Member

This should work.


tables: vbak.
DATA: BEGIN OF itab OCCURS 0,
  vbeln LIKE vbak-vbeln,
  END OF itab.

SELECT-OPTIONS s_vbeln for vbak-vbeln.

DELETE itab WHERE NOT vbeln IN s_vbeln.

4 REPLIES 4

Former Member
0 Kudos

loop at it_vbeln .

if it_vbeln-vbeln in s_vbeln .

else.

delete it_vbeln index sy-tabix.

endif.

endloop.

Former Member

This should work.


tables: vbak.
DATA: BEGIN OF itab OCCURS 0,
  vbeln LIKE vbak-vbeln,
  END OF itab.

SELECT-OPTIONS s_vbeln for vbak-vbeln.

DELETE itab WHERE NOT vbeln IN s_vbeln.

Former Member
0 Kudos

Hello,

Try this:


  DELETE it_vbeln WHERE NOT vbeln IN s_vbeln.

.

Regards,

Former Member
0 Kudos

Hi,

You can use single row operation :

delete it_vbeln where not vbeln in s_vbeln.

thanks

MV