CS_BOM_EXPL_MAT_V2 Dump NO_PLANT_DATA

Hi All,
     I am trying to build a infoset-query to display multi-level BOM as seen Output .I tried CS_BOM_EXPL_MAT_V2 FM
     But if BOM component available In material it is working Good . but I case i am using multi material number and first Material
    not have BOM component It is Give DUMP ( NO_PLANT_DATA)
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
  EXPORTING
    CAPID                       = 'PP01'
    DATUV                       = sy-datum
    EHNDL                       = '1'
*   FBSTP                       = 'X'
    MEHRS                       = 'X'
    MMORY                       = '1'
    MTNRV                       = itab1-matnr
    STLAL                       = '01'
    STPST                       = 0
    WERKS                       = 'PGDM'"nwerks
* IMPORTING
*   TOPMAT                      =
*   DSTST                       =
   TABLES
     stb                         =  bomdat
     exceptions
     NO_BOM_FOUND                = 5
IF sy-subrc = 5.
*sy-msgty = 'I'.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
regards
Vicky Kumar

You've obviously added some code to your infoset and are calling this FM once for each material so why not just add a check to make sure that the material actually does have a BOM before calling the FM. For example:
SELECT SINGLE COUNT(*) FROM mast
   WHERE matnr = itab1-matnr AND
         werks = 'PGDM' AND
         stlal = '01'.
IF sy-subrc = 0.
   CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
     EXPORTING
       capid                       = 'PP01'
       datuv                       = sy-datum
       ehndl                       = '1'
*   FBSTP                       = 'X'
       mehrs                       = 'X'
       mmory                       = '1'
       mtnrv                       = itab1-matnr
       stlal                       = '01'
       stpst                       = 0
       werks                       = 'PGDM'"nwerks
* IMPORTING
*   TOPMAT                      =
*   DSTST                       =
      TABLES
        stb                         =  bomdat
        EXCEPTIONS
               no_bom_found                = 5
   IF sy-subrc = 5.
*sy-msgty = 'I'.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
   ENDIF.
ENDIF.

