Bom explosion in MRP

Hi
I have following scenario -
I have Regular Sales order bom For one material X in Plant A and as long as engineering is not completed, this Sales order bom is having status inactive. Once engineering is completed then it will become active.
For Same material X in Plant A material BOM also exist  ( It is used for stock transport order) and I dont want MRP should select material BOM if it doesnot find Active Sales order BOM.
How to achieve this.

Hi
Try these steps
1) Create BOM Selection ID  in SPRO
          Sel ID(say for ex 09)    Sel pr (1)      Usage (5)
2) Assign the ID in OPPQ under BOM/Routing selection Tab
During MRP system will chk for the Usage Priority and if it found any active sales BOM then only it explodes or other wise it don't consider any other BOM
Regards
Brahmaji

Similar Messages

  • BOM Explosion for MRP Area

    Dear Expert,
    I have doubt regarding BOM explosion for MRP Area. This doubt is triggered when performing MD01, as result I do not find the dependent requirement in MD04 for my FG. I have maintained the BOM through CS61 and MRP area for all component, I understand that only component level system is taking into account MRP area (storage location). FYI before maintaining all components to MRP area, the BOM explosion was successful exploded. Your advice is appreciated.
    Best regards,
    Mahnansa

    Dear,
    Please check the Explosion control in Customizing, Transaction OMIW.
    Try to explode the BOM in CS11 , CS12 or CS13 if it is working there in curret date then chack the planning file entry in MD21.
    You need to convert the planning file entery at MRP area in OM0F.
    Also note the dependent requirement is not generated in the corresponding MRP area to which the production storage location in the material master has been not assigned for the data of the MRP area.
    Regards,
    R.Brahmankar

  • BOM explosion while MRP run

    hi all
    I have a FERT for which raw materials are assigned in the BOM. but while running MRP, the BOM is not being exploded and the list doesnt show the raw materials.
    I have checked in the Overall maintenance of the plant parameters in MRP in SPRO and the required paramenters are maintained.The scenario is MTS - strategy 10.but still the BOM is not exploded.
    Could anyone solve my query
    Thank you in advance
    chandra

    Hi Chandra,
    Could you please check if there was an exception message "50 or 52"? If so then it can be beacuse for the BOM explosion date system is not able to get a BOM.
    If there were no exception messages then check in MRP4 view of the FERT material for dependent requirement defination. This should be blank.
    Hope this helps..
    Regards,
    Prasobh
    Reward your points if this was helpful.

  • PP BOM explosion during MRP

    Hello all,
    During MRP, BOMs for dependent assemblies are supposed to be exploded.  I am running MRP in the background.  Until recently, MRP is exploding only the first level BOMs such that subsequent assemblies are not exploded.  Is there a setting I can check to ensure that BOM is doing a multi-level explosion.  MRP set to NETCH.  Thank you for your input.
    Joy T.

    Dear Joy,
    1.check whether the BOM status is 1 for the dependent assemblies in the BOM header.
    2.In case if you have used change numbers with release key for creating the BOM for those dependent assemblies,then check
    in CC02 whether the release key is set.
    3.Ensure that the MRP type is not ND.
    Also check this thread whether this can help you,
    MRP RUN NOT EXPLODING BOM
    Regards
    Mangalraj.S

  • BOM Explosion IN MRP RUN

    When I run MRP BOM Explosion doesnot take place for certain F parts.This is REM scenario.Planning strategy is 40.I have already checked Planning file entries.
    It is OK.Please guide.

    Hi,
    Pl. check in T.code oppq (plant parameters), if you have mentioned the BOM explosion ID. or in T.code oppq (mrp group).
    Also check in the material master, mrp 4 view,
    the bom selection id.
    whether it is based on lot size or based on production version.
    You can cross check using t.code<b> cs11 or cs12</b> (bom explosion).
    Rgds,
    SD

  • Sample steps to setup BOM explosion in MRP

    Hi everyone,
    I am one of those unlucky folks that can't seem to get a simple BOM with FERT to explode HALB component within in MD02. I have spent two days reading every post about this common issue found over the Internet as far as 2007 and also read the SAP note 13023. I tried every suggestion to troubleshoot without success.
    In my environment, I am using a clean IDES with standard SAP configuration, meaning no changes were done on it. As faced by others before, the BOM component just won't explode. I have even blank the days in MRP2 not entirely sure if my way of troubleshooting make sense. For simplicity, I have input a safety stock value to trigger the FERT within MD02.
    Rather than I ask the same question again about where it might have gone wrong, may I know if anyone here can send or point me to a sample few steps guide or screenshots for the FERT and HALB MRP1 - 4 views and the BOM itself (1 material with 1 component)? I can then simulate the results using my IDES and move on from there.
    Asking in this forum is actually my last attempt. My apologies to forum administrator for posting a request instead of something helpful to the community.
    Thanks.
    D.B.

    Hello DB
    The most common cause for a missing BOM explosion is the validity.
    On transaction OPPQ, on tab BOM explosion, you can determine which date will be used for the BOM explosion. You should make sure that your BOM is valid on this date. You can try to create your BOM with a validity in the past, in order to guarantee that it will be exploded.
    Another common reason is the setting selection method on MRP4. If it is set to 3, the BOM will be only exploded if there is a production version.
    BR
    Caetano

  • BOM explosion in MRP for non-stock material

    Dear friends,
    I have a non-stock(bom item category 'N')  service material setup as a component in my production BOM, which during MRP run, should create a Planned order or Purchase requisition for that non-stock component. But, when I run MRP for the top-level material, it doesn't create any requirement for that service material, while all other stock material(Bom item category L), it generated dependant requirements.
    Appreciate your help.
    Thanks
    Suri

    Dear Suri,,
    Please go through this.
    <b><u>Non-Stock Items</u></b>  Use this item category if you want to enter a
    material that is not kept in stock before use, and that is only procured for a
    specific planned order or production order.
    The material is only rarely required for a custom-made product and is used
    directly in the product as a purchased part.
    <u><b>Before you start</b></u>
    You can enter a non-stock item either with or without a material master. If you
    enter a non-stock item without a material master, you must enter a description.
    For non-stock items, you have to maintain purchasing data in the bill of material.
    You enter the following materials as non-stock items because the quantities are
    not updated in the material master record:
    o     Materials with a material type that supports configuration
    o     Pipeline materials, which can be taken from a pipeline at any time
    <u><b>
    Special functions</b></u>
    The following functions are supported for non-stock items
    •     You maintain purchasing data for non-stock items in the bill of material.
    •     In the planning run, the system generates purchase requisitions
    instead of dependent requirements for components that are procured directly.
    When you configure your R/3 System for MRP, you can define whether direct
    procurement is triggered by the planning run or by production order management.
    •     Product costing processes take valuation data from the BOM item.
    The system determines the release strategy on the basis of the price data you
    enter. The material group is required to produce a purchase requisition.
    Regards
    Mangal

  • Bom explosion after MRP (variant configuration)

    Hi Experts,
    I'm facing a problem here, for unknow undentified reason until now, after I run the MD50 with a configuration material, I cannot get a explosion of the itens. This is happening in 4 cases here and I cannot get any good result, I check dependencies rules and everything and no success
    Does anyone know waht can I do?
    regards
    Oliver

    HI,
      If a BOM is not exploded possible reasons could be
    1.  Validity period of BOM
    2.  BOM Status should be active for MRP.
    3.  BOM Components should be relevant to production.
    4.  Check whether you have defined the selection ID for the 
         priority of BOM Usage in SPRO define order of priority of
         BOM Usage.
    Regards,
    nandha

  • BOM Explosion in MRP runs for sub-contracting PO

    Hello Experts,
    We have sub- contracting Purchase order in business scenario.
    Subcontracting PO is required to be considered as demand for MRP. As I have checked PO is showing in MD04, after MRP run using transaction code
    MD02 subcontracting BOM not exploding.
    Sub contacting PO raised on “X” procurement type material, PR is required on BOM item “F” Procurement type 
    Please suggest what all special setting is required as master data & configuration data.
    Thanks in advance!!!

    Hi,
    In the header or parent material (the material that is being produced bu your subcontractor) you have to maintain the following data:
    Procurement type = F
    Special Proc Type = 30
    MRP Type = PD
    Lot Size, Minimum Lot Size, Rounding Value: Enter what is convinient for your business.
    Be sure you have a BOM (CS01)
    Create a Production version indicating the BOM (C223)
    Enter Selection Method 3 in the MRP4 view of the material master
    Create an Info Record (type Subcontracting).. (ME11)
    Create a Source List (ME01)
    Run the MRP and check MD04
    Kind Regards,
    Mariano

  • MRP RUN- KIT BOM explosion not working

    We setup one layer BOM’s for our maintenance KITs as parent material and components as child material.  For  example KIT is TS10000-K1 and components are TS10001, TS10002 etc setup as next layer with in the BOM. Both KITS and components are defined as material types ERSA (Spare parts). These one layers BOMs are setup as production BOMs and expected to create purchase requisitions for KITS and components by exploding BOMs during MRP runs. We use purchase requisitions and convert them into POs to procure both KITS and components. We DO NOT USE Panned orders and Production orders. 
    The safety stocks / reorder point are considered as demand for KITS and components as we do not have any external demand for KITS and components.  
    MRP run is creating purchase requisitions automatically for both KITS and components as per safety stocks and reorder point defined in MRP Views of Material Master. This is working as expected.  
    The issue is: KIT BOM’s are not exploding to generate purchase requisitions for the dependent components of KIT BOM. Please suggest the way to resolve this issue. 
    Split valuation: Also we plan to use split valued KITS with both new and refurbished. So we need BOM explosion for split valued KITS
    also (after the 1st issue is resolved).   
    I verified the following items to make sure the required configuration and data setup is defined correctly.
    1) Planning file activated Plant - OMDU 
    2) Executed MRP run with Total Planning - MDBT and MD02 (single item, multiple levels)
    3) BOM explosion for MRP activated- OS23 
    4) MRP type in MRP1 view- PD and VB (I tried both separately but BOM is not exploding).
    5) Procurement type “F” (MRP 2 view) and lot size “EX”  
    6) Planning strategy in MRP 3 view (tested w/o planning strategy and with strategies 10 and 40. But BOM is not exploded)
    7) BOM status and usage (status is active and usage is for production-CS02 and OS20)  
    8) BOM Validity date (Valid) 
    9) BOM structure in CS12 (BOM is exploding in CS11) 
    10) Availability check  
    11) Selection of BON ID to have BOM usage indicator assign (OS31).
    12) No alternate BOMs or production versions or work scheduling view are used.
    Please review the above 2 issues and suggest any workable solution. Thanks in advance!
    NOTE: I extensively used MRP with multi-level BOM explosion in my earlier projects without any issue. However the above issue is a  bit strange  why one layer BOM is not exploded in this case. 
    Regards
    Srini  

    Hi
    Thanks for your response. I reviewed all SAP notes and none of them are applicable to my scenario.
    1808396 - BOM changes not considered by MRP: I have not changed BOMs.
    1781324 - MD11: Valid BOM alternative is not found. We do not have alternative BOMs.
    1791009 - No BOM explosion after changing production version: We am not using production versions.
    Our Material KITS are PM spare assemblies set up as BOMs and consists of individual spare parts as components. We are creating purchase requisitions and not planned orders. We are not using PP functionality/Production orders.
    MRP is generating purchase requisitions for KITS and components as per ROP and safety stocks. In other words it is working as expected.  The issue is BOMs which are parent assemblies are not exploding to the next lower level components.
    Please note that I am not getting any error messages when MRP is executed.
    Regards
    Srini.

  • Bom explosion in sales order mrp(MD50)

    Hi Experts,
    In sales order MRP i.e. MD50 Getting the planned orders for header material(Finished goods) generated but for raw materials (BOM items) Purchase requisitions are not getting generated.
    Details:
    Header material A and raw materials B and C.
    In material B in MRP 4 coll/ind indicator is 2 And same indicator for C is blank.
    Now when we are running the MRP sales order based it will generate the purchase requisition for C only but not for B.
    In OPPQ we have done the setting for sales order BOM explosion.
    Can anyone please throw some light what is the setting missing in customization or in front end?
    Thanks in advance.
    Regards
    Vilas

    Dear,
    If you select individual requirement then system will not consider available stock and generate Proposals for every single requirments. Check in MRP4 view Individual / Collective .
    Also you will find PR and Plan order with account assignment of Sales order (in case of MD50).
    - If you select collective requirement then system will not generate planing proposals through MD50.In that case you have to go for individual MRP (MD02 / MD03)
    Please try and come back.
    Regards,
    R.Brahmankar

  • Without MRP, with BOM explosion

    Hi,
    I'm new to SAP and learning SAP SCM. I would like someone to brief me on what the following lines imply, especially 'without MRP, with BOM explosion'.
    "dependent requirements must be determined for materials that are planned in SAP ECC. So, you assign the MRP type “X0” with MRP procedure “X” (“without MRP, with BOM explosion”) to the materials planned in SAP SCM."
    Thanks,
    Krish

    Hi,
    Without MRP , with BOM explosion - means the dependent requiremens are created for this materials from APO.
    The MRP will not run in APO. Only the dependent requirements will be created from APO. The MRP for this materials will be executed the ECC or R/3 system to create planned order anb purchase requisitions.
    Thanks and regards
    Murugesan

  • What is the functionality of Bom explosion individual/collective  in MRP 4 View

    Hi Experts.Please give idea about what is the use of functionality of BOM explosion Individual/collective in MRP view 4.How this function will work in strategy 10 and 20.
    thanks in advance.

    Hi,
    This is a very generic question...If you explore in forum or net you will get lot of information...
    This is normally used in make to order strategies like 20, 50 etc...
    The individual/collective indicator in the material master record determines
    whether a component is procured for a special customer requirement in the
    individual segment.
    The indicator "1" for individual requirements means that the material is being
    specially manufactured or procured for a sales order. A special individual segment
    is created for each requirement. An individual requirement is only created if the
    higher-level material does not create a collective requirement.
    The indicator "2" for collective requirements means that the material is produced
    or procured for various requirements. You can find these requirements in the net
    requirements segment.
    The indicator "blank" means that the component is to be planned in the same way
    as the higher-level assembly.
    In the above example, two individual segments are created for the shaft for sales
    orders A and B.
    Thanks
    Kumar

  • MRP run without bom explosion

    Dear All,
    Can it possible to run mrp without bom explosion against demand management & demand program for 78 weeks its mid-long term?
    BOM is not considered by client,so it possible to run mrp without bom?
    Regards
    Gajjen

    Hi,
    You Can run MRP with out BOM explosion
    Option 1: In MRP 4- Set  MRP dependent requirement - 1
    or
    Option 2: Make the BOM status to 2 In active.
    or
    Option 3:
    IF you want BOM for Other purpose such as costing, Then
    Create a New BOM status as per your requirement in OS23,  Remove the  check mark of MRP  Explosion .and assign to the BOM status to respective bom
    Regards,
    Sundaresan
    Edited by: Sundaresan . E. V on Aug 26, 2010 5:03 PM

  • How about this implementation of BOM Explosion(simulate stack)

    REPORT  YZWX00301_06 LINE-SIZE  142
                         LINE-COUNT 65
                         MESSAGE-ID YM1
                         NO STANDARD PAGE HEADING .
    INCLUDE
    INCLUDE: YXXI00050.
    *TABLES use table define
    TABLES: MARA,        " Material General Table
            MARC,        " Plant Data for Material
            MDMA,        " MRP Area table
            EORD,        " Vendor table
            A018,        " Vendor material mapping table
            KONP,        " Vendor condition table
            MAST,        " Material BOM table
            STPO,        " Material BOM Component table
            STAS.        " Material BOM Component table detail
    *CONSTANTS define
    CONSTANTS:
      C_DAT_X        TYPE C VALUE 'X',
      C_MODE         LIKE dxfields-fileoper VALUE 'R',
      C_MASK         LIKE dxfields-filemask VALUE '.',
      C_FLG_LOCATION TYPE C VALUE 'A',
      C_DFPATH(15)   TYPE C VALUE '\bmwx\'.
    Work Area Define
    ---- build stack structure -
    DATA: BEGIN OF WK_STACK,
            LEVEL(1)      TYPE C,            "Save Level
            QUANT         TYPE I,            "Save Quantity
          END OF WK_STACK.
    ---- BOM work area -
    DATA: BEGIN OF WK_BOM,
             LEVEL(1)     TYPE C,            "BOM LEVEL
             MATNR        LIKE MARC-MATNR,   "MATERIAL      18
             POSTP        LIKE STPO-POSTP,   "ITEM CATEGORY  1
             MENGE        LIKE STPO-MENGE,   "BOM COMPONENT 13
             DATUV        LIKE STPO-DATUV,   "VALID FROM    10
             DATUB        LIKE STPO-DATUV,   "VALID TO      10
    END OF WK_BOM.
    ---- DATA work area -
    DATA: BEGIN OF DATAITEM,
             LEVEL(1)     TYPE C,            "BOM LEVEL
             MATNR        LIKE MARC-MATNR,   "MATERIAL
             POSTP        LIKE STPO-POSTP,   "ITEM CATEGORY
             MENGE        LIKE STPO-MENGE,   "BOM COMPONENT
             DATUV        LIKE STPO-DATUV,   "VALID FROM!!!
             DATUB        LIKE STPO-DATUV,   "VALID TO
             EKGRP        LIKE MARC-EKGRP,   "PURCHASE ORG
             LIFNR        LIKE EORD-LIFNR,    "Vendor code     10
             MARK(1)      TYPE C,             "Mark
             KBETR        LIKE KONP-KBETR,    "Rate price      11
             KONWA        LIKE KONP-KONWA,    "Currency        5
             KPEIN        LIKE KONP-KPEIN,    "Unit Qty        5
             KMEIN        LIKE KONP-KMEIN,    "Condition Unit  3
             DATAB        LIKE A018-DATAB,    "Condition from  10
             DATBI        LIKE A018-DATBI,    "Condition to    10
           END OF DATAITEM.
    ---- File Line work area -
    DATA: BEGIN OF LINE,
             WERKS(4)     TYPE C,                               "Plaint   4
             MATNR(18)    TYPE C,             "Material Number 18
             EKGRP(3)     TYPE C,             "Purchase Group  3
             LIFNR(10)    TYPE C,             "Vendor code     10
             VDATU        LIKE EORD-VDATU,    "Vendor valid from 10
             BDATU        LIKE EORD-BDATU,    "Vendor valid to   10
             MARK(1)      TYPE C,             "Mark
             KSCHL(4)     TYPE C,             "Condition type  4
             KBETR(18)    TYPE C,             "Rate price      11
             KPEIN(5)     TYPE C,             "Rate unit       5
             KONWA(5)     TYPE C,             "Currency        5
             KMEIN(3)     TYPE C,             "Condition Unit  3
             DATAB        LIKE A018-DATAB,    "Condition from  10
             DATBI        LIKE A018-DATBI,    "Condition to    10
           END OF LINE.
    *Local Data Object Define
    DATA:  WK_CNT TYPE I,                   "Count variable
           WK_LVL TYPE I,                   "BOM level
           WK_QTY TYPE I.                   "BOM component qty
    DATA: WK_LIFNR LIKE EORD-LIFNR,
          WK_MATNR LIKE MARC-MATNR.
    *Internal Table define
    DATA TAB_STACK LIKE STANDARD TABLE OF WK_STACK.   "STACK TABLE
    DATA TAB_BOM   LIKE STANDARD TABLE OF WK_BOM.     "FOR BOM
    DATA TAB_DATA  LIKE STANDARD TABLE OF DATAITEM.   "FOR ALL
    Parameter in Block1
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.         "TITLE TEXT-001.
    PARAMETERS:
      P_WERKS LIKE MARC-WERKS DEFAULT 'WX01',              "Plant
      P_STLTY LIKE STPO-STLTY DEFAULT 'M',                 "BOM Category
      P_MATNR LIKE MARC-MATNR OBLIGATORY,                  "Material
      P_STDAT LIKE EORD-VDATU OBLIGATORY DEFAULT SY-DATUM. "Standard Date
    SELECTION-SCREEN END OF BLOCK B1.
    Parameter in Block2
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: P_SCREEN RADIOBUTTON GROUP R1.     "Screen output
    SELECTION-SCREEN COMMENT 03(21) TEXT-001.
    SELECTION-SCREEN POSITION 32.
    PARAMETERS: P_FILE RADIOBUTTON GROUP R1.       "NTFILE output
    SELECTION-SCREEN COMMENT 34(17) TEXT-002.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK B2.
    Parameter in Block3
    SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME.
    PARAMETERS:
    P_NTFILE(45)  TYPE C    LOWER CASE OBLIGATORY.
      P_PCFILE      LIKE RLGRAP-FILENAME.
    SELECTION-SCREEN END   OF BLOCK B3.
    INITIALIZATION
    INITIALIZATION .
      CLEAR :  WK_CNT,
               WK_LVL,
               WK_QTY,
               WK_MATNR,
               WK_STACK,
               WK_BOM,
               DATAITEM.
      WK_LVL = 0.
      WK_QTY = 1.
      REFRESH: TAB_STACK,
               TAB_DATA,
               TAB_BOM.
    *&      AT SELECTION-SCREE ON VALUE-REQUEST
    *AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_NTFILE.
    PERFORM F_SHOW_FILE_POPUP CHANGING P_NTFILE.       "Popup display
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PCFILE.
      PERFORM F_FILENAME_GET USING P_PCFILE
                          CHANGING P_PCFILE.
    *&      Form  F_FILENAME_GET
      --> ST_DAT_PATH     : Preset path
      <-- ST_DAT_FILENAME : Selected file name
    FORM F_FILENAME_GET USING st_dat_path
                     CHANGING st_dat_filename.
      CALL FUNCTION 'WS_FILENAME_GET'
        EXPORTING
          def_filename     = SPACE
          def_path         = st_dat_path
          mask             = ',.,.,'
          mode             = '0'
          title            = 'TXT-file select'
        IMPORTING
          filename         = st_dat_filename
        EXCEPTIONS
          inv_winsys       = 1
          no_batch         = 2
          selection_cancel = 3
          selection_error  = 4
          OTHERS           = 5.
      IF sy-subrc <> 0.
        MESSAGE s002(yf1) WITH 'F_FILENAME_GET' sy-subrc.
      ENDIF.
    ENDFORM.                    "F_FILENAME_GET
    MAIN PROCESS
    START-OF-SELECTION.
    ---- Check material -
      PERFORM CHECK_PROD.
    ---- get vendor data -
      PERFORM GET_VENDOR_DATA.
    ---- output screen/file -
      IF P_SCREEN = 'X'.
        PERFORM SET_OUTPUT.            "Output to screen directly
      ELSEIF P_FILE = 'X'.
        IF P_PCFILE <> ''.
          PERFORM DOWNLOAD_DATA.       "Write data into ntfile
        ELSE.
          MESSAGE E007(00) WITH 'P_PCFILE'.
        ENDIF.
      ENDIF.
    END-OF-SELECTION.
      ULINE (142).
      WRITE: /002 'Component Material Count:', WK_CNT.
    TOP-OF-PAGE
    TOP-OF-PAGE.
      WRITE: /002 'Product:', 013 P_MATNR,
              030 '****** BOM Price List ******',
              070 SY-DATUM,
              095 'PAGE:',
              100 SY-PAGNO.
      ULINE (142).
      WRITE: /001   '|Level',
              007   '|Material',
              026   '|Cat',
              030   '|Quantity',
              044   '|From',
              055   '|To',
              066   '|PurG',
              071   '|Vendor',
              082   '|MK',
              085   '|Price',
              101   '|Crncy',
              107   '|UnitQty',
              115   '|Unit',
              120   '|From',
              131   '|To',
              142   '|'.
      ULINE (142).
    *&FORM CHECK_PROD
    text
    -->p1      text
    <--p2      text
    FORM CHECK_PROD.
      SELECT SINGLE * FROM MARC
                     WHERE WERKS = P_WERKS           " Plant
                     AND   MATNR = P_MATNR           " Material
                     AND   DISPR IN ('F100','F200'). " Product
      IF SY-SUBRC = 0.
        PERFORM CHECK_BOM1 USING MARC-MATNR MARC-WERKS. " CHECK_BOM1
      ELSE.
        MESSAGE E022.
      ENDIF.
    ENDFORM.                                         " CHECK_PROD
    *&FORM CHECK_BOM1
    text
    -->p1      text
    <--p2      text
    FORM CHECK_BOM1 USING VALUE(FP_MATNR) VALUE(FP_WERKS).
      SELECT SINGLE * FROM  MAST
                      WHERE MATNR = FP_MATNR     AND      "Material
                            WERKS = FP_WERKS.             "Plant
      IF SY-SUBRC = 0.
        PERFORM PUSH_STACK USING WK_LVL WK_QTY.   "Save parent attribute
        PERFORM CHECK_BOM2 USING MAST-STLNR.                    "Check BOM2
      ENDIF.
    ENDFORM.                                                    "CHECK_BOM1
    *&FORM CHECK_BOM2
    text
    -->p1      text
    <--p2      text
    FORM CHECK_BOM2 USING VALUE(FP_STLNR).
      SELECT * FROM  STPO
               WHERE STLTY = P_STLTY        AND        "BOM category
                     STLNR = FP_STLNR.                 "BOM number
        PERFORM POPOUT_WK.                  "Pop out to work area
        WK_BOM-LEVEL = WK_LVL.              "Current BOM level
        WK_BOM-MATNR = STPO-IDNRK.          "Material number
        WK_BOM-POSTP = STPO-POSTP.          "ITEM Category
        WK_QTY       = STPO-MENGE * WK_QTY. "For Stack
        WK_BOM-MENGE = WK_QTY.              "BOM Component qty
        PERFORM CHECK_BOM3 USING STPO-STLTY STPO-STLNR STPO-STLKN.
        PERFORM CHECK_BOM1 USING STPO-IDNRK P_WERKS.
      ENDSELECT.
      PERFORM POPOUT_STACK.
    ENDFORM.                                                    "CHECK_BOM2
    *&FORM CHECK_BOM3
    text
    -->p1      text
    <--p2      text
    FORM CHECK_BOM3 USING VALUE(FP_STLTY) VALUE(FP_STLNR) VALUE(FP_STLKN).
      SELECT SINGLE * FROM  STAS
                      WHERE STLTY = FP_STLTY        "BOM category
                      AND   STLNR = FP_STLNR        "BOM number
                      AND   STLKN = FP_STLKN        "BOM item
                      AND   DATUV <= P_STDAT        "Valid from
                      AND   LKENZ = ' ' .           "Valid
      IF SY-SUBRC = 0.
        WK_BOM-DATUV = STAS-DATUV.                  "Valid from
      ENDIF.
      SELECT SINGLE * FROM  STAS
                      WHERE STLTY = FP_STLTY        "BOM category
                      AND   STLNR = FP_STLNR        "BOM number
                      AND   STLKN = FP_STLKN        "BOM item
                    AND   DATUV > P_STDAT         "Valid from
                      AND   LKENZ = 'X' .           "Invalid
      IF SY-SUBRC = 0.
        SELECT SINGLE * FROM  STAS
                       WHERE STLTY = FP_STLTY        "BOM category
                       AND   STLNR = FP_STLNR        "BOM number
                       AND   STLKN = FP_STLKN        "BOM item
                       AND   DATUV > P_STDAT         "Valid from
                       AND   LKENZ = 'X' .           "Invalid
        IF SY-SUBRC = 0.
          WK_BOM-DATUB = STAS-DATUV.          "Valid to
          APPEND WK_BOM TO TAB_BOM.
        ENDIF.
      ELSE.
        WK_BOM-DATUB = '99991231'.          "Manul input
        APPEND WK_BOM TO TAB_BOM.
      ENDIF.
    ENDFORM.                                                    "CHECK_BOM3
    *&FORM PUSH_STACK
    text
    -->p1      text
    <--p2      text
    FORM PUSH_STACK USING VALUE(FP_LVL) VALUE(FP_QTY).
      WK_STACK-LEVEL = FP_LVL + 1.
      WK_STACK-QUANT = FP_QTY.
      APPEND WK_STACK TO TAB_STACK.    "Push stack
      SORT TAB_STACK BY LEVEL.         "Sort table by level
    ENDFORM.                           "PUSH_STACK
    *&FORM PUSH_STACK
    text
    -->p1      text
    <--p2      text
    FORM POPOUT_STACK.
      DESCRIBE TABLE TAB_STACK LINES WK_CNT.
      IF WK_CNT > 0.
        DELETE TAB_STACK INDEX WK_CNT.     "Popout stack
        SORT TAB_STACK BY LEVEL.           "Sort table by level
      ENDIF.
    ENDFORM.                               "POPOUT_STACK
    *&FORM POPOUT_WK
    text
    -->p1      text
    <--p2      text
    FORM POPOUT_WK.
      DESCRIBE TABLE TAB_STACK LINES WK_CNT.
      IF WK_CNT > 0.
        READ TABLE TAB_STACK INTO WK_STACK INDEX WK_CNT.   "Popout stack
        IF SY-SUBRC = 0.
          WK_LVL = WK_STACK-LEVEL.                         "Current Level
          WK_QTY = WK_STACK-QUANT.                         "Parent Qty
        ENDIF.
      ENDIF.
    ENDFORM.                    "POPOUT_WK
    *&FORM DOWNLOAD_DATA
    text
    -->p1      text
    <--p2      text
    FORM DOWNLOAD_DATA.
      DATA: L_RETURN     TYPE   SY-SUBRC.
      PERFORM GUI_DOWNLOAD
                  TABLES
                     TAB_DATA
                  USING
                     P_PCFILE
                     'X'
                  CHANGING
                     L_RETURN.
      IF L_RETURN <> 0.
        MESSAGE S020.
      ELSE.
        MESSAGE S021.
      ENDIF.
    ENDFORM.                    " DOWNLOAD_DATA
    *&FORM GET_VENDOR_DATA
    text
    -->p1      text
    <--p2      text
    FORM GET_VENDOR_DATA.
      LOOP AT TAB_BOM  INTO WK_BOM.
        CLEAR DATAITEM.
        SELECT * FROM MARC
                WHERE WERKS = P_WERKS             "Plant
                  AND MATNR = WK_BOM-MATNR.       "Material
          DATAITEM-EKGRP = MARC-EKGRP.
          SELECT SINGLE * FROM  MARA
                          WHERE MATNR = MARC-MATNR    AND   "Material number
                                MTART IN ('1211','1221').
          IF SY-SUBRC = 0.
            SELECT COUNT(*) FROM  EORD
                           INTO  (WK_CNT)
                     WHERE WERKS  = P_WERKS        AND  "Plaint
                           MATNR  = WK_BOM-MATNR   AND  "Material
                           VDATU <= P_STDAT        AND  "Valid-From
                           BDATU >  P_STDAT.            "Valid-To
            IF WK_CNT > 1.
              DATAITEM-MARK = '*'.
            ELSEIF WK_CNT = 0.
              MOVE-CORRESPONDING WK_BOM TO DATAITEM.
              APPEND DATAITEM TO TAB_DATA.
            ENDIF.
            SELECT * FROM  EORD
                     WHERE WERKS  = P_WERKS        AND  "Plaint
                           MATNR  = WK_BOM-MATNR   AND  "Material
                           VDATU <= P_STDAT        AND  "Valid-From
                           BDATU >  P_STDAT.            "Valid-To
              MOVE-CORRESPONDING WK_BOM TO DATAITEM.
              DATAITEM-LIFNR  = EORD-LIFNR.             "Vendor code
              SELECT  * FROM  A018
                        WHERE LIFNR  =  EORD-LIFNR  AND  "Vendor code
                              MATNR  =  EORD-MATNR  AND  "Material
                              EKORG  =  EORD-EKORG  AND  "Purchase org
                              DATAB <=  P_STDAT     AND  "Valid-from
                              DATBI >   P_STDAT.         "Valid-to
                DATAITEM-DATAB = A018-DATAB.    "Condition From
                DATAITEM-DATBI = A018-DATBI.    "Condition To
                IF SY-SUBRC = 0.
                  SELECT * FROM  KONP
                           WHERE KNUMH = A018-KNUMH   AND   "Cnd Number
                                 KSCHL = A018-KSCHL   AND   "Cnd Type
                                 KAPPL = A018-KAPPL.        "Cnd Cat
                    DATAITEM-KBETR = KONP-KBETR.            "Price
                    DATAITEM-KONWA = KONP-KONWA.            "Currency
                    DATAITEM-KPEIN = KONP-KPEIN.            "Price Unit
                   DATAITEM-KMEIN = KONP-KMEIN.            "Unit of Material
                    APPEND DATAITEM TO TAB_DATA.            "Append TAB_DATA
                  ENDSELECT.
                ENDIF.
              ENDSELECT.
            ENDSELECT.
          ELSE.
            MOVE-CORRESPONDING WK_BOM TO DATAITEM.
            APPEND DATAITEM TO TAB_DATA.
          ENDIF.
        ENDSELECT.
        IF SY-SUBRC <> 0.
          MOVE-CORRESPONDING WK_BOM TO DATAITEM.
          APPEND DATAITEM TO TAB_DATA.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "GET_DATA
    *&      Form  SET_OUTPUT
          text
    -->  p1        text
    <--  p2        text
    FORM SET_OUTPUT .
      CLEAR WK_CNT.
      LOOP AT TAB_DATA INTO DATAITEM.
        WRITE: /001   '|', 002 DATAITEM-LEVEL,   "Material Number
                007   '|', 008 DATAITEM-MATNR,   "Purchase Grp
                026   '|', 027 DATAITEM-POSTP,   "Item category
                030   '|', 031 DATAITEM-MENGE,   "BOM Component qty
                044   '|', 045 DATAITEM-DATUV,   "BOM valid from
                055   '|', 056 DATAITEM-DATUB,   "BOM valid to
                066   '|', 067 DATAITEM-EKGRP,   "Purchase Org
                071   '|', 072 DATAITEM-LIFNR,   "Vendor
                082   '|', 083 DATAITEM-MARK,    "Mark flag
                085   '|', 086 DATAITEM-KBETR,   "Price
                101   '|', 102 DATAITEM-KONWA,   "Currency
                107   '|', 108 DATAITEM-KPEIN,   "Unit Qty
                115   '|', 116 DATAITEM-KMEIN,   "Unit OM
                120   '|', 121 DATAITEM-DATAB,   "Cnd From
                131   '|', 132 DATAITEM-DATBI,   "Cnd To
                142   '|'.
        WK_CNT = WK_CNT + 1.
      ENDLOOP.
    ENDFORM.                    " SET_OUTPUT

    Prabhu Peram,
    Thanks very much.
    I want to show an idea of BOM explosion by constructing a stack.
    BOM explosion uses first-root-searching and pushes the "root" material into stack.If the "root" has no left-child,pops out the "root" material and searchs the right-child....and completes the entire BOM explosion.
    Message was edited by:
            Mic chen
    Message was edited by:
            Mic chen

