BOM - Report (Urgent)

Hi All,
I would like to know is there a transaction, where i can enter a material & find out how much quantity of it is used in the main assembly?
Eg: I should be able to enter
Material = Bearing-A 
Main assembly = Car
& the output should show me 50
If no standard transaction or report exists, can i know which tables i need to join to extract this information?
Hope my problem is clear, await inputs.
Vivek

Mr. Mangal,
My requirement was this-
I have a material - Bearing-A. This material is used in several different sub-assemblies. These sub-assemblies are assembled together to build a car. So i wanted to know how many Bearing-A is being consumed by this car. So i wanted to enter my main assembly, i.e. Car & then enter this material which is Bearing-A & the output should show me the qty consumed, say 50 nos.
I hope it is clear now. MCRE report gives me that. If there is any other report which does the same, kindly do let me know.
Regards,
Vivek

Similar Messages

  • Any BOM  Report (urgent)

    Is there any standard BOM Explosion report to show of cost level by level
    pls let me know

    Hi,
    Try this Report.   RCS12001 
    Trasaction Code : CS12.
    Thanks,
    Anitha

  • BOM Report without drill down

    Hello,
    I am trying to create a BOM report where the user inputs the father item and all the other child items are displayed below it, Including the childs of other father items inside the BOM.
    Has anyone done this before ?
    Some BOMs items are made of other BOMs.
    Kind Regards,

    Hi,
    Let's think together,
    1. We have the list of the WH journal in the OINM table, and we can filter it as production transactions....
    2. We have the bacth transaction details in IBT1 table, and we can link this table to the OINM....
    select T0.ItemCode, T0.InQty, T0.OutQty , T1.BatchNum
    from oinm T0 inner join ibt1 T1 on T0.ItemCode =  T1.ItemCode and T0.Warehouse = T1.WhsCode and T0.TransType = T1.BaseType and T0.CreatedBy = T1.BaseEntry and T0.DocLineNum = T1.BaseLinNum
    where T0.applobj = '202'
    3. We have a reqursive query which gives as the list of the subcomponents...
    So combine them
    Let's modify the prevoius stored procedure.....
    Alter Procedure BoomTree(@itemcode nvarchar(20))
    AS
    BEGIN
    WITH BOM (Code) AS
    SELECT     ROOT.Code as Code
    FROM         dbo.OITT AS ROOT
    WHERE     ROOT.Code =  @itemcode
    UNION ALL
    SELECT     CHILD.Code
    FROM         dbo.ITT1 AS CHILD
    JOIN BOM ON CHILD.Father = BOM.Code
    select T0.ItemCode, T0.InQty, T0.OutQty
    , T1.BatchNum
    from oinm T0
    inner join ibt1 T1 on T0.ItemCode =  T1.ItemCode and T0.Warehouse = T1.WhsCode and T0.TransType = T1.BaseType and T0.CreatedBy = T1.BaseEntry and T0.DocLineNum = T1.BaseLinNum
    where T0.applobj = '202'
    and T0.ItemCode in (select code from BOM)
    OPTION (MAXRECURSION 10); -- Handles 10 levels dept of BOM
    RETURN
    END
    GO
    exec boomtree 'P0001'
    So it was easy.....
    Regards,
    J.

  • Color to header materail field in BOM report

    hi experts,
    I am doing BOM report in that header material of BOM and their component i moved in same field but
    i cant identity which one is a header material (MAST-MATNR)  and which one is a componental (STPO-IDNRK)  so, I want to color for header material.
    Plz send me reply earliest.
    Thanks,
    Jyotsna

    Hi,
    As you can make out the header material for BOM, so for a header material you will be having number of component materials.
    Then can check whenever a header material is encountered and can use colors in classical reports.
    Hope this helps you.
    Regards,
    Tarun

  • BOM report on Production order

    Dear All,
    I need to make BOM report as per production order.
    Very helpfull for me if any FM for that?
    I need also the table where I can get the relation of that.
    Can anybody help me?
    Thanks in advance.

    hi
    hope it will help you.
    Pls reward if help.
    REPORT ZMULTIBOM NO STANDARD PAGE HEADING LINE-SIZE 195
                    LINE-COUNT 60(2) MESSAGE-ID Z1.
    TABLES: MBEW,           "Material Valuation
            MSLB,           "Special stocks with vendor
            MARA,           "Material Master
            MAKT,           "Material Descriptions
            MARD,           "Material Master: Storage Location/Batch Segment
            MAST,           "BOM Header
            STKO,           "BOM Detail
            STPO,           "Bom Components
            STAS.           "BOM Alternative
    Text Elements
    Plant
    SELECT-OPTIONS: S_WERKS FOR MAST-WERKS DEFAULT 'CA',
    Material
                    S_MATNR FOR MAST-MATNR,
    Material Type
                    S_MTART FOR MARA-MTART.
    Base Quantity
    PARAMETERS: S_BASE TYPE I DEFAULT '1'.
    Display up to Level
    PARAMETERS: S_LVL  TYPE I DEFAULT '99'.
    SELECTION-SCREEN SKIP.
    Include Vendor Stock
    PARAMETERS: X_MSLB  AS CHECKBOX.
    DATA: W_MATNR LIKE MAPL-MATNR.
    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_STD TYPE P DECIMALS 5,
          W_MAV TYPE P DECIMALS 5,
          W_MENGE TYPE P DECIMALS 3,
          W_LEVEL TYPE I,
          W_DOT(1),
          W_LVL(12),
          W_LVL1(12),
          W_LVL2(2),
          W_COL TYPE I,
          W_LFLAG,
          W_TTL LIKE MARD-LABST.
    DATA: BEGIN OF INT1 OCCURS 50,
            LGORT(6),
            LABST LIKE MARD-LABST,
          END OF INT1.
    IF S_BASE EQ 0.
      S_BASE = 1.
    ENDIF.
    append multi level routing
    SELECT * FROM MAST WHERE WERKS IN S_WERKS AND
         MATNR IN S_MATNR.
      SELECT SINGLE * FROM MARA WHERE MATNR = MAST-MATNR AND
           MTART IN S_MTART.
      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.
        SELECT SINGLE * FROM MAKT WHERE MATNR = MAST-MATNR AND
             SPRAS = 'E'.
        W_MAKTX = MAKT-MAKTX.
        REFRESH INT1.
        SELECT * FROM MARD WHERE MATNR = MAST-MATNR AND
             WERKS = MAST-WERKS AND
             LABST NE 0.
          MOVE MARD-LGORT TO INT1-LGORT.
          MOVE MARD-LABST TO INT1-LABST.
          APPEND INT1.
        ENDSELECT.
        IF X_MSLB EQ 'X'.
          SELECT * FROM MSLB WHERE MATNR EQ MAST-MATNR AND
               WERKS EQ MAST-WERKS AND
               LBLAB NE 0.
            MOVE MSLB-LIFNR TO INT1-LGORT.
            MOVE MSLB-LBLAB TO INT1-LABST.
            APPEND INT1.
          ENDSELECT.
        ENDIF.
        W_LEVEL = 1.
        NEW-PAGE.
        PERFORM GETCHILD.
      ENDIF.
    ENDSELECT.
    get child parts
    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 WRT_DTL.
          CHILD-MATNR = STPO-IDNRK.
          W_LEVEL = W_LEVEL + 1.
          IF W_LEVEL <= S_LVL.
            PERFORM SUBCHILD.
          ENDIF.
          W_LEVEL = W_LEVEL - 1.
        ENDIF.
      ENDSELECT.
    ENDFORM.
    get grand children parts
    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 WRT_DTL.
            CHILD-MATNR = STPO-IDNRK.
            W_LEVEL = W_LEVEL + 1.
            IF W_LEVEL <= S_LVL.
              PERFORM SUBCHILD.
            ENDIF.
            W_LEVEL = W_LEVEL - 1.
            SHIFT W_LVL.
          ENDIF.
        ENDSELECT.
    ENDFORM.
    TOP-OF-PAGE.
    WRITE:/ SY-DATUM,SY-UZEIT,
           85 'ABC PTE LTD',
          182 'Page', SY-PAGNO.
    WRITE: / SY-REPID,
             75 'BOM STRUCTURE  (WITH LOCATION BALANCES)',
             182 SY-UNAME.
    SKIP.
    CLEAR W_LFLAG.
    WRITE:/ 'Material No.:', PARENT-MATNR,
            60 'Plant    :', MAST-WERKS.
    W_COL = 90.
    CLEAR W_TTL.
    LOOP AT INT1.
      IF W_COL > 195.
        IF W_LFLAG IS INITIAL.
          WRITE:/ 'Description :', W_MAKTX,
               60 'Base Qty :', S_BASE LEFT-JUSTIFIED.
          W_LFLAG = 'X'.
          W_COL = 90.
        ELSE.
          W_COL = 90.
          SKIP.
        ENDIF.
      ENDIF.
      WRITE AT W_COL 'Loc :'.
      W_COL = W_COL + 6.
      WRITE AT W_COL INT1-LGORT.
      W_COL = W_COL + 7.
      WRITE AT W_COL(12) INT1-LABST LEFT-JUSTIFIED.
      W_COL = W_COL + 16.
      W_TTL = W_TTL + INT1-LABST.
    ENDLOOP.
    IF W_LFLAG IS INITIAL.
      WRITE:/ 'Description :', W_MAKTX,
           60 'Base Qty :', S_BASE LEFT-JUSTIFIED,
           90 'Total :', W_TTL LEFT-JUSTIFIED.
    ELSE.
      WRITE AT W_COL 'Total :'.
      W_COL = W_COL + 8.
      WRITE AT W_COL W_TTL LEFT-JUSTIFIED.
    ENDIF.
    SKIP.
    ULINE.
    WRITE: /001 'Level',
            011 'Item',
            017 'Component',
            037 'Description',
            079 '    Per',
            089 'UOM',
            094 ' Std Price',
            106 'Moving Avg',
            119 'Location',
            128 ' Balance',
            139 'Location',
            148 ' Balance',
            159 'Location',
            168 ' Balance',
            179 'Total Quantity'.
    ULINE.
    FORM WRT_DTL.
      CLEAR: MAKT-MAKTX, W_MAV, W_STD.
      SELECT SINGLE * FROM MAKT WHERE MATNR = STPO-IDNRK AND
           SPRAS = 'E'.
      SELECT SINGLE * FROM MBEW WHERE MATNR = STPO-IDNRK AND
           BWKEY = MAST-WERKS.
      IF SY-SUBRC = 0.
        W_MAV = MBEW-VERPR / MBEW-PEINH.
        W_STD = MBEW-STPRS / MBEW-PEINH.
      ENDIF.
      W_MENGE = ( STPO-MENGE / STKO-BMENG ) * S_BASE.
      W_LVL2 = W_LEVEL.
      CONCATENATE W_DOT W_LVL INTO W_LVL.
      CONCATENATE W_LVL W_LVL2 INTO W_LVL1.
      WRITE: /001 W_LVL1,
              011 STPO-POSNR,
              017 STPO-IDNRK,
              037 MAKT-MAKTX,
              079(8) W_MENGE,
              089 STPO-MEINS,
              094(10) W_STD,
              106(10) W_MAV.
      W_COL = 119.
      CLEAR W_TTL.
      SELECT * FROM MARD WHERE MATNR = STPO-IDNRK AND
           WERKS = MAST-WERKS AND
           LABST NE 0.
        IF W_COL > 166.
          W_COL = 119.
          WRITE AT /W_COL ' '.
        ENDIF.
        WRITE AT W_COL MARD-LGORT.
        W_COL = W_COL + 5.
        WRITE AT W_COL(13) MARD-LABST.
        W_COL = W_COL + 15.
        W_TTL = W_TTL + MARD-LABST.
      ENDSELECT.
      IF X_MSLB EQ 'X'.
        SELECT * FROM MSLB WHERE MATNR = STPO-IDNRK AND
             WERKS = MAST-WERKS AND
             LBLAB NE 0.
          IF W_COL > 166.
            W_COL = 119.
            WRITE AT /W_COL ' '.
          ENDIF.
          WRITE AT W_COL(6) MSLB-LIFNR.
          W_COL = W_COL + 6.
          WRITE AT W_COL(12) MSLB-LBLAB.
          W_COL = W_COL + 14.
          W_TTL = W_TTL + MSLB-LBLAB.
        ENDSELECT.
      ENDIF.
      WRITE AT 179(15) W_TTL.
    ENDFORM.

  • BOM Report with Alternative Items

    Hello Experts,
    I am trying to write a query of BOM Report with the first Alternative Item (from OALI)
    Your help please..
    Thank You
    Meitalmo

    Then what is this report using for? Check this to start:
    SELECT T0.Father, CASE WHEN T1.OrigItem IS NULL THEN T0.Code ELSE T1.AltItem END as 'Item No.', Case WHEN T1.OrigItem IS NULL THEN T2.ItemName ELSE T3.ItemName END 'Item Description'
    FROM dbo.ITT1 T0
    LEFT JOIN dbo.OALI T1 ON T1.OrigItem = T0.Code
    LEFT JOIN dbo.OITM T2 ON T2.ItemCode = T0.Code
    LEFT JOIN dbo.OITM T3 ON T3.ItemCode = T1.AltItem
    WHERE T0.Father = '[%0\]'

  • BOM Report to view BOM vaildity date

    Hi All,
             Is there any standard BOM report where i can view the BOM - valid from date and vaild to date ?
    Regards,
    PSS

    Hi,
    You will get Valid from date from many BOMs table both at header level and item level but the default valid to date will be 31.12.9999, and you will not get the value till you delete the BOM either at header level or at item level.
    Once you delete the BOm or item within BOM then this deletion date will become vaild to date and this will be available in concerns tables.
    With change number also valid to date will not be capture till you delete the BOMs ot items within the BOM with the change number.
    You can only work with header items using production versions  valid from and valid to date and restrict the validity of the BOM.
    Regards
    TAJUDDIN

  • Descrepency in BOM Report

    Dear All
    Please clarify the following discrepancy I found in BOM report in one of my Customer database:
      Schenario - 1
          Parent Item A  --  Qty 1 kg
                Child Item B  --  Qty 1.2 kg
           Parent Item B  --  Qty 1 kg
                  Child Item C  --  Qty 1.2 kg
    When BOM report is processed  and system displays following which is correct :
        Item A  --  1 kg
           Item B  --  1.2 kg
              Item C  --   1.44 kg
    Schenario - 2
    Now they changed the BOM of Item B as follow :
         Parent Item B  --  2 kg
                Child Item C  --  7 kg
    Again BOM report is processed and system displays following containing wrong value for Item B :
          Item A  --  1 kg
              Item B  --  0.6 kg
                  Item C  --  4.2 kg
    Since1 kg of Item A requires 1.2 kg of Item B as per BOM defined so in case of Schenario - 2 it should show the same in this case also. Also requirement of Item C of 4.2 kg will also produce 1.2 kg of Item B and not 0.6 kg as shown by the system.
    Please clarify this anamoly.
    Thanks & with regards
    S K Ganguly

    Dear Gordon / Swaijis
    I am not convinced in Gordons point as user will be confused to see the report though working will not hamper. My point is with respect to BOM report and not with the process of Production routine.
    And for Swaijis -- have you enterd my values of 2nd schenario i.e. Quanityt of Parent item of Child BOM should not have unit (1) quantity but more than unit i.e. 2 or 3 etc. and accordingly quantity of child items of this parent to be changed.
    Now you take the BOM report of Parent Item of Parent Item of child item and explode it. You will find error in the report.
    Thanks & with regards
    S K Ganguly

  • BOM report in R/3

    Hi, are there any R/3 BOM reports that will detail the <b>current</b> BOM for a range of materials not just one material?. Need to output the results to .xls

    OK, I choose "order tree" and I get a pop-up message:
    "Order tree for the first procurement element PrdOrd 000009200002/PP04/Re is displayed"
    with a long text containing:
    <i><b>Diagnosis</b>
    The order tree for an MRP element is to be displayed. However, no MRP element was selected in the list.
    <b>Procedure</b>
    If you wish to display the order tree for a different MRP element, select the MRP element in this list by placing the cursor in the respective list. Then choose the function 'Switch to order tree'.</i>
    As a result I get a tree with a node corresponding to a production order number which in turn contains a single subnode corresponding to the material BOM. That's all. No components of the BOM appear.
    I've tried various clicking combinations (according to the message long text) - still I can't see any way to get a view of components as you say.
    regards

  • BOM reports using a group of Materials

    Hi all
    I am looking at standard SAP BOM reports CS11, CS12, CS13. All of them require that I enter a Material number. Do we have standard reports where we can look at BOM using a generic group of materials example where multiple selection of materials is allowed, or selecting BOMs using for all materials belonging to a material group etc.
    thanks a lot

    Hi John,
    There are no Standard reports available for BOM.
    You may consider creating a query or an ABAP report.
    If you are planning to develop a report you may use the Function module CSAP_MAT_BOM_READ which will list the BOM for a material in Internal tables
    Regards,
    Jayakandan

  • Modification of BOM Report! (CS03 )

    Dear Experts,
    Actually iam required to add an additional field in to a standard BOM Report i.e. CS03
    In this report the requirement is to have the additional field for 'stock quantity' available.
    Now in order to accomplish this i need to have a custom BOM Report so that i can manipulate according to my requirements,
    I humbly request all the experts to help me by giving me the code snippet and any guidelines if possible.
    Regards,
    Parwez.

    Dear Mr Vinayak
    I request you to kindly guide me as how can we use BADI-CEWB_BOM_CUS_FIELDS , so that in standard report using CS03  we can have additional field like "Stock Quantity" .
    Sir, It will be great help , if you can pl send me the detail procedure to be followed for this .
    Regards
    B Mittal

  • 'Valid to' dates for both the Header & the components in the BOM report.

    Hi Experts,
    My Requirement:
    Need to display the 'Valid to' dates for both the Header & the components in the BOM report.
    Right now we are using the Functional modules 'GET_STKO' & 'GET_STPO' for the header
    & the components respectively. The report gives the correct output for the all the BOM alternatives
    which exist. But for the BOM alternatives which have been deleted(updated in STKO-LKENZ)
    'Valid to' dates are displayed as'00/00/0000'.
    (Note:ECM is used for BOMs)
    Is there any Logical Database that I can fetch the 'Valid to' dates of both BOM Header & components
    which are deleted?
    Regards,
    Mahesh

    Dear Mahesh,
    In my understanding I dont think you cannot get the valid to date for BOM header,unless a ECN,(engineering change number) is
    used to set the deletion flag.In otherwords none of the business sets for all these BOM's the valid to date(which means the
    default valid to date 31.12.9999 is taken).
    Check with this FM, CS_BOM_EXPL_MAT_V2 whether can you get the valid to date for the components(infact here also the
    valid from date given in the input screen impacts the report output).
    Check and revert back.
    Regards
    Mangalraj.S

  • BOM Report - List Prices

    Hello, i'm new to the forum and to SBO.
    i've searched the entire forum for this answer:
    I wan't to know if it's possible to display on the BOM report all the child item prices when the Parent item is expanded.
    Thank you for your help, and i hope to learn as much as possible and contribute to theis excellent forum for SBO.
    Regards,
    GuillermoL.-

    Hello Gordon!
    I'm glad to see your replied to my posts, i've been around as a guest viewing your posts and i've seen you help so many people, inluding me.
    There is only one more level below the parent item (Level 2), and i need to display the parent item price and those level 2 child items price, but i also have several Price Lists, so i need to be able to select The price list too.
    Thank you in advanced.
    Best Regards,
    Guillermo.-

  • BOM Reports

    Hi Experts..
    I have udf in Item Master Data as Drg No. & I want to get this udf in BOM Reports.
    Thanks in Advance..
    Regards,
    Ravi

    Hi RAVI_JHA_SAP ,
    i have a solution to your problem.
    1.create a UDF under BOM rows ( DRG_NO)
    2. then create a FMS that will compare the value of Items selected in the BOM row into your Item master data. after doing this  select the value of the DRG No and inser the OITM and insert it into you created UDF in the BOM row.
    3. set auto refresh on Item row in BOM.
    Hope you can use this workaround.
    Thank you!
    Best Regards,
    Darius Gragasin

  • To create Multilevel BOM---- BAPI (urgent)

    Hi all,
    i am using BAPI_MATERIAL_BOM_GROUP_CREATE to create a <u><b>MULTI LEVEL</b></u> BOM in sap. but i am not getting any field for <b>LEVEL</b> in this BAPI.so,  can i create a multilevel bom without a level ?
    can u plz suggest, how can i use this BAPI to create a <b>multi level</b> bom?
    is there any field relating to assembly indicator (stlkz) in this BAPI?i am not getting this field.plz suggest.
    any idea will be highly appreaciated.
    Regards
    pabitra

    Hi eswar,
    Thanks for ur help. i am getting some error while creting a BOM using that BAPI.
    errors are
    1) Error/warning when checking the structure of the BOM group with ID =
    2)Alternative  does not exist for material assignment to material BAPIBOMFG1
    is it mandatory to pass the bom group id to this bapi?
    In bomgroup structure , i am not passing anything to BOM_GROUP field.
    is it mandatory to pass this data? i am giving my coding below.plz suggest , where i am making mistake. it is urgent.
    regards
    pabitra
    report z_bom_create
           line-size 132
           line-count 65
           no standard page heading.
    *-- DATA DECLARATION--
    include <icon> .
    *---Tables
    tables : s076, t100, marc .
    *---Types
    types : begin of t_upload,      " Upload file data
             col1(18),
             col2(10),
             col3(30),
             col4(12),
             col5(50),
           end of t_upload,
           begin of t_split,
           location like stpu-ebort,
           end of t_split.
    data:begin of i_return occurs 10.
    include structure bapiret2.
    data:end of i_return.
    types:begin of t_item."occurs 10.
    include structure BAPI1080_ITM_C.
    types:end of t_item.
    types:begin of t_subitem." occurs 10.
    include structure  BAPI1080_SUI_C.
    types:end of t_subitem.
    types:begin of t_header." occurs 10.
    include structure  BAPI1080_MBM_C.
    types:end of t_header.
    types:begin of t_bomgroup." occurs 10.
    include structure  BAPI1080_BGR_C.
    types:end of t_bomgroup.
    types:begin of t_variant." occurs 10.
    include structure  BAPI1080_BOM_C.
    types:end of t_variant.
    *--- Tables
    data: i_upload type standard table of t_upload, " to hold data
          i_upload1 type standard table of t_upload,
          i_split type standard table of t_split,
          i_item type standard table of t_item,
          i_subitem type standard table of t_subitem,
          i_header type standard table of t_header,
          i_bomgroup type standard table of t_bomgroup,
          i_variant type standard table of t_variant.
    data: wa_upload  type t_upload, " to hold file data,
          wa_upload1 type t_upload, " to hold plan data,
          wa_split type t_split,
          wa_item type t_item,
          wa_subitem type t_subitem,
          wa_header type t_header,
          wa_bomgroup type t_bomgroup,
          wa_variant type t_variant.
    data:v_matnr like mara-matnr,
         v_start like sy-index,
         v_count(3) type c.
    *--Constants
    data: c_dot type c value '.',
          c_x type c value 'X',
          c_comma type c value ','.
    -------Selection Screen Design -
    *Selection screen for input of upload file address
    selection-screen skip 2.
    selection-screen begin of block blk1 with frame.
    parameters     : p_file like rlgrap-filename obligatory .
    parameters     : p_matnr like mara-matnr obligatory,
                     p_werks like marc-werks obligatory memory id wrk,
                     p_stlan like afko-stlan obligatory default '1' .
    selection-screen end of block blk1.
    ---AT SELECTION SCREEN -
    at selection-screen on  value-request for p_file.
    *--For popup  to select file.
      perform f_give_help.
    at selection-screen on  p_matnr.
      perform f_check_matnr.
    -----START OF SELECTION -
    *--Data upload using WS_Upload.
    perform f_get_data.
    perform f_get_bom_data.
    perform f_get_bom_data1.
    perform f_call_bapi.
    *&      Form  f_give_help
          text
    -->  p1        text
    <--  p2        text
    FORM f_give_help.
    call function 'WS_FILENAME_GET'
           exporting
                mask             = ',.,..'
                mode             = 'O'
           importing
                filename         = p_file
           exceptions
                inv_winsys       = 1
                no_batch         = 2
                selection_cancel = 3
                selection_error  = 4
                others           = 5.
      if sy-subrc <> 0 and  not sy-msgty is initial.
        message id sy-msgid type sy-msgty number sy-msgno
        with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    ENDFORM.                    " f_give_help
    *&      Form  f_check_matnr
          text
    -->  p1        text
    <--  p2        text
    FORM f_check_matnr.
    CALL FUNCTION 'BAPI_MAT_BOM_EXISTENCE_CHECK'
      EXPORTING
        MATERIAL              = p_matnr
        PLANT                 = p_werks
        BOMUSAGE              = '1'
      VALID_FROM_DATE       =
      VALID_TO_DATE         =
      TABLES
        RETURN                = i_return.
    ENDFORM.                    " f_check_matnr
    *&      Form  f_get_data
          text
    -->  p1        text
    <--  p2        text
    FORM f_get_data.
    call function 'WS_UPLOAD'
       exporting
      CODEPAGE                      = ' '
          filename                      = p_file
          filetype                      = 'DAT'
        tables
          data_tab                      = i_upload
       exceptions
         conversion_error              = 1
         file_open_error               = 2
         file_read_error               = 3
         invalid_type                  = 4
         no_batch                      = 5
         unknown_error                 = 6
         invalid_table_width           = 7
         gui_refuse_filetransfer       = 8
         customer_error                = 9
         others                        = 10
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    ENDFORM.                    " f_get_data
    *&      Form  f_get_bom_data
          text
    -->  p1        text
    <--  p2        text
    FORM f_get_bom_data.
    delete i_upload where col1 is initial.
    delete i_upload where col1 cs 'ITEM'.
    read table i_upload into wa_upload with key col1 = 'FINISHED GOOD:'.
    if sy-subrc = 0.
    v_matnr = wa_upload-col2.
    if v_matnr <> p_matnr.
    message e001(zl) with p_matnr.
    endif.
    else.
    message e000(zl).
    endif.
    ENDFORM.                    " f_get_bom_data
    *&      Form  f_get_bom_data1
          text
    -->  p1        text
    <--  p2        text
    FORM f_get_bom_data1.
    loop at i_upload into wa_upload where col1 CS 'FINISHED GOOD'.
    v_start = sy-tabix + 1.
    loop at i_upload into wa_upload1 from v_start .
            if wa_upload1-col1 cs 'FINISHED GOOD'.
              exit.
            else.
    perform f_split_upload_data.
         endif.
    endloop.
          endloop.
    ENDFORM.                    " f_get_bom_data1
    *&      Form  f_split_upload_data
          text
    -->  p1        text
    <--  p2        text
    FORM f_split_upload_data.
    if not wa_upload1-col5 is initial.
    if wa_upload1-col5 cs c_comma.
    split wa_upload1-col5 at c_comma into table i_split.
    loop at i_split into wa_split.
    v_count = v_count + 1.
    endloop.
    if wa_upload1-col4 <> v_count.
       wa_upload1-col4 = v_count.
    endif.
    clear wa_upload1-col5.
    clear wa_split.
    loop at i_split into wa_split.
    wa_upload1-col5 = wa_split-location.
    append wa_upload1 to i_upload1.
    endloop.
    else.
    append wa_upload1 to i_upload1.
    endif.
    else.
    append wa_upload1 to i_upload1.
    endif.
    ENDFORM.                    " f_split_upload_data
    *&      Form  f_call_bapi
          text
    -->  p1        text
    <--  p2        text
    FORM f_call_bapi.
    clear wa_upload1.
    wa_header-material = p_matnr.
    wa_header-plant = p_werks.
    wa_header-bom_usage = p_stlan.
    append wa_header to i_header.
    wa_bomgroup-bom_usage = p_stlan.
    wa_bomgroup-created_in_plant = p_werks.
    append wa_bomgroup to i_bomgroup.
    wa_variant-alternative_bom = 1.
    wa_variant-base_qty = 1.
    wa_variant-valid_from_date = sy-datum.
    append wa_variant to i_variant.
    loop at i_upload1 into wa_upload1.
    wa_item-item_no = wa_upload1-col1.
    wa_item-item_cat = wa_upload1-col2.
    wa_item-component = wa_upload1-col3.
    wa_item-comp_qty = wa_upload1-col4.
    append wa_item to i_item.
    wa_subitem-subitem_qty = '1'.
    wa_subitem-installation_point = wa_upload1-col5.
    append wa_subitem to i_subitem.
    endloop.
    CALL FUNCTION 'BAPI_MATERIAL_BOM_GROUP_CREATE'
    EXPORTING
      TESTRUN                  = ' '
      ALL_ERROR                = ' '
      TABLES
        BOMGROUP                 = i_bomgroup
        VARIANTS                 = i_variant
       ITEMS                    = i_item
       SUBITEMS                 = i_subitem
        MATERIALRELATIONS        = i_header
      ITEMASSIGNMENTS          =
      SUBITEMASSIGNMENTS       =
      TEXTS                    =
        RETURN                   = i_return.
    if  i_return[] is initial.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    *write: /'BOM created:', stpo-stlnr.
    else.
    *if not i_return[] is initial.
    loop at i_return.
        IF i_return-TYPE = 'E'.
       errmsg-type = i_return-type.
       errmsg-line = i_return-message.
       append errmsg.
          ULINE /1(108).
          write:/ icon_led_RED as icon, i_return-MESSAGE.
          ULINE /1(108).
        ENDIF.
        IF i_return-TYPE = 'W'.
       errmsg-type = i_return-type.
       errmsg-line = i_return-message.
       append errmsg.
          ULINE /1(108).
          write:/ icon_led_YELLOW as icon, i_return-MESSAGE.
          ULINE /1(108).
        ENDIF.
      ENDLOOP.
    *write: / i_return-id, i_return-number, i_return-message(80).
    *endloop.
    *write: /'Error'.
    endif.
    ENDFORM.                    " f_call_bapi

