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 itab where char <> char

Former Member
0 Kudos
295

select option: matnr for mara-matnr.

i need to delete from itab value(char 254) in matnr(char

18)

i made delete itab where value in matnr.

but it's not right.

7 REPLIES 7
Read only

Former Member
0 Kudos
259

select-options : s_matnr for mara-matnr.

sort itab by matnr.

delete itab where matnr not in s_matnr.

Regards,

madan.

Read only

Former Member
0 Kudos
259

Hi,

Try the below code:


Loop at itab.
  l_matnr = itab-value(18).
  If l_matnr = matnr.
     Delete itab.
  Endif.
Endloop.

Thanks and Regards,

Lakshmi.

Read only

0 Kudos
259

my matnr is in s.option , mean table how i can make = to a table.

or "read table itab with key value+0(18) in matnr"

Read only

0 Kudos
259

Hi,

Move itab-value to any variable of length 18.

l_matnr = itab-value(18).

Then you can compare as given below:

If l_matnr in Matnr

Delete itab.

Endif.

This will work.

Thanks and Regards,

Lakshmi.

Read only

Former Member
0 Kudos
259

Write as :

delete itab where value+0(18) in matnr.

Read only

Former Member
0 Kudos
259

Hi,

Try like this

lv_matnr = itab-fieldname.

if matnr = lv_matnr.

delete from itab where matnr = matnr.

endif.

if its useful reward points

Read only

Former Member
0 Kudos
259

hi ,

try this code:

loop at itab.

condense itab-value.

read matnr with key matnr-low eq itab-value(18).

if sy-subrc eq 0.

delete itab.

endif.

endloop.

If the user gives range than u need to add some more logic to this..depending on how u get the materials of the range.

Regs,

Saurabh