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

Former Member
0 Likes
934

Hi Guyz,

How can i delete entries in the internal table based on the selection screen , ie, i have range of clientnumber on the selection screen..i should delete all my entries in the internal table which are not equal to the client numbers based on the selection screen.. plz advise

declaration:

select-options:

s_client type ztable-client

regds

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
897

Check this example..


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.

Regards,

Omkaram.

7 REPLIES 7
Read only

Former Member
0 Likes
897

Hi,

loop at ztable where client in s_client .

delete ztable.

endloop.

or

delete ztable where client in s_client.

regards

Nicole

Read only

0 Likes
897

thanks for your replies..

but i need to delete the entries which are not specified on the selection screen..not the entries equal to the clientnumbers on the selection screen.

Read only

Former Member
0 Likes
897

loop at s_client.

delete from internal where client = s_client-low.

endloop.

Regards

MD

Read only

Former Member
0 Likes
898

Check this example..


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.

Regards,

Omkaram.

Read only

Former Member
0 Likes
897

Hi ,

There are several ways you can delete the records,

One way is :

Loop at <final_table>

if <final_table> value = selection screen value Then

delete index sy-tabix.

endif.

Endloop.

Thanks,

Chidanand

Read only

Former Member
0 Likes
897

Hi Brightside,

follow the logic below,



data: st_client like s_client.

loop at <your_internal_table>.
  read s_client into st_client where client eq <your_internal_table>-client.
  if sy-subrc ne 0.
     delete <your_internal_table>.
  endif.
endloop.

Regards,

Kiran

Read only

0 Likes
897

delete ztable where not client in s_client.