Skip to Content
avatar image
Former Member

FM For Finding if Material BOM exits for BOM component.

Hi,

Is there any FM or BAPI to find out if there is any material BOM exists for the BOM component.

How is Indicator assembly get assighned..?

Any inputs would be appreciated.

Thanks,

Mark

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 14, 2006 at 06:12 PM

    You'll be surprised how cheaply this has been programmed: a selection on MAST with MATNR and WERKS is all SAP does (routine POMAT_STLKZ_ERMITTELN in SAPLCSDI).

    (Little hint on how to find these things: work with where-used analyses - either on the data element (e.g. "in function module interfaces" or "in programs"), or, if this doesn't work, on the table/structure field (in this case, RC29P-STLKZ). Then set lots of breakpoints and execute the program, until you're sure you've found the right spot.)

    BTW, if you want to do this in a cleaner way, there's no perfect solution, either. There's the BAPI_MAT_BOM_EXISTENCE_CHECK (since 4.6C), but you have to check with a specific BOM usage. Also, by looking at it, it's rather complex, so if you do this in mass-processing, it may have a performance impact.

    Or you can program your own MAST/STKO/STPO/... look-up, and at least include fields like deletion flags and the likes.

    Add comment
    10|10000 characters needed characters exceeded

    • Sample program.

      
      report zrich_0001 .
      
      * Internal Tables
      data: i_stpov like stpov occurs 0 with header line.
      
      parameters: p_matnr type marc-matnr,
                  p_werks type marc-werks.
      
      start-of-selection.
      
      perform where_used tables i_stpov
                         using p_matnr
                               p_werks.
      
      loop at i_stpov.
        write:/ i_stpov-matnr, i_stpov-werks.
      endloop.
      
      
      ************************************************************************
      *  FORM WHERE_USED.
      ************************************************************************
      form where_used tables itab
                      using  matnr
                             werks.
      
        data: selpool like mc29s.
        data: eqpcat  like cscequi occurs 0.
        data: kndcat  like cscknd  occurs 0.
        data: matcat  like cscmat  occurs 0.
        data: prjcat  like cscprj  occurs 0.
        data: stdcat  like cscstd  occurs 0.
        data: tplcat  like csctpl  occurs 0.
      
        clear itab. refresh itab.
        call function 'CS_WHERE_USED_MAT'
             exporting
                  datub                      = sy-datum
                  datuv                      = sy-datum
                  matnr                      = matnr
                  postp                      = ' '
                  stlan                      = ' '
                  werks                      = werks
                  stltp                      = ' '
             importing
                  topmat                     = selpool  "Not Currently Used
             tables
                  wultb                      = itab
                  equicat                    = eqpcat  "Not Currently Used
                  kndcat                     = kndcat  "Not Currently Used
                  matcat                     = matcat  "Not Currently Used
                  stdcat                     = stdcat  "Not Currently Used
                  tplcat                     = tplcat  "Not Currently Used
                  prjcat                     = prjcat  "Not Currently Used
             exceptions
                  material_not_found         = 02
                  no_where_used_rec_found    = 03
                  no_where_used_rec_selected = 04
                  no_where_used_rec_valid    = 05.
      
      endform.
      
      

      Regards,

      Rich Heilman

  • Jun 14, 2006 at 07:39 PM

    Rich gave you the function module that can be used to find where a particular material is used in BOMs. CS15 transaction will give you the same thing.

    Now the indicator 'Assembly' is set when there is a BOM(read sub-assembly) associated with that component of the current BOM. So if I am looking at the finished goods BOM of say a car, then I will see several components that make the car. But each of those components such as say the engine or the seats or the steering wheel is a semifinished product and needs to be manufactured by itself before you assemble it into a car. So they have their own BOMs. In those cases, you will see this indicator set on the main BOM. This can go into multiple levels like that. You can use CS12, if you want to see the exploded BOM(all levels of the BOM are expanded to the lowest level).

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 11, 2014 at 06:59 AM

    Thanks for your code.

    it is working for my requirement.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      HI all

      im having the following problem...

      we are currently upgrading and we are doing our usual testing ... So we made a copy of PRD system to do our testing...

      when re-exploding the po (subcontracting) bom, we get an error message that there is no component

      but the BOM exists with correct availibility period.

      any idea of what the prone can be?