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

get material number

Former Member
0 Likes
1,158

hi sap,

pls let me have your valuble advice.

i need to get the material number for the combination of 2 characterists like CC-HANDLINGCAT and CC-HANDLINGSUBCAT.

When i go to TCODE : MM03 and give a MATERIAL number I see that its a combination of above two characteristics.

i have wirtten code but i dont get the Material number for the combination of TWO but instead i get 2 materail numbers.

this is my code i know that i have made a mistake but i dont know where it is. your valuble answer wil definately will help me.

code :

SELECT * FROM cabn INTO wa_cabn

WHERE atnam = 'CC-HANDLINGCAT'.

  • AND atnam = 'CC-HANDLINGSUBCAT'.

ENDSELECT.

if sy-subrc = 0.

SELECT * FROM ausp INTO wa_ausp

WHERE atinn = wa_cabn-atinn

AND atwrt = var12.

ENDSELECT.

if sy-subrc = 0.

select * from inob into wa_inob

where cuobj = wa_ausp-objek.

ENDSELECT.

if sy-subrc = 0.

select * from mara into w_mara

where matnr = wa_inob-OBJEK.

ENDSELECT.

move w_mara-matnr to j_key.

endif.

endif.

endif.

  • *************************************************************************

SELECT * FROM cabn INTO wa_cabn

WHERE atnam = 'CC-HANDLINGSUBCAT'.

ENDSELECT.

if sy-subrc = 0.

SELECT * FROM ausp INTO wa_ausp

WHERE atinn = wa_cabn-atinn

AND atwrt = var13.

ENDSELECT.

if sy-subrc = 0.

select * from inob into wa_inob

where cuobj = wa_ausp-objek.

ENDSELECT.

if sy-subrc = 0.

select * from mara into w_mara

where matnr = wa_inob-OBJEK.

ENDSELECT.

move w_mara-matnr to j_key.

endif.

endif.

endif.

thanks

5 REPLIES 5
Read only

Former Member
0 Likes
1,122

Try this

SELECT * FROM cabn INTO wa_cabn

WHERE atnam = 'CC-HANDLINGCAT'.

  • OR *atnam = 'CC-HANDLINGSUBCAT'.

ENDSELECT.

Edited by: pravin s. on Dec 29, 2009 9:21 AM

Read only

0 Likes
1,122

hi pravin,

i have checked and it gets failed for next select statement.

can you be little more clearer pls.

Read only

viquar_iqbal
Active Contributor
0 Likes
1,122

Hi,

First check if you have corresponding data in all the 3 tables for which you have put a query. Then try to remove the sy-subrc check and see in debug if you have data . Im sure youll find tat the last query is failing else your querying wrong table.

Thanks

Viquar Iqbal

Read only

0 Likes
1,122

i have debuged and saw that i have the data in all 3 tables... but for one characteriscts i get a material number for ex : 100 and other characteriscts i get diferent material number ex : 200.

i saw that it does not fail any where and sy-subrc = 0. what can i do or which table do i need to look into to get the material number. your help is highly appriciated.

thank you,

pasala.

Read only

Former Member
0 Likes
1,122

Hi laya,

You debug your code step-by-step.

you will get exactly where is problem

that is the best way.