BOM function modules
Hello All,
I need a logic for re-cursive call.I am drilling down the BOM components.Example as below.
If I have A as header with B as component and again B may have C as component again C may have D and E as components in it.
Now if I pass A i should find B,C,D,E,F.
Please suggest somebody some idea how to get this logic?
I am using the function module CS_BOM_EXPL_MAT_V2 to get the components of a BOM.
Regards
Mahesh
When using the function module:
Export:
mehrs = 'X' "Multi Level
This sets the function module so it will return all the levels of the BOM.
Similar Messages
-
BOM function module to find sub components
Hi all ,
I got a requirement . I have to find out the components required for a given product .Like if A is made up of X,Y and Z . If i have A , a final product , then how could i know its sub components X,Y and Z .
Is there any Function module .
Regards ,
RajAparna,
One doubt.Does the function module metioned by you will even explode if a Component under the header material is having a sub-assembly which again is having some components and those componenets also have sub-assembly so on....
I mean in one shot if we give the header material it should explode all the BOMS of the corresponding components.
We have developed a small program kindly have a look at it.Does this whole program can be replaced by that function module alone?
As we need supply area w.r.t a component under header material we are displaying only those fields in the output.
REPORT ZBOMEXPLOSION.
TABLES: MBEW,
MARA, "Material Master
MAKT,
MARC,
MAST, "BOM Header
STKO, "BOM Detail
STPO, "Bom Components
STAS. "BOM Alternative
*Declarations for ALV
type-pools slis.
DATA:itfieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA:itrepid TYPE sy-repid.
itrepid = sy-repid.
DATA:itevent TYPE slis_t_event.
DATA:itlistheader TYPE slis_t_listheader.
DATA:walistheader LIKE LINE OF itlistheader.
DATA:itlayout TYPE slis_layout_alv.
DATA:top TYPE slis_formname.
DATA:itsort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
DATA :itsort1 TYPE slis_sortinfo_alv.
DATA:itprintparams TYPE slis_print_alv.
DATA:itvariant TYPE disvariant.
data : title type lvc_title.
field-symbols <fs> type LVC_TITLE.
concatenate 'BOM Explosion level by level' ' ' into title separated by
space.
assign title to <fs>.
DATA:PARENT-MATNR LIKE MAST-MATNR,
CHILD-MATNR LIKE STPO-IDNRK,
CHILD-WERKS LIKE MAST-WERKS,
CHILD-STLAL LIKE MAST-STLAL,
W_MAKTX LIKE MAKT-MAKTX,
W_LEVEL TYPE I,
W_DOT(1),
W_LVL(12),
W_LVL1(12),
W_LVL2(2),
WCNT TYPE I.
DATA: BEGIN OF ITAB OCCURS 100,
CNT TYPE I,
LEVEL TYPE I,
LVL1 LIKE W_LVL1,
WERKS LIKE MAST-WERKS,
POSNR LIKE STPO-POSNR,
IDNRK LIKE STPO-IDNRK,
PRVBE LIKE STPO-PRVBE,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 100,
WERKS LIKE MAST-WERKS,
IDNRK LIKE STPO-IDNRK,
END OF ITAB1.
DATA: BEGIN OF ITAB2 OCCURS 100,
CNT TYPE I,
SUBCNT TYPE I,
LEVEL TYPE I,
LVL1 LIKE W_LVL1,
WERKS LIKE MAST-WERKS,
POSNR LIKE STPO-POSNR,
IDNRK LIKE STPO-IDNRK,
prvbe like stpo-prvbe,
SBASE TYPE P,
MAKTX LIKE MAKT-MAKTX,
END OF ITAB2.
PARAMETERS: P_WERKS LIKE MAST-WERKS,
P_MATNR LIKE MAST-MATNR,
P_STLNR LIKE MAST-STLNR,
P_STLAN LIKE MAST-STLAN,
P_STLAL LIKE MAST-STLAL.
perform zmm.
perform alv.
*& Form zmmspt
* text
* --> p1 text
* <-- p2 text
form zmm .
SELECT * FROM MAST WHERE WERKS = P_WERKS
AND MATNR = P_MATNR
AND STLNR = P_STLNR
AND STLAN = P_STLAN
AND STLAL = P_STLAL.
SELECT SINGLE * FROM MARA WHERE MATNR = MAST-MATNR.
IF SY-SUBRC NE 0.
CONTINUE.
ENDIF.
IF MARA-LVORM <> 'X'.
PARENT-MATNR = MAST-MATNR.
CHILD-MATNR = MAST-MATNR.
CHILD-WERKS = MAST-WERKS.
CHILD-STLAL = MAST-STLAL.
CLEAR ITAB.
CLEAR ITAB-LEVEL.
MOVE MAST-WERKS TO ITAB-WERKS.
MOVE MAST-MATNR TO ITAB-IDNRK.
WCNT = WCNT + 1.
MOVE WCNT TO ITAB-CNT.
APPEND ITAB.
W_LEVEL = 1.
PERFORM GETCHILD.
ENDIF.
ENDSELECT.
SORT ITAB BY LEVEL DESCENDING.
LOOP AT ITAB.
PERFORM GET_BOM.
MOVE ITAB-WERKS TO ITAB1-WERKS.
MOVE ITAB-IDNRK TO ITAB1-IDNRK.
APPEND ITAB1.
CLEAR ITAB2.
MOVE-CORRESPONDING ITAB TO ITAB2.
APPEND ITAB2.
ENDLOOP.
SORT ITAB2 BY CNT.
LOOP AT ITAB2.
CLEAR: MAKT-MAKTX.
SELECT SINGLE * FROM MAKT WHERE MATNR = ITAB2-IDNRK AND
SPRAS = 'E'.
SELECT SINGLE * FROM MBEW WHERE MATNR = ITAB2-IDNRK AND
BWKEY = ITAB2-WERKS.
ITAB2-MAKTX = MAKT-MAKTX.
MODIFY ITAB2.
ENDLOOP.
endform. " zmm
*& Form GETCHILD
* text
* --> p1 text
* <-- p2 text
form GETCHILD .
SELECT * FROM STPO WHERE STLNR = MAST-STLNR
ORDER BY POSNR.
SELECT SINGLE * FROM STKO WHERE STLNR = STPO-STLNR
AND STLAL = MAST-STLAL.
SELECT SINGLE * FROM STAS WHERE STLNR = STPO-STLNR AND
STLKN = STPO-STLKN AND
STLAL = MAST-STLAL.
IF SY-SUBRC EQ 0.
CLEAR: W_DOT, W_LVL, W_LVL1.
PERFORM MOV_DATA.
CHILD-MATNR = STPO-IDNRK.
W_LEVEL = W_LEVEL + 1.
PERFORM SUBCHILD.
W_LEVEL = W_LEVEL - 1.
ENDIF.
ENDSELECT.
endform. " GETCHILD
*& Form SUBCHILD
* text
* --> p1 text
* <-- p2 text
form SUBCHILD .
SELECT SINGLE * FROM MAST WHERE MATNR = CHILD-MATNR
AND WERKS = CHILD-WERKS.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
SELECT * FROM STPO WHERE STLNR = MAST-STLNR
ORDER BY POSNR.
SELECT SINGLE * FROM STKO WHERE STLNR = STPO-STLNR AND
STLAL = MAST-STLAL.
SELECT SINGLE * FROM STAS WHERE STLNR = STPO-STLNR AND
STLKN = STPO-STLKN AND
STLAL = STKO-STLAL.
IF SY-SUBRC EQ 0.
W_DOT = '.'.
PERFORM MOV_DATA.
CHILD-MATNR = STPO-IDNRK.
W_LEVEL = W_LEVEL + 1.
PERFORM SUBCHILD.
W_LEVEL = W_LEVEL - 1.
SHIFT W_LVL.
ENDIF.
ENDSELECT.
endform. " SUBCHILD
*& Form MOV_DATA
* text
* --> p1 text
* <-- p2 text
form MOV_DATA .
W_LVL2 = W_LEVEL.
CONCATENATE W_DOT W_LVL INTO W_LVL.
CONCATENATE W_LVL W_LVL2 INTO W_LVL1.
MOVE W_LVL1 TO ITAB-LVL1.
MOVE W_LEVEL TO ITAB-LEVEL.
MOVE MAST-WERKS TO ITAB-WERKS.
MOVE STPO-POSNR TO ITAB-POSNR.
MOVE STPO-IDNRK TO ITAB-IDNRK.
MOVE STPO-PRVBE TO ITAB-PRVBE.
WCNT = WCNT + 1.
ITAB-CNT = WCNT.
APPEND ITAB.
endform. " MOV_DATA
*& Form GET_BOM
* text
* --> p1 text
* <-- p2 text
form GET_BOM .
SELECT SINGLE * FROM MAST WHERE MATNR EQ ITAB-IDNRK AND
WERKS = ITAB-WERKS.
IF SY-SUBRC EQ 0.
SELECT * FROM STPO WHERE STLTY = 'M' AND
STLNR = MAST-STLNR AND
DATUV LE SY-DATUM.
SELECT SINGLE * FROM STKO WHERE STLTY = 'M' AND
STLNR = STPO-STLNR AND
STLAL = MAST-STLAL.
SELECT SINGLE * FROM STAS WHERE STLNR = STPO-STLNR AND
STLKN = STPO-STLKN AND
STLAL = STKO-STLAL.
ENDSELECT.
ENDIF.
endform. " GET_BOM
*& Form alv
* text
* --> p1 text
* <-- p2 text
form alv .
IF itab2[] IS INITIAL.
MESSAGE 'No Values exist for the Selection.' TYPE 'S'.
STOP.
ENDIF.
DEFINE m_fieldcat.
itfieldcat-fieldname = &1.
itfieldcat-col_pos = &2.
itfieldcat-seltext_l = &3.
itfieldcat-do_sum = &4.
itfieldcat-outputlen = &5.
append itfieldcat to itfieldcat.
clear itfieldcat.
END-OF-DEFINITION.
m_fieldcat 'LVL1' '' 'Level' '' 04.
m_fieldcat 'POSNR' '' 'Item' '' 06.
m_fieldcat 'IDNRK' '' 'Component' '' 18.
m_fieldcat 'MAKTX' '' 'Description' '' 40.
m_fieldcat 'PRVBE' '' 'Supply Area' '' 12.
itlayout-zebra = 'X'.
itlayout-colwidth_optimize = 'X'.
itlayout-no_subtotals = ' '.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-repid
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_STRUCTURE_NAME =
IS_LAYOUT = itlayout
IT_FIELDCAT = itfieldcat[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
IT_SORT = itsort[]
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab2
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
EXPORT ITAB2 TO MEMORY ID 'KK_ITAB2'.
endform. " alv
K.Kiran. -
Hi,
I have to create/change BOM for multiple plants and i am using below code, but it is not working. I think i am not passing the parameter values properly. Can anyone help me in how to use the below function modules in loop(i mean for multiple plants)?
* CHANGE Bom
CALL FUNCTION 'CS_BC_BOM_CHANGE_BATCH_INPUT'
EXPORTING
* BDC_FLAG = ' '
bom_header = ls_bom_header
close_group = 'X'
commit_work = 'X'
group_data = ls_group
new_group = 'X'
tcode_mode = ld_mode
tcode_update = 'S'
IMPORTING
msgid = ld_msgid
msgno = ld_msgno
msgty = ld_msgty
msgv1 = ld_msgv1
msgv2 = ld_msgv2
msgv3 = ld_msgv3
msgv4 = ld_msgv4
TABLES
bom_item = lt_bom_item
bom_sub_item = lt_sub_item.
* CREATE Bom
CALL FUNCTION 'CS_BI_BOM_CREATE_BATCH_INPUT1'
EXPORTING
* BDC_FLAG = ' '
bom_header = ls_bom_header
close_group = 'X'
commit_work = 'X'
group_data = ls_group
new_group = 'X'
tcode_mode = ld_mode
tcode_update = 'S'
IMPORTING
msgid = ld_msgid
msgno = ld_msgno
msgty = ld_msgty
msgv1 = ld_msgv1
msgv2 = ld_msgv2
msgv3 = ld_msgv3
msgv4 = ld_msgv4
TABLES
bom_item = lt_bom_item
bom_sub_item = lt_sub_item.Hi Kanishak,
Thanks for your reply. I am able to create/change bom using the FMs CS_BC_BOM_CHANGE_BATCH_INPUT & CS_BI_BOM_CREATE_BATCH_INPUT1 when i process the IDoc manually in SAP system.
But in my current situation Idoc will be proceed from third party system automatically. During that time it is not updating and getting the IDoc status as 51. and when i process the same Idoc which is having 51 manually in SAP, it was processed and updated the BOM and the status went to 53.
This is the problem i am facing. Kindly provide me an alternative solution. -
Function module to get the valid Subcontract BOM and components for Pur doc
Hello Gurus,
I need help to create a z report of subcontracting bom and their components exploded in Schedule agreement. Seems like there is no standard report which can give the boms from purcashing doc. Can someone please tell me the name of the function module for it? any help will be highly appreciated.
Regards,
Owaishi
u can use
STPO BOM - item
STAS BOMs - Item Selection
STZU Permanent BOM data
also check stko or mast or stpo
or
Perhaps you can run ST05 while run some transaction for display the
BOM.
Once the transaction for display the BOM gets finished, you need to stop the
trace on ST05 and then display it, you will see tables readden in the
transaction,
not tried plz check*
reward if helpful
regards
kunal
Edited by: kunal ingale on Jul 22, 2008 6:21 AM -
Function Module to Change / Update BOM Line Items
Hi,
I need a Function Module to Change / Update BOM Line Items.
Please help.
Thanks.Try this FM - CSAP_MAT_BOM_MAINTAIN
-
Function module to get BOM which WOULD be created if I open a production
Is there a function module to get the BOM which WOULD be created if I open a production order?
note that I don't have the produciton order created.
I already tried with the FM CS_BOM_EXPL_MAT_V2 and CSAP_MAT_BOM_READ.
I debuged the CO01, but I did not find it.
This BOM should include materials which are under a phantom component.
Edited by: Rodrigo Pelos on Jul 20, 2011 6:55 PMHi Greetson Shunmugasundaram,
thanks for the reply, but for the FMs CO_SD_RESB_FROM_BOM_CREATE and CO_SD_NEW_BOM_ASSIGNEMENT it's necessay to have an production order but I don't have it. And with CS_ALT_SELECT_COUPLED_PRODUCT I could not get a BOM.
Let me explain in more details how I'm going to use this information, I think I was not clear in my post.
I'm creating a report to compare the BOM of a production order with BOM which would be created today if I open a production order.
Then I can check if there was changes in the reservation (RESB) of the production order. If this changes happened, how many pieces. I'll check also if there was differences in consumption, because during the production order confirmation it is possible to make changes.
I would not like to make the BOM explosion "manually" because there are too many variables in the BOM like phantom, alternative, scrap and so on, but I don't know if the function module that I'd like to use exists. -
Bapi or Function module for getting Bom Item Details (Urgent)
Hi All,
I Want to get the Bom Item Details Corresponding to Production Order Number.
So Please Provide me Some Function Module or Bapi So that by giving the
Production Order number I will get all material related to that PO.
Thanks In Advance.Hi,
use the function module.
call function 'CS_BOM_EXPL_MAT_V2'
exporting
capid = 'STD1'
datuv = sy-datum
mktls = 'X'
mehrs = 'X'
mmory = '1'
mtnrv = matnr
werks = werks
tables
stb = it_stb2
matcat = it_matcat
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.
Regards,
Sankar. -
Function Module for Sale order BOM
Hi
What is the function module to retrieve sale order BOM ?
thanks in advance
krishnaHi, Your thread has been moved to SD Forum.
-
Function Module for creating Functional Location BOM and Equipment BOM
Hi All,
Is there any function module for creating and changing Functional Location BOM and Equipment BOM ???Hi,
Tables for Eq., BOM: EQST, STKO, STPO.
Tables fro Fun., Loc., BOM: TPST, STKO, STPO.
You can use FMs: CS_BOM_EXPL_TPL_V1, CS_BOM_EXPL_EQU_V2 & CS_BOM_EXPL_MAT_V2 for extracting the appropriate BOM related data.
And for the Alternatives please check the customizing or check with your respective Module experts for the appropriate configuration.
Hope this helps.
Best Regards, Murugesh AS -
Function Module for BOM for posting BOM component long text
Is there any SAP provided Function Module for posting BOM components long
text if so please let me know as it is very urgent for me.Hello Sridevi,
The following customer exits are available for BOM, please check the excect one.
http://help.sap.com/saphelp_46c/helpdata/en/4a/d286ba5a1111d3b47b006094b9d648/frameset.htm
Hope this helps.
Regards
Arif Mansuri -
Function module for the transcation CS02(i.e) BOM
Hi All,
I want the function module for the transction CS02.
Actually I need the details of BOM for any material.
Please help....Its a urgent requirement.
Thanks in advanceHi,
You can also try with MGW1_CHANGE_BOM and CS_CL_S_BOM_CHANGE
Regards,
Ram
Message was edited by:
Ram Mohan Naidu Thammineni -
Function Module to Explode BOM
Hi,
I need a function module to explode a BOM. The input for the funcion module is the material number and when I Execute, it should explode the BOM.
I found a couple of function modules, but my problem is I dont have a Sales Order Number, which is a Mandatory parameter for all these FMs.
So, could you please give a FM which explodes the BOM by taking the Material Number, Plant etc.
-PriyaPriya,
CS_BOM_EXPLOSION_MAT
CS_BOM_EXPL_MAT_V2
Also you can try searching CS* in transaction SE37.
Regards,
Prasobh -
Function module to get the BOM details for a material-plant combination
hi
Is there any function module to get the BOM details such as
BOM Usage -STLAN
Alternative BOM -STLAL
Items -POSNR
Required Quantity-EMENG
Resulting Quantity-MENGE
Unit of measure -BMEIN
Base unit of measure-MEINS
for a given material-plant combination
if so please suggest me some FMs.................
Awaiting for ur reply..............try the below fm it may be useful for you
DATA : BEGIN OF I_BOM OCCURS 0.
INCLUDE STRUCTURE STPOX.
DATA : END OF I_BOM.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
CAPID = 'PP01'
DATUV = SY-DATUM
MEHRS = 'X'
MTNRV = P_MATNR
WERKS = P_WERKS
TABLES
STB = I_BOM
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.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
just befor use it check your application area.for my case it is PP01. you can find it in CS12 when you are exploding the bom the value you are giving in BOM application that is the value for CAPID.
Just go to se37 and checkout the fm it has lot of options here I am using the minimum things.
regards
shiba dutta -
Function Modules related to BOM
Hi BW Gurus,
I am having a requirement to extract data from the function module for the PP module for the standard BOM.
I found out some function modules for my requirement csap_mat_bom_read and my problem here when i am trying to create a generic data source on using this function module it displays a error msg " The specified table does not exist ".
I am working first on function modules please let me know whether these function modules useful to fetch data in BW or not.
Give me your input of how to proceed further.
Regards,
SyedHi Shahid
You cannot create a generic datasource directly on a SAP standard function module, you should either create a custom FM and use the standard FM to get the data to a internal table and pass the values to a structure of datasource. Or use SAP tables to extract data to ITAB.
Rahul -
Function module to update operation assignment for a BOM Item
Hi Group,
we have a requirement as under:
Goto BOM Change using CS02->select any BOM item and click the Menu path->Extras->Operation Assignment; and check one or more Operations and then save the transaction.
The above functionality has to be achieved through an Upload program(using Excel) with a Function module/BAPI to serve our purpose. we already did the functionality upto creation of BOM but could not proceed further on this current requirement.
Kindly let me know your inputs if you have already worked in such type of requirement.
thanks in advance for your inputs and let me know if any further info is needed.
Regards,
VishnuHi,
Check the Bapis for BOM
BAPI_MATERIAL_BOM_GROUP_CREATE
CSAP_MAT_BOM_MAINTAIN
I hope second BAPI will be more usefull for your requirement.
Regards,
Goutam Kolluru.
Maybe you are looking for
-
IPod Touch wasn't showing up in iTunes (Windows), won't let me restore it.
Ok, so I got a new computer recently, as my old one was decimated by a virus. Yesterday, I tried to connect my ipod touch to the new computer for the first time, but it wasn't showing ip in itunes. I've tried everything in the troubleshooting guide,
-
Hi, I have a requirement where in I have to modify all the articles (MARC-MATNR) which are specified in the selection screen of a report. This report would be running in back ground for every one hour. user would not be entering input in the selec
-
Dear all, i want to have a report on two pricing conditions i.e ZMRP And ZSTK these r pricing conditions for Basic price and stock trans price which is maintained already. based on these condition records i have to prepare a report which shows all th
-
E-63 what type are Alarm Clock Tones for the clock
when try to set the alarm clock tone for the clock if I try to change Tone for alarm I only get optios for Download Default or off. What type of tones do I need to download lor do they have to be in a special folder Thanks Message Edited by douggg
-
No Music in Exporting a self playing slideshow to Quicktime.
I exported a self playing slideshow to QuickTime in order to burn DVD inToast. I selected the Include Audio button but when I played back the file the music did not play. I noticed the export made two files - The video files and a seperate audio file