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 internal table matnr

Former Member
0 Likes
1,472

dear all

i want to delete internal table where matnr = '*J'. my material code is like 'E5178MPO80/095SJ'. so i want to delete where last character is J.

advance thanks

regards

p sree hari

7 REPLIES 7
Read only

Former Member
0 Likes
1,061

HI,

Use this code,

Loop at itab.
if itab-matnr+15(1) = 'J'.
   delete itab.
endif.
endloop.

Regards.

Read only

Former Member
0 Likes
1,061

Hi,

Try this way..

RANGES : R_MATNR FOR MARA_MATNR.

R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'CP'.
R_MATNR-LOW = '*J'.
APPEND R_MATNR. CLEAR R_MATNR.

DELETE ITAB WHERE MATNR IN R_MATNR.

Read only

Former Member
0 Likes
1,061

please don't use ranges for internal tables. there is no advantage.

The first solution is o.k., but use no headerlines,

... see below ....

Edited by: Siegfried Boes on Jul 27, 2009 1:39 PM

Read only

Former Member
0 Likes
1,061

Hi,


No need of loop here.
delete itab where  matnr+17(1) = 'J'.  " deletes all the matnr ending with 'J'.

conclusion as 
data : matnr type matnr,w_i type i .
matnr = '000000000000000023'.
w_i = matnr+17(1).
write w_i . " Answer is 3 here

hope this might be helpfull,

Regards,

Aby

Read only

ThomasZloch
Active Contributor
0 Likes
1,061

why not simply use

DELETE itab WHERE MATNR CP '*J'.

?

Thomas

Read only

0 Likes
1,061

Thanks. That was helpful for me.

Read only

Former Member
0 Likes
1,061

E5178MPO80 /095SJ


LOOP AT itab ASSIGNING <fs>.
  IF ( <fs>-matr+16(1) = 'J' ).
    DELETE itab INDEX sy-tabix.
  ENDIF.
ENDLOOP.

I have my doubts that the WHERE-condition also offset manipulation.

The CP is probably less efficient than something with one offset check.

It depends on size of itab.

Please, recount the offset, there are no proposals between 15 and 17

Siegfried