‎2007 Aug 06 6:24 AM
Hi all,
how can i find the list of materials for the given component(idnrk).
is there any function module?
help me in this regard
‎2007 Aug 06 11:30 AM
‎2007 Aug 06 11:45 AM
if u want to find the components for a material u can see in CS03
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
FTREL = ' '
ALEKZ = ' '
ALTVO = ' '
AUFSW = ' '
AUMGB = ' '
AUMNG = 0
AUSKZ = ' '
AMIND = ' '
BAGRP = ' '
BEIKZ = ' '
BESSL = ' '
BGIXO = ' '
BREMS = ' '
CAPID = 'SD01'
CHLST = ' '
COSPR = ' '
CUOBJ = 000000000000000
CUOVS = 0
CUOLS = ' '
DATUV = sy-datum
DELNL = ' '
DRLDT = ' '
EHNDL = '1'
EMENG = 0
ERSKZ = ' '
ERSSL = ' '
FBSTP = ' '
KNFBA = ' '
KSBVO = ' '
MBWLS = ' '
MKTLS = 'X'
MDMPS = ' '
MEHRS = 'X'
MKMAT = ' '
MMAPS = ' '
SALWW = ' '
SPLWW = ' '
MMORY = ' '
MTNRV = T_MAT-MATNR
NLINK = ' '
POSTP = ' '
RNDKZ = ' '
RVREL = ' '
SANFR = ' '
SANIN = ' '
SANKA = ' '
SANKO = ' '
SANVS = ' '
SCHGT = ' '
STKKZ = ' '
STLAL = ' '
STLAN = ' '
STPST = 0
SVWVO = 'X'
WERKS = MAAPV-DWERK
NORVL = ' '
MDNOT = ' '
PANOT = ' '
QVERW = ' '
VERID = ' '
VRSVO = 'X'
IMPORTING
TOPMAT = itopmat
DSTST = idstst
TABLES
stb = istb
MATCAT = imatcat
EXCEPTIONS
ALT_NOT_FOUND = 1
CALL_INVALID = 2
MATERIAL_NOT_FOUND = 3
MISSING_AUTHORIZATION = 4
NO_BOM_FOUND = 5
NO_PLANT_DATA = 6
NO_SUITABLE_BOM_FOUND = 7
CONVERSION_ERROR = 8
OTHERS = 9
.
IDRNK will be in istb internal table.
‎2007 Aug 06 11:50 AM
- CSEP_MAT_BOM_READ
- CS_BOMHEADERS_GET_MAT
- CABM_READ_BOM_ITEM
- CS_BOM_EXPL_MAT_V2
- CS_BOM_EXPLOSION_MAT
Function module to display simple material BOMs
Function module CSAP_MAT_BOM_READ You can use this function module to display simple material
BOMs. You cannot display BOM groups (for example, all variants of a variant BOM). as in transaction
CS03. Current restrictions: You cannot display long texts. You cannot display sub-items. You cannot
display classification data of BOM items for batches. You can only display one alternative or variant.
You cannot enter an alternative for module CSAP_MAT_BOM_READ, so you always see alternative
01. The following example came from a posting on the SAP-R3-L mailing list.
Example:
data: begin of tstk2 occurs 0.
include structure stko_api02.
data: end of tstk2.
data: begin of tstp2 occurs 0.
include structure stpo_api02.
data: end of tstp2.
data: begin of tdep_data occurs 0.
include structure csdep_data.
data: end of tdep_data.
data: begin of tdep_descr occurs 0.
include structure csdep_descr.
data: end of tdep_descr.
data: begin of tdep_source occurs 0.
include structure csdep_source.
data: end of tdep_source.
data: begin of tdep_order occurs 0.
include structure csdep_order.
data: end of tdep_order.
data: begin of tdep_doc occurs 0.
include structure csdep_doc.
data: end of tdep_doc.
data: flg_warning like capiflag-flwarning.
call function CSAP_MAT_BOM_READ
exporting
material = MAT100′
plant = 0001′
bom_usage = 1′
valid_from = 20.12.1996′
valid_to
importing
fl_warning = flg_warning
tables
t_stko = tstk2
t_stpo = tstp2
t_dep_data = tdep_data
t_dep_descr = tdep_descr
t_dep_source = tdep_source
t_dep_order = tdep_order
t_dep_doc = tdep_doc
exceptions
error = 1.
regards,
srinivas
<b>*reward for useful answers*</b>
‎2007 Aug 06 11:55 AM
Hi,
First hit against the MAST table with the material number. Then hit against STPO with the internal BOM number to get the components. There are also some function modules that will do this to.
data: xmast type mast.
data: istpo type table of stpo with header line.
Select Single * from mast
where matnr = p_matnr.
If sy-subrc = 0.
Write:/ 'This material has a BOM'.
else.
Write:/ 'No BOM found'.
Endif.
write:/ 'Components'.
select * into corresponding fields of table istpo
from stpo
where stlnr = xmast-stlnr.
loop at istpo.
write:/ istpo-idnrk.
endloop.
Regards