Similar Messages

  • Short dump using CS_BOM_EXPL_MAT_V2 with different user ids

    Hi
    We are getting a short dump in our program when using FM'CS_BOM_EXPL_MAT_V2' and this is happening only for super user roles but not with regular user ids in production. We are not able to identify the solution yet, and it needs to be resolved as quickly as possible. Anyhelp, really appreciated.
    Thanks
    Anil
    Here is our code:
      CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
        EXPORTING
          aumgb                 = 'X'
          capid                 = 'PP01'
          datuv                 = p_valfrm
          ehndl                 = '1'
          emeng                 = 1
          mbwls                 = ' '
          mehrs                 = 'X'
          mmory                 = '1'
          mtnrv                 = p_matnr
          stlal                 = p_stlal
          stlan                 = p_stlan
          werks                 = p_werks
        TABLES
          stb                   = i_stb
          matcat                = i_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
          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.

    Hi senthil,
    1. I suppose u want to explode the BOM.
    2. CS_BOM_EXPLOSION
       use the above FM
       in the below mentioned fashion.
    3.
      CALL FUNCTION 'CS_BOM_EXPLOSION'
       EXPORTING
       capid                       = 'PP01'
       emeng                       = bmeng
       datuv                       = sy-datum
       mtnrv                       = matnr
       stlan                       = '1'
         werks                       =  werks
         mehrs = 'X'
    IMPORTING
      TOPEQUI                     =
      TOPMAT                      =
      TOPTPL                      =
      DSTST                       =
        TABLES
          stbd                        = stbd
          stbe                        = stbe
          stbk                        = stbk
          stbm                        = stbm
          stbp                        = stbp
          stbt                        = stbt
    EXCEPTIONS
       alt_not_found               = 1
       call_invalid                = 2
       missing_authorization       = 3
       no_bom_found                = 4
       no_plant_data               = 5
       no_suitable_bom_found       = 6
       object_not_found            = 7
       conversion_error            = 8
       OTHERS                      = 9
    regards,
    amit m.

  • Function module CS_BOM_EXPL_MAT_V2 Documentation

    I cannot find any documentation for function module CS_BOM_EXPL_MAT_V2.  It is a very powerful function module, however, it is not useful without documentation.  I know that it can do single level boms as well as multi level and a host of other things, but I can only guess without documentation.  Do you know where I can get documentation for this function module. 
                        thank you in advance, Leonard Getz, Dy4 Systems Inc. Ottawa, Ontario, Canada.

    This is what I found:
    CALL FUNCTION 'CS_BOM_EXPL_MAT_V2' "BOM explosion for material
    EXPORTING
      ftrel = SPACE               " csdata-xfeld  Limited multi-level - stop explosion at items not relevant to production
      aufsw = SPACE               " csdata-xfeld  Determine and enter order level and channel
      aumgb = SPACE               " csdata-xfeld  Calculate scrap quantity
      aumng = 0                   " stko-bmeng    Scrap quantity
      auskz = SPACE               " csdata-xfeld  Scrap
      bagrp = SPACE               " mara-matnr    Assembly restriction
      beikz = SPACE               " stpo-beikz    Material provision indicator
      bessl = SPACE               " csdata-xfeld  Material provision selection indicator
      bgixo = SPACE               " csdata-xfeld  Load assembly information for exploded assemblies only
      brems = SPACE               " csdata-xfeld  Limited explosion
      capid = 'STD1'              " tc04-capid    Application ID
      cospr = SPACE               " csdata-xfeld  Internal: (CO) order-spec. MatPreRead
      cuobj = 000000000000000     " marc-cuobj    Configuration
      datuv = 00000000            " stko-datuv    Validity date
      delnl = SPACE               " csdata-xfeld  Delete items not kept in stock from list
      emeng = 0                   " stko-bmeng    Required quantity
      erskz = SPACE               " stpo-erskz    Spare part indicator
      erssl = SPACE               " csdata-xfeld  Spare part selection indicator
      fbstp = SPACE               " csdata-xfeld  Limited multi-level - stop explosion at externally procured item
      mbwls = SPACE               " csdata-xfeld  Read material valuation
      mdmps = SPACE               " csdata-xfeld  Limited multi-level - explode phantom assemblies at least
      mehrs = SPACE               " csdata-xfeld  Multi-level explosion
      mkmat = SPACE               " csdata-xfeld  Limited multi-level; explode KMAT
      mmaps = SPACE               " csdata-xfeld  Limited multi-level - explode at least M assembly (M order)
      mmory = SPACE               " csdata-xfeld  Memory use ('1'=on;'0'=off;' '=no reaction)
      mtnrv = SPACE               " mara-matnr    Material
      postp = SPACE               " stpo-postp    Item category
      rndkz = SPACE               " csdata-xfeld  Round off: ' '=always, '1'=never, '2'=only levels > 1
      rvrel = SPACE               " stpo-rvrel    Relevant to sales
      sanfr = SPACE               " stpo-sanfe    Production
      sanin = SPACE               " stpo-sanin    Maintenance
      sanka = SPACE               " stpo-sanka    Costing
      sanko = SPACE               " stpo-sanko    Engineering/design
      sanvs = SPACE               " stpo-sanvs    Shipping
      schgt = SPACE               " stpo-schgt    Bulk material
      stkkz = SPACE               " stpo-stkkz    PM assembly
      stlal = SPACE               " stko-stlal    Alternative BOM
      stlan = SPACE               " stzu-stlan    BOM usage
      werks = SPACE               " marc-werks    Plant
      mdnot = SPACE               " csdata-xfeld  Restriction on MDMPS: do not explode M phantom
      panot = SPACE               " csdata-xfeld  Restriction on MDMPS: no parallel discontinue
      IMPORTING
        topmat =                    " cstmat        Data for start material
        dstst =                     " csdata-xfeld  Structure destroyed by filter
      TABLES
        stb =                       " stpox         Collective item data table
      matcat =                    " cscmat        Material catalog (sub-assemblies)
      EXCEPTIONS
        ALT_NOT_FOUND = 1           "               Alternative not found
        CALL_INVALID = 2            "               Incorrect parameter combination
        MATERIAL_NOT_FOUND = 3      "               Material not found
        MISSING_AUTHORIZATION = 4   "               No authorization (bill of material)
        NO_BOM_FOUND = 5            "               No BOM for this material
        NO_PLANT_DATA = 6           "               Material not maintained in plant
        NO_SUITABLE_BOM_FOUND = 7   "               BOM does not exist
        .  "  CS_BOM_EXPL_MAT_V2

  • Issue with CS_BOM_EXPL_MAT_V2

    Hi All,
    We are trying to fetch BOM data by calling the above function module i.e. CS_BOM_EXPL_MAT_V2.
    The function module is called as shown below
        CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
             EXPORTING
                  capid                 = 'PP01'
                  datuv                 = sy-datum
                  mktls                 = 'X'
    *              mehrs                 = 'X'
                  mmory                 = '1'
                  mtnrv                 = gs_bom-matnr
                  stlal                 = gs_bom-stlal
                  werks                 = p_werks
             TABLES
                  stb                   = gt_stb[]
             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.
    Inspite of passing the plant......the function module seems to be checking other plants as well.....i.e. for one of the material it gives an exception saying that 'Material XXX not maintained in plant ABCL'
    However the plant passed to FM is ABCM (p_werks)....then why is it checking in other plant?
    Any idea?

    Hi,
    Run report RCS12001 and check if the report is throwing a similar report with the parameters passed in the program.
    If yes, Check for SAP notes.
    If not, you may be missing some input fields.
    Sujay

  • Regarding CS_BOM_EXPL_MAT_V2 and table returned STB

    Hi Gurus ,
    I am facing one diffulty.
    I am calling following FM
          CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
               EXPORTING
                    capid                 = ' '
                    datuv                 = pa_datga
                    mdmps                 = lv_dummy
                    mehrs                 = lv_mehr
                    mtnrv                 = ls_mast-matnr
                    stlal                 = ls_mast-stlal
                    stlan                 = ls_mast-stlan
                    svwvo                 = gc_x
                    werks                 = pa_werks
                    vrsvo                 = gc_x
               IMPORTING
                    topmat                = ls_bom_header
               TABLES
                    stb                   = lt_pos
               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.
    I am doing multilevel & dummy Bom explosion .
    One internal table is returned  " stb                   = lt_pos"
    But i am not able to relate which is assmbly & its sub components .
    Also Dummy Bom assembly & components from the table returned .
    May be stufe field is making some sence as level , But still couldnt find the realtion between all IDNRK .
    Please help me to solve this puzzle .

    hi flavio,
    this report is used for total raw material estimation for the fiascal year for particular material.
    my exact requirement is on the selection screen i have  material,year,target qty.
    when user pressess  execute i need to display all the raw materials (to lower bom level) required for the material
    proportional to the target qty.
    for this i have used functiuon module CS_BOM_EXPL_MAT_V2 and able to retrieve the lower bom
    level raw materials and their quantities  into ltab and root material and its subcomponents into mtab
    in this raw materials used for sub comp[onents and for the root material may overlap  but the recipe for the raw materials
    depends on the bom of base quantity of root material,
    here my problem is how to differentiate the raw materials belongs to root material and its subcomponents ,( to perform
    calculations against the target quantity) which we r getting in ltab of fm after bom explosion.
    anybody pls suggest me .

  • Reg: Exception (ALT NOT FOUND) in the fun.module CS_BOM_EXPL_MAT_V2

    Hi Experts,
    I called the fun. module CS_BOM_EXPL_MAT_V2 in SE38.
    While executing the function module, it is giving output for some types of material like (TP0331-).
    But it is raising the exception ALT NOT FOUND for some types of material like 'TB1000-'
    But for all types of material, it is giving correct output in SE37.
    I gave the input parameter's,
    CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
    EXPORTING
       CAPID                       = 'PP01'
       DATUV                       = sy-datum
       EMENG                       = '1'
       MKTLS                       = 'X'
       MEHRS                       = 'X'
       MTNRV                       = 'TB1000-'
       STLAL                       = '1'
       STLAN                       = '1'
       SVWVO                       = 'X'
       WERKS                       = '0010'
       VRSVO                       = 'X'
      TABLES
        stb                         = it_stpox
    EXCEPTIONS
       ALT_NOT_FOUND               = 1
       CALL_INVALID                = 2
       MATERIAL_NOT_FOUND          = 3
       MISSING_AUTHORIZATION       = 4
       NO_BOM_FOUND                = 5
       NO_PLANT_DATA               = 6
       NO_SUITABLE_BOM_FOUND       = 7
       CONVERSION_ERROR            = 8
       OTHERS                      = 9
    Can you please suggest me, why for the particular types of material, these function module is executing correctly in SE37 not in SE38.
    Whether i need to give some more inputs in SE38.
    Please guide me,
    Thanks in advance,
    Vijay.R

    hi,
    i have done the code like this,
    CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
    EXPORTING
    CAPID = 'PP01'
    DATUV = sy-datum
    EMENG = '1'
    MKTLS = 'X'
    MEHRS = 'X'
    MTNRV = 'TB1000-'
    STLAL = '01'  """" i have changed the value as 01 instead of 1.
    STLAN = '1'
    SVWVO = 'X'
    WERKS = '0010'
    VRSVO = 'X'
    TABLES
    stb = it_stpox
    EXCEPTIONS
    ALT_NOT_FOUND = 1
    CALL_INVALID = 2
    MATERIAL_NOT_FOUND = 3
    MISSING_AUTHORIZATION = 4
    NO_BOM_FOUND = 5
    NO_PLANT_DATA = 6
    NO_SUITABLE_BOM_FOUND = 7
    CONVERSION_ERROR = 8
    OTHERS = 9
    it is a small problem..
    whether u need any more information..
    please let me know.. still it is not working means,
    paste your code.. i will check
    regards
    vijay

  • Use of CS_BOM_EXPL_MAT_V2 fro BOM explosion on plant basis

    hello ,
       I dont have any documentation for this FM and need to use it for BOM explosion on plant basis plz let me knw how to use it?

    Try something like this :
    *     Tables  "call CS_BOM_EXPL_MAT_V2 "
    DATA: BEGIN OF t_stb OCCURS 0.
            INCLUDE STRUCTURE stpox.
    DATA: END OF t_stb.
    DATA: BEGIN OF matcat OCCURS 50.
            INCLUDE STRUCTURE cscmat.
    DATA: END OF matcat.
      CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
        EXPORTING
          auskz                 = ' '
          capid                 = 'PP01'
          datuv                 = sy-datum
          emeng                 = '1.000'
          stlan                 = '1'
          stlal                 = mast-stlal
          mtnrv                 = matnr
          mehrs                 = 'X'
          mmory                 = '1'
          stpst                 = '0'
          werks                 = werks
        IMPORTING
          topmat                = selpool
          dstst                 = dstst_flg
        TABLES
          stb                   = stb
          matcat                = matcat
        EXCEPTIONS
          material_not_found    = 4
          no_plant_data         = 8
          no_bom_found          = 12
          no_suitable_bom_found = 16.
    Hope this helps,
    Erwan

  • Multi-level BOM explosion using CS_BOM_EXPL_MAT_V2

    Hi All,
    I would like to know, if anyone has used the function module 'CS_BOM_EXPL_MAT_V2' to prepare a report to read multi-level BOM just like CS12. If anyone has, can you please let me know how we can read the individual materials in the BOM from this FM.
    Hope my question is clear, await inputs.
    Vivek

    Hi vivek,
    We use this code to restrict the BOM line item for particular movements. C if that can help u out.
    CALL FUNCTION 'CS_BOM_EXPL_KND_V1'
        EXPORTING
          capid                       = ''
          datuv                       = sy-datum
          emeng                       = 1
         mehrs                       = 'X'
          mtnrv                       = i_mseg-matnr
          stlal                       = '1'
          stlan                       = '1'
          stpst                       = 0
          svwvo                       = 'X'
          werks                       = i_mseg-werks
          vbeln                       = aufk-kdauf
          vbpos                       = aufk-kdpos
            VERID                       = ' '
          vrsvo                       = 'X'
          IMPORTING
            TOPMAT                      =
            DSTST                       =
         TABLES
           stb                         = ZStb
            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
          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.
      SORT zstb BY mtart.
      LOOP AT zstb.
        IF zstb-mtart = 'Material type ' OR zstb-mtart = 'Material type ' .
        ELSE.
          DELETE zstb .
        ENDIF.
      ENDLOOP.
      CLEAR: v_menge, v_matnr, v_bwart, vv_menge, vvv_menge, zstb.
      LOOP AT zstb.
        SELECT menge matnr bwart
        INTO   (v_menge,v_matnr,v_bwart)
        FROM   aufm
        WHERE  aufnr = i_mseg-aufnr
        AND    werks = i_mseg-werks
        AND    matnr = zstb-idnrk
        AND    ( bwart = '261' OR bwart = '262' ).
              and    meins = 'FT2'.
         LOOP AT zstb.
          SELECT SINGLE matnr INTO vv_matnr FROM mara  WHERE  matnr = v_matnr
                                       AND mtart = zstb-mtart.
          IF sy-subrc = 0.
            CASE v_bwart.
              WHEN '261' .
                vv_menge = vv_menge + v_menge.
              WHEN '262' .
                vvv_menge = vvv_menge + v_menge.
            ENDCASE.
          ENDIF.
             ENDLOOP.
        ENDSELECT.
        CLEAR vf_menge.
        vf_menge = vv_menge - vvv_menge.
        CLEAR vv_menge.
        CLEAR vvv_menge.
    Regards,
    Vishal

  • BOMs not retrieved correctly from FM CS_BOM_EXPL_MAT_V2

    Hi All,
    I am using the FM CS_BOM_EXPL_MAT_V2 passing the following parameters.
    We are able to fetch most of the BOMs from this FM except for the records with valid to date <  sy-datum.
      CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
       EXPORTING
         aumgb                       = 'X'
         capid                      = 'ZP01'
         datuv                      = p_date
         ehndl                       = '1'
         mbwls                       = 'X'
         mehrs                       = 'X'
         mmory                       = '1'
         mtnrv                        = p_matnr
         werks                        = p_werks
         vrsvo                      = 'X'
    IMPORTING
       topmat                      = ls_cstmat
      DSTST                       =
        TABLES
          stb                       = gt_stb
          matcat                    = gt_cscmat
    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
    Please guide me if I am going wrong anywhere or if there is anyother FM to achieve this.

    Hi,
    I guess the parameter datuv = p_date is sy-datum in ur program. It is actually valid from date so you will get all BOM greater than sy-datum.
    Try not giving the date paramter. If still it does not work u can also use the FM CSAP_MAT_BOM_READ but FM CS_BOM_EXPL_MAT_V2 is more commonly used.
    Regards,
    Vasanth

  • Quantity not fetched properly from FM CS_BOM_EXPL_MAT_V2

    HI,
    I am using the FM CS_BOM_EXPL_MAT_V2 to get the BOM components at multiple levels. The problem that i am facing is that for some components if the quantity is 0.100 or 0.10 the function module is returning 10.000 and 1.000 respectively. But in CS12 we are getting the correct values for quantity 0.100 and 0.10 for the same components. I am using the function module like this.
    CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
          EXPORTING
            capid                 = c_zeng
            datuv                 = l_datum
            emeng                 = '1'
            mehrs                 = c_x
            mtnrv                 = wa_outline-matnr
            werks                 = wa_outline-werks
          TABLES
            stb                   = t_stpo
          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.
    So let me know how to get the correct values for quantities from this FM. Is there any other Fm which gives the correct values for quantity without any conversion.
    Regards,
    Sowmya.

    I tried that also but still it shows the same value. Another thing that i found was in CS11 or CS12 that component is displayed as 0.100 or 0.010 but in CS03 that component is having a value of 1 and 1 only. I am not able to understand the reason.
    Regards,
    Sowmya.

  • BOM: Problem using CS_BOM_EXPL_MAT_V2 -  URGENT!!!

    hai friends,
    i am using CS_BOM_EXPL_MAT_V2 fn module in my code. when i pass mtnrv = 'GK02PB.05SBIS' , i did' get any output from the above fn module. but other than the above value like mtnrv = 'OSA875CCWOF' ,i am getting output.
    thanks in advance,
    With regards,
    senthil kumar.r

    Hi senthil,
    1. I suppose u want to explode the BOM.
    2. CS_BOM_EXPLOSION
       use the above FM
       in the below mentioned fashion.
    3.
      CALL FUNCTION 'CS_BOM_EXPLOSION'
       EXPORTING
       capid                       = 'PP01'
       emeng                       = bmeng
       datuv                       = sy-datum
       mtnrv                       = matnr
       stlan                       = '1'
         werks                       =  werks
         mehrs = 'X'
    IMPORTING
      TOPEQUI                     =
      TOPMAT                      =
      TOPTPL                      =
      DSTST                       =
        TABLES
          stbd                        = stbd
          stbe                        = stbe
          stbk                        = stbk
          stbm                        = stbm
          stbp                        = stbp
          stbt                        = stbt
    EXCEPTIONS
       alt_not_found               = 1
       call_invalid                = 2
       missing_authorization       = 3
       no_bom_found                = 4
       no_plant_data               = 5
       no_suitable_bom_found       = 6
       object_not_found            = 7
       conversion_error            = 8
       OTHERS                      = 9
    regards,
    amit m.

  • CS_BOM_EXPL_MAT_V2

    HI,
    I would like get the BOM list for an materialnumber. At the import parameters , when I don´t set the parameter DATUV, I get an error. I don´t understand why. I want dont´t set this parameter, because then I get just the components of the BOM at this date and not valid from this date. Is there other Function Modules?
    regards

    Hi MurugeshRajeev,
    I developed the following program. I dont wrote here the DATA deklaration. You can do it with your own parameter that you need. I select as optional the positions of the bomlist if the user need it in this function. I got the right bomlist with the function. I hope it helps you.
    I have a Function with  parameter:
    *"  IMPORTING
    *"     VALUE(MATERIALNUMMER) TYPE  MAST-MATNR
    *"     VALUE(STLAN) TYPE  MAST-STLAN
    *"     VALUE(STLAL) TYPE  MAST-STLAL
    *"     VALUE(POSID) TYPE  STPO-STLKN OPTIONAL
    *"     VALUE(STLNR) TYPE  STPO-STLNR OPTIONAL
    *"  EXPORTING
    *"     VALUE(RETURN) TYPE  BAPIRET2-MESSAGE
    *"  TABLES
    *"      STB STRUCTURE  STPO
    *"      STBP STRUCTURE  STPO
    this is the code:
    SELECT  STLNR
    FROM MAST
    Into p_stlnr
    WHERE MATNR EQ MATERIALNUMMER AND
          STLAN EQ STLAN AND
          STLAL EQ STLAL.
    if posid is initial.
         call function 'CS_BOM_EXPL_MAT_V2'
           exporting
      FTREL                       = ' '
      ALEKZ                       = ' '
      ALTVO                       = ' '
      AUFSW                       = ' '
      AUMGB                       = ' '
      AUMNG                       = 0
      AUSKZ                       = ' '
      AMIND                       = ' '
      BAGRP                       = ' '
      BEIKZ                       = ' '
      BESSL                       = ' '
      BGIXO                       = ' '
      BREMS                       = ' '
             capid                       = 'BEST'
      CHLST                       = ' '
      COSPR                       = ' '
      CUOBJ                       = 000000000000000
      CUOVS                       = 0
      CUOLS                       = ' '
             datuv                       = sy-datum
      DELNL                       = ' '
      DRLDT                       = ' '
      EHNDL                       = ' '
            emeng                       = pemeng
      ERSKZ                       = ' '
      ERSSL                       = ' '
      FBSTP                       = ' '
      KNFBA                       = ' '
      KSBVO                       = ' '
      MBWLS                       = ' '
      MKTLS                       = 'X'
      MDMPS                       = ' '
          mehrs                       = 'X'
      MKMAT                       = 'X'
      MMAPS                       = ' '
      SALWW                       = ' '
      SPLWW                       = ' '
      MMORY                       = ' '
          mtnrv                       = materialnummer
      NLINK                       = ' '
      POSTP                       = ' '
      RNDKZ                       = ' '
      RVREL                       = ' '
      SANFR                       = ' '
      SANIN                       = ' '
      SANKA                       = ' '
      SANKO                       = ' '
      SANVS                       = ' '
      SCHGT                       = ' '
      STKKZ                       = ' '
       stlal                       = '01'
       STLAN                       = '3'
       STPST                       = '1'
      SVWVO                       = 'X'
          werks                       = '0001'
      NORVL                       = ' '
      MDNOT                       = ' '
      PANOT                       = ' '
      QVERW                       = ' '
       verid                       = pverid
      VRSVO                       = 'X'
    IMPORTING
      TOPMAT                      =
      DSTST                       =
          tables
           stb                         = istb
      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
          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.
         RETURN = No partlist.
          endif.
    LOOP AT istb.
        SELECT SINGLE * FROM stpo INTO stb
        WHERE stlnr = p_stlnr AND
              stlkn = istb-stlkn AND
              stpoz = istb-stpoz AND
              stvkn = istb-stvkn.
              append stb.
    endloop.
    else.
    SELECT *
    from stpo
    into wa_bkpff
    where stlnr EQ stlnr AND
          stlkn EQ posid.
    append wa_bkpff to stbp.
    endselect.
    endif.
    ENDFUNCTION.
    ENDSELECT.
    regards
    Sabine

  • CS_BOM_EXPL_MAT_V2  Same Plant

    Hi i'm using the FM 'CS_BOM_EXPL_MAT_V2' to extract de BOM of a material, but it returns me materials that are not in the same plant (werks),
    CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
          EXPORTING
            capid                 = v_appli
            datuv                 = v_date
            mehrs                 = 'X'
            mtnrv                 = ti_mast-matnr
            rndkz                 = ' '
            stkkz                 = ' '
            stlan                 = v_usage
            stlal                 = v_stlal
            werks                 = ti_mast-werks
            nlink                 = 'X'
          IMPORTING
            topmat                = w_topmat
          TABLES
            stb                   = itab_bom
          EXCEPTIONS
            alt_not_found         = 01
            call_invalid          = 02
            material_not_found    = 03
            missing_authorization = 04
            no_bom_found          = 05
            no_plant_data         = 06.

    Try using this FM.
    Shreekant.
        CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
          EXPORTING
            FTREL                 = ' '
            ALTVO                 = ' '
            AUFSW                 = ' '
            AUSKZ                 = ' '
            BAGRP                 = ' '
            BEIKZ                 = ' '
            BESSL                 = ' '
            BGIXO                 = ' '
            BREMS                 = ' '
            CAPID                 = P_CAPID
            DATUV                 = V_DATUV
            EMENG                 = ' '
            ERSKZ                 = ' '
            ERSSL                 = ' '
            MBWLS                 = ' '
            MTNRV                 = W_MARC_MKAL-MATNR
            MDMPS                 = ' '
            MEHRS                 = ' '
            MMORY                 = ' '
            POSTP                 = ' '
            SANKO                 = ' '
            SANFR                 = ' '
            SANKA                 = ' '
            SANIN                 = ' '
            SANVS                 = ' '
            RNDKZ                 = ' '
            RVREL                 = ' '
            SCHGT                 = ' '
            STKKZ                 = ' '
            STLAL                 = '01'
            STLAN                 = '1'
            WERKS                 = P_WERKS-LOW
          IMPORTING
            TOPMAT                = XTOPMAT
            DSTST                 = XFELD
          TABLES
            STB                   = XSTPOX
            MATCAT                = XMATCAT
          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.

  • CS_BOM_EXPL_MAT_V2 is too slow!

    We are using FM CS_BOM_EXPL_MAT_V2 in a report program that needs a fully exploded material BOM for many materials.  Users have long complained that it runs too slow.  We have identified this FM as the bottleneck.  Is there an alternative material BOM explosion FM or some trick to make it run faster?
    Here is the calling code:
      CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
           EXPORTING
    *         FTREL                 = ' '
    *         ALTVO                 = ' '
    *         AUFSW                 = ' '
    *         AUMGB                 = ' '
    *         aumng                 = 0
    *         AUSKZ                 = ' '
    *         AMIND                 = ' '
    *         BAGRP                 = ' '
    *         BEIKZ                 = ' '
    *         BESSL                 = ' '
    *         BGIXO                 = ' '
    *         BREMS                 = ' '
               capid                 = pm_capid
    *        cospr                 = ' '
    *         cuobj                 = 000000000000000
    *        cuols                 = ' '
               datuv                 = pm_datuv
    *        delnl                 = ' '
    *        ehndl                 = ' '
    *         emeng                 = 0
    *        erskz                 = ' '
    *        erssl                 = ' '
    *        fbstp                 = ' '  "Keine Auflsg. bei F
    *        ksbvo                 = ' '
    *        mbwls                 = ' '
               mktls                 = 'X'  "Kurztext lesen
    *        mdmps                 = ' '
               mehrs                 = 'X'  "Mehrstufige Auflösung
    *        mkmat                 = ' '
    *        mmaps                 = ' '
    *        splww                 = ' '
    *        mmory                 = ' '
                mtnrv                 = t_selections-matnr
                postp                 = 'L'
    *         RNDKZ                 = ' '
    *         RVREL                 = ' '
    *         SANFR                 = ' '
    *         SANIN                 = ' '
    *         SANKA                 = ' '
    *         SANKO                 = ' '
    *         SANVS                 = ' '
    *         SCHGT                 = ' '
    *         STKKZ                 = ' '
                stlal                 = pm_stlal
                stlan                 = pm_stlan
                werks                 = p_werks
    *        mdnot                 = ' '
    *        panot                 = ' '
    *        verid                 = ' '
          IMPORTING
               topmat                = selpool   "Info zum Top-Material
    *        dstst                 =
           TABLES
                stb                   =  stb       "Enthält Positionsdaten
                matcat                =  matcat    "Enthält Baugruppendaten
           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.
    Edited by: Larry Browning on Jul 14, 2011 11:08 AM

    Hi Rob and Larry,
    I am also using FM CS_BOM_EXPL_MAT_V2 in a report program. The requirement is exactly similar to Larry's. We fully explode material BOM for many materials. Users feel that it is running very slow. This is the FM that is taking the maximum time  in the program run.
    I am looking for some performance tuning technique or any other option that may help remove this issue. Is there any alternative to this FM...
    Below is my code:
            CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
             EXPORTING
               capid                       = 'PP01'
               datuv                       = sy-datum
               mehrs                       = 'X'
               mtnrv                       = ls_mast-matnr
               stlal                       = ls_mast-stlal
               stlan                       = ls_mast-stlan
               werks                       = ls_mast-werks
             IMPORTING
               topmat                      = ls_topmat
    *          DSTST                       =
             TABLES
               stb                         = lt_stb
    *          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
               conversion_error            = 8
               OTHERS                      = 9.
    Thanks
    Rakesh

  • BOM FM "CS_BOM_EXPL_MAT_V2"

    Hi,
    The FM in the sunject line returns 2 tables 'STB' and 'MATCAT'. Can anyone please let me know what kind of data is returned in these two tables if the import parameters are entered as follows:
    CAPID = ' '
    DATUV = today's date
    STLAL = 1 (alternate BOM)
    STLAN = 3 (bom usage)
    MTNRV = material #
    What output is to be expected if the BOM components for the above material were deleted. Will STB still be populated with the original BOM components. I tested the FM but got conflicting outputs for different materials.
    Any help would be appreciated.
    Thanks,
    Urmila

    Hi Urmila,
    Shrinivas is correct.
    Function module can be used as follows -
    CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
        EXPORTING
          auskz                 = ' '
          capid                 = 'PP01'
          datuv                 = sy-datum
          emeng                 = '1.000'
          stlan                 = '1'
          mtnrv                 = matnr
          mehrs                 = 'X'
          mmory                 = '1'
          stpst                 = '0'
          werks                 = werks
        IMPORTING
          topmat                = selpool
          dstst                 = dstst_flg
        TABLES
          stb                   = i_stb
          matcat                = i_matcat
        EXCEPTIONS
          material_not_found    = 4
          no_plant_data         = 8
          no_bom_found          = 12
          no_suitable_bom_found = 16.
    Tables i_stb and i_matcat should be of STPOX
    CSCMAT types respectively.
    Hope this helps.
    Warm Regards.
    Pras Durafe

Maybe you are looking for