‎2009 Dec 29 8:09 AM
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
‎2009 Dec 29 8:20 AM
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
‎2009 Dec 29 8:37 AM
hi pravin,
i have checked and it gets failed for next select statement.
can you be little more clearer pls.
‎2009 Dec 29 8:26 AM
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
‎2009 Dec 29 8:35 AM
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.
‎2009 Dec 29 9:11 AM
Hi laya,
You debug your code step-by-step.
you will get exactly where is problem
that is the best way.