Maybe you are looking for

  • Report for Open Sales Orders

    Hi.. my client want the report for all open sales orders in following manner : CUSTOMER NAME         ITEM 1      ITEM 2     ITEM 3  ITEM 4 Customer 1                     23             45           54          76 Customer 2                     10    

  • New Certification blog and new magazine about certification

    Dear Oracle Certification addicts Please consult the following blog http://blogs.oracle.com/certification/ I did really appreciate the To Certify or Not to Certify topic is it quite good. Especially that Note to Hiring Managers: Just as candidate sho

  • Values in two columns in Excel

    Good morning I am writing the values to the Excel from 2 sequences, now in the excel it writes one below the other but i like to write in separate columns Thanks

  • What is mean secret code while am purchasing apps in apps store in payment  process ?

    I need to know what I ll mention in secret code while am purchasing a apps it will direct to payment process, there it can ask for the secret code ? It is pin no of Visa card or any other one ? Please explain me I have to purchase one important app?

  • SUNWi1cs, SUNWi15cs are missing in oracle solaris for VM

    Hello, i'm installing oracle 10r2 on Solaris10_8-11 for testing purposes. i have download Solaris from VM section of oracle http://www.oracle.com/technetwork/server-storage/solaris10/solaris-vm-405695.html. Two package are missing both are required f