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: 

Problems related to excluding materials starting and ending with certain ch

Former Member
0 Kudos
307

Hi,

I am suppose to exclude materials starting with INS* and X* , materials ending with *TX or *NP , Procurement key E ,special procurement key 50 and cross-plant status Z8. Before this i am getting these values in an internal table . Later using the values from this table i have to modify another Ztable. How do i do this???I have to get all values in the first internal table and then filter based on the above conditions.Please reply urgent.

Thanks,

Sindhu.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
171

Sindhu,

If you have this in the internal table.

Prepare a ranges for the materials ..

R_MATERIAL-SIGN = 'E'.

R_MATERIAL-OPTION = 'EQ'.

R_MATERIAL-LOW = 'INS*'.

APPEND R_MATERIAL.

Do this for all the patterns.

Now, you can delete the internal table

DELETE ITAB WHERE MATERIAL IN R_MATERIAL

AND PROCUREMENT_KEY = 'E'..........

Similarly add other clauses as well.

At the end of the DELETE statement your internal will have only the filtered data.

Regards,

Ravi

3 REPLIES 3

Former Member
0 Kudos
172

Sindhu,

If you have this in the internal table.

Prepare a ranges for the materials ..

R_MATERIAL-SIGN = 'E'.

R_MATERIAL-OPTION = 'EQ'.

R_MATERIAL-LOW = 'INS*'.

APPEND R_MATERIAL.

Do this for all the patterns.

Now, you can delete the internal table

DELETE ITAB WHERE MATERIAL IN R_MATERIAL

AND PROCUREMENT_KEY = 'E'..........

Similarly add other clauses as well.

At the end of the DELETE statement your internal will have only the filtered data.

Regards,

Ravi

0 Kudos
171

I think this is backwards......



<b>*R_MATERIAL-SIGN = 'E'.
R_MATERIAL-SIGN = 'I'.</b>
R_MATERIAL-OPTION = 'EQ'.
R_MATERIAL-LOW = 'INS*'.
APPEND R_MATERIAL.

Do this for all the patterns.

Now, you can delete the internal table

DELETE ITAB WHERE MATERIAL IN R_MATERIAL
AND PROCUREMENT_KEY = 'E'..........


Since we are deleting what is in the range, the OPTION needs to be I.

Regards,

Rich Heilman

former_member181962
Active Contributor
0 Kudos
171

select *

from dbtab

into table itab

where procurementkey <> 'E'

and special procurement key <> '50'

and cross plantr status <> 'Z8'.

loop at itab.

if itab-matnr cp 'INS' or itab-matnr cp 'X'

or itab-matnr cp 'TX' or itab-matnr cp 'NP'.

delete itab.

endif.

endloop.

modify ztable from table itab.

Regards,

Ravi