07-08-2010 9:13 PM
Hi Gurus,
I am not an ABAPER. But I am looking for a FM which can be used to extract Multilevel BOM (All levels of BOM).
I know following FM gets component level only:-
'CSAP_MAT_BOM_ITEM_SELECT'
I researched on net and found some useful information but am unable to put things together.
For eg. please refer the linnk :-
http://www.sapfans.com/forums/viewtopic.php?f=13&t=52016
I am trying to explode material BOM. Just found on net that there are different FM's to explode diff categories of BOMs.
Can anyone please help.
Thanks
Edited by: Ray_Ray on Jul 8, 2010 10:19 PM
07-08-2010 9:34 PM
07-08-2010 9:27 PM
Hi,
In the standard transactions the functions csap_mat_bom_read , cs_where_used_mat are used.
The first one can be used for bom explosion from parent to child.Pass the material and plant to the function module , it will give the first level, then pass the materials obtained once again to the same function module for next level, repeat this process till no data is returned.
You can write a recursive logic to do this.
The second one gives you the upper level for a child part in the same manner.
07-09-2010 3:30 PM
Hi All,
Thanks for response. What I have understood so far is as follows:-
Use either of the mentioned FM and loop it till you get 0 for that material and it will happen till all the materials are covered.
Now what I am unable to understand is the field which would help me to identify the subsequest assemblies of the BOM. I am giving an example just so that I am able to make everyone understand what I am looking for.
We are maintaining Multilevel bom. The user needs a report in BI which gives information about Material and the UOM of one of the item which is in assembly. eg. ABC is the material for that we have a BOM which inturn has 4 items and one of the items has two more BOMS :-
ABC
]
-
] ] ] ]
ABC1 ABC2 ABC3 ABC4
]
-
] ] ]
ABC2.1 ABC2.2 ABC2.3
Now Users need UOM of ABC2.2 for ABC.
How can I link it. Which field can be used?
Please help.
Regards
07-09-2010 3:46 PM
The table STPO returned by the function module has a field COMP_UNIT ( unit of measure ) against every material.
07-09-2010 4:56 PM
Hi Ray,
Check this rough source code,
This gives you the logic how to explode multilevel BOM, make the necessary changes.
Please not that there is no logic written for the alternative BOM ( a material may contain more than one BOM ).
you can identify the alternative bom from the availabe fields of the fm output table.
REPORT zinverse_bom_explosion.
TABLES:mara,marc.
TYPES:BEGIN OF ty_1,
pmatnr TYPE csap_mbom-matnr,
matnr TYPE csap_mbom-matnr,
comp_qty TYPE p DECIMALS 0,
unit TYPE kmpme,
END OF ty_1,
BEGIN OF ty_2,
pmatnr TYPE csap_mbom-matnr,
matnr TYPE csap_mbom-matnr,
unit TYPE kmpme,
comp_qty TYPE p DECIMALS 0,
END OF ty_2.
DATA:it_list TYPE TABLE OF stpo_api02,
it_gather TYPE TABLE OF ty_1,
it_gather2 TYPE TABLE OF ty_1,
it_store TYPE TABLE OF ty_2.
DATA:g_cnt TYPE sy-tfill,
wa_gather TYPE ty_1,
wa_gather2 TYPE ty_1,
wa_stpov TYPE stpo_api02,
g_index TYPE sy-tabix,
g_partno TYPE marc-matnr,
wa_store TYPE ty_2,
g_usage TYPE csap_mbom-stlan,
g_datuv TYPE csap_mbom-datuv,
g_datub TYPE csap_mbom-datub.
PARAMETERS:p_matnr TYPE csap_mbom-matnr.
PARAMETERS:p_werks TYPE csap_mbom-werks.
START-OF-SELECTION.
g_usage = 'P'.
g_datuv = g_datub = sy-datum.
wa_gather-matnr = g_partno = p_matnr.
APPEND wa_gather TO it_gather.
PERFORM get_parts.
FORM get_parts .
CLEAR g_cnt.
DESCRIBE TABLE it_gather LINES g_cnt.
IF g_cnt = 0.
EXIT.
ENDIF.
LOOP AT it_gather INTO wa_gather.
CALL FUNCTION 'CSAP_MAT_BOM_READ'
EXPORTING
material = wa_gather-matnr
plant = p_werks
bom_usage = g_usage
valid_from = g_datuv
valid_to = g_datub
TABLES
t_stpo = it_list[]
EXCEPTIONS
error = 1
OTHERS = 2.
CLEAR g_cnt.
DESCRIBE TABLE it_list[] LINES g_cnt.
IF g_cnt = 0.
wa_store-matnr = g_partno.
MOVE wa_gather-matnr TO wa_store-pmatnr.
wa_store-comp_qty = wa_gather-comp_qty.
APPEND wa_store TO it_store.
CLEAR wa_store.
CLEAR wa_gather.
ELSE.
g_index = 0.
MOVE wa_stpov-component TO wa_gather2-matnr.
wa_gather2-comp_qty = wa_stpov-comp_qty.
APPEND wa_gather2 TO it_gather2.
CLEAR wa_gather2.
ENDIF.
REFRESH it_list[].
ENDLOOP.
it_gather[] = it_gather2[].
REFRESH it_gather2[].
PERFORM get_parts.
ENDFORM. "get_parts
07-12-2010 7:14 PM
Hi,
Can we use FM 'CABM_READ_BOM_ITEM' for the same purpose?
Regards
07-08-2010 9:34 PM
07-08-2010 10:45 PM
There is no standard Fm which will explode the BOM to the last level. You can use the FM CS_BOM_EXPL_MAT_V2 in a loop to explode the subassemblies in every loop pass.
07-12-2010 7:44 PM
actually, FM CS_BOM_EXPL_MAT_V2 DOES do a multi-level explosion. specify "X" in the MEHRS parameter, and you geta full, multi-level explosion with a single call
07-28-2010 8:19 PM
Hi David,
Can you please tell me which field can be used to identify all levels of a BOm?
Regards
07-09-2010 2:42 AM
07-09-2010 4:58 AM