‎2009 Nov 04 4:09 PM
hi all
I have internal table lt_mara
some material number begin with X
eg.
34532
X5435
45355
53
X46534
X532
how to isolate materijals vith X.
‎2009 Nov 04 4:22 PM
Hello,
If you are open to using LOOP on LT_MARA, then i can propose.
LOOP AT IT_MARA WHERE MATNR+0(1) = 'X'.
DELETE IT_MARA.
ENDLOOP.
BR,
Suhas
BTW the field MATNR is not numneric, it is of type CHAR length 18. So what is your issue?
‎2009 Nov 04 4:28 PM
‎2009 Nov 04 4:28 PM
Hi Suhas,
Can we use the following instead of looping.
DELETE IT_MARA WHERE MATNR+0(1) = 'X'.
Regards,
nilesh.
‎2009 Nov 04 4:31 PM
here is solution
loop at t2 where matnr cp 'X*'.
write : t2.
endloop.
‎2009 Nov 04 4:34 PM
Hello Nick,
We need to have a look @ the structure of LT_MARA, you must have declared MATNR as numeric;-)
That's what i have added in my PS. Is there any reason of declaring MATNR as numeric, can you switch the declaration to
TYPE MATNR@ Nilesh: I was thinking about the same & checked
DELETE IT_MARA[] WHERE MATNR+0(1) = 'X'.works
BR,
Suhas
‎2009 Nov 04 4:25 PM
TYPES :
begin of ty_matnr,
matnr type matnr,
end of ty_matnr.
data : i_tab type STANDARD TABLE OF ty_matnr,
wa_tab type ty_matnr.
data : r_range type RANGE OF matnr,
wa_range like line of r_range.
wa_tab-matnr = '3453562'.
append wa_tab to i_tab.
wa_tab-matnr = 'X36732'.
append wa_tab to i_tab.
wa_tab-matnr = '34532'.
append wa_tab to i_tab.
wa_tab-matnr = 'X34532546'.
append wa_tab to i_tab.
wa_tab-matnr = '3453256'.
append wa_tab to i_tab.
wa_tab-matnr = '34535462'.
append wa_tab to i_tab.
wa_range-sign = 'I'.
wa_range-option = 'CP'.
wa_range-low = 'X*'.
append wa_range to r_range.
loop at i_tab into wa_tab where matnr in r_range.
write : / wa_tab-matnr.
endloop.
‎2009 Nov 04 4:32 PM
‎2009 Nov 04 4:34 PM
Let me see if I understand:
You have a character field. Some values are entirely numeric and some start with 'X'. You don't know how to find the ones that start with 'X'.
Is that correct?
Rob