2006 Jan 19 5:26 PM
Hi All,
I have a problem with selecting the BOMs for avaible MATNR's.
My current report is displaying the Material Master data...with Material Numbers.
The existing part of the code is some thing like this:
talbes: mara.
data: begin of i_mdata occurs 0,
mtno like mara-matnr,
-
-
end of i_mdata.
now i have to select the BOM's(STPO-IDNRK) for these material numbers.
could anybody plz tell me how to do the selection..
thnkx
Hi All,
I have a problem with selecting the BOMs for avaible MATNR's.
My current report is displaying the Material Master data...with Material Numbers.
The existing part of the code is some thing like this:
talbes: mara.
data: begin of i_mdata occurs 0,
mtno like mara-matnr,
-
-
end of i_mdata.
now i have to select the BOM's(STPO-IDNRK) for these material numbers.
could anybody plz tell me how to do the selection..
thnkx
2006 Jan 19 5:31 PM
Hi,
Welcome to SDN.
Try function : CSAP_MAT_BOM_READ
Use i/p Parameters for this function module : MAterial , Plant and BOM Usage.
This will return BON in Table T_STPO.
Lanka
Message was edited by: Lanka Murthy
2006 Jan 19 5:36 PM
Here is one approach.
report zrich_0003.
data: i_mara type table of mara with header line.
data: i_mast type table of mast with header line.
data: i_stpo type table of stpo with header line.
select-options: s_matnr for i_mara-matnr.
start-of-selection.
select * from mara into table i_mara
where matnr in s_matnr.
check not i_mara[] is initial.
select * from mast into table i_mast
for all entries in i_mara
where matnr = i_mara-matnr.
check not i_mast[] is initial.
select * from stpo into table i_stpo
for all entries in i_mast
where stlnr = i_mast-stlnr.
loop at i_mast.
write:/ i_mast-matnr, i_mast-werks.
loop at i_stpo where stlnr = i_mast-stlnr.
write:/ i_stpo-idnrk.
endloop.
endloop.
Welcome to SDN. Please remember to award points for helpful answers ans mark you post as solved when solved completely . Thanks.
Regards,
Rich Heilman
2006 Jan 19 5:54 PM
Hi Rich,
thnks for the reply..
but i cant take the select-options for the matnr.
as i told u, i hve to use the internal table which is already with Material Master details....here, the Itab is: i_mdata.
i have to write the select statement for retrieving the BOMs based on the <b>i_mdata-mtno</b> <b>compulsorily.</b>
plz check this....and let me know how to select those..
thnx
2006 Jan 19 6:03 PM
This was meant to be an example, not a 100% solution for you. But it remains the same......
data: i_mast type table of mast with header line.
data: i_stpo type table of stpo with header line.
start-of-selection.
check not <b>i_mdata</b>[] is initial.
select * from mast into table i_mast
<b>for all entries in i_mdata</b>
where matnr = <b>i_mdata-matnr</b>.
check not i_mast[] is initial.
select * from stpo into table i_stpo
for all entries in i_mast
where stlnr = i_mast-stlnr.
loop at i_mast.
write:/ i_mast-matnr, i_mast-werks.
loop at i_stpo where stlnr = i_mast-stlnr.
write:/ i_stpo-idnrk.
endloop.
endloop.
Regards,
Rich Heilman
2006 Jan 19 10:56 PM
You have already gone halfway to your goal... You just need to go to the table MAST using MATNR to get the id needed to get to STPO... that is the basic layout of it...