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

Former Member
0 Kudos
114

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

Former Member
0 Kudos
78

select-options : s_matnr for mara-matnr.

sort itab by matnr.

delete itab where matnr not in s_matnr.

Regards,

madan.

Former Member
0 Kudos
78

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.

0 Kudos
78

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"

0 Kudos
78

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.

Former Member
0 Kudos
78

Write as :

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

Former Member
0 Kudos
78

Hi,

Try like this

lv_matnr = itab-fieldname.

if matnr = lv_matnr.

delete from itab where matnr = matnr.

endif.

if its useful reward points

Former Member
0 Kudos
78

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