Maybe you are looking for

  • Dropping a Table Using PL/SQL

    I've read that PL/SQL doesn't support DDL, which seems to mean that I cannot use PL/SQL to create, alter, or drop a table. Is this true? I've written (but not tested) some PL/SQL code that needs to drop a table and rename another table under certain

  • How to make fields grow dynamically within the same page and in column wise

    Hi, Like the newspaper format: Where contents of news are shown columns wise. We need to make the fields in a page grow column wise within that same page. For example, in a page: Column 1 Column 2 ASDASDASDGKASHDGKAA | ASDFASGFHSJFAJKSD ASDFASDFASDJF

  • Why do some YouTube videos no longer play in stereo?

    I have uploaded over 200 music videos on YouTube (user name "texpaco"), all in HD format. Until recently ALL played in stereo. However, YouTube recently made changes that affect over half of them. They now load with a defaulted 240p playback option w

  • "Some files that need to be updadted are currently in use."

    I have Windows Vista, and iTunes has not been working on my computer for a few months now. I was hoping this new version (7.4 the latest one) would finally be able to run. Unfortunately, when I run the installer, I get a window that says this: "Some

  • Best way to determine if document is truly unsaved

    Is there a preferred method for determining whether a file is truly unsaved? I'm distinguishing between files that have have been saved and then had some changes made to them (but have a valid name and filePath) and files that have just been created