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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

loop at ztable where client in s_client .

delete ztable.

endloop.

or

delete ztable where client in s_client.

regards

Nicole

0 Kudos

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.

Former Member
0 Kudos

loop at s_client.

delete from internal where client = s_client-low.

endloop.

Regards

MD

Former Member
0 Kudos

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.

former_member598013
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

delete ztable where not client in s_client.