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 from internal table based on select options

Former Member
0 Likes
10,247

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
Read only

Former Member
3,102

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
Read only

Former Member
0 Likes
3,102

loop at it_vbeln .

if it_vbeln-vbeln in s_vbeln .

else.

delete it_vbeln index sy-tabix.

endif.

endloop.

Read only

Former Member
3,103

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.

Read only

Former Member
0 Likes
3,102

Hello,

Try this:


  DELETE it_vbeln WHERE NOT vbeln IN s_vbeln.

.

Regards,

Read only

Former Member
0 Likes
3,102

Hi,

You can use single row operation :

delete it_vbeln where not vbeln in s_vbeln.

thanks

MV