‎2006 Jun 29 4:51 AM
Hi ABAPers,
Currently i'm working on FM 'CS_BOM_EXPL_MAT_V2' to retrieve BOM information.
May i know how to remove the parent record after retrieving the child for my report?
I tried using assembly indicator to solve the problem but so far i couldnt get the exact table for the assembly indicator field.
Thanks in advance.
‎2006 Jun 29 4:56 AM
data: begin of stpox occurs 1000.
include structure stpox.
data: end of stpox.parameters:
p_matnr type marc-matnr,
p_werks type marc-werks. call function 'CS_BOM_EXPL_MAT_V2'
exporting
capid = 'PP01' mehrs = 'X' datuv = sy-datum mtnrv = P_matnr werks = p_werks emeng = '1'
tables
stb = stpox 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 others = 8.
loop at stpox.
write:/ stpox.
endloop.
‎2006 Jun 29 5:31 AM
Hi Choong,
See this sample code:
For BOM Material Number Conversion
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = V_MATNR "Material BOM
IMPORTING
OUTPUT = V_MATNR "Material BOM
EXCEPTIONS
LENGTH_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
CLEAR: STPOX_TAB_TMP.
REFRESH: STPOX_TAB_TMP.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
AUFSW = 'X'
CAPID = CAPID
CAPID = 'PP01'
MDMPS = 'X'
MEHRS = 'X'
DATUV = SY-DATUM
MTNRV = V_MATNR
WERKS = C_WERKS "Plant
STLAL = STLAL
STLAN = STLAN
IMPORTING
TOPMAT = TOPMAT
DSTST = DSTST
TABLES
STB = STPOX_TAB_TMP
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
OTHERS = 8.
IF SY-SUBRC = 0.
LOOP AT STPOX_TAB_TMP.
Here u can get all the records
ENDLOOP.
‎2006 Jun 29 8:54 AM
Thank you selva.
So far, i've succeeded in displaying all the child records in my report.
Can you give me guidelines on how to retrieve the total quantities needed from the child records in order to make certain amount of products for the parent record?
best regard.
‎2006 Jun 29 9:44 AM
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
AUFSW = 'X'
CAPID = CAPID
CAPID = 'PP01'
MDMPS = 'X'
MEHRS = 'X'
DATUV = SY-DATUM
MTNRV = V_MATNR
*Begin of TSTK932303
WERKS = I_AFKO-WERKS
WERKS = C_WERKS
*End of TSTK932303
STLAL = STLAL
STLAN = STLAN
IMPORTING
TOPMAT = TOPMAT
DSTST = DSTST
TABLES
STB = STPOX_TAB_TMP
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
OTHERS = 8.
IF SY-SUBRC = 0.
LOOP AT STPOX_TAB_TMP.
<b>V_BOM quantity = V_BON quantity + STPOX_TAB_TMP-
<u>MNGKO</u>. "BOM Quantity</b>
or V_Comp_quantity = V_Comp_quantity + STPOX_TAB_TMP-
<u>MENGE</u>.
if FMENG(Fixed Quantity)
ENDLOOP.