Skip to Content
author's profile photo Former Member
Former Member

Finding BOM header material from component item

If I am given a material component of a BOM, how can I then get the BOM header material. For instance Part 123 is the BOM header material and it contains one component which is part ABC. If I know part ABC, how do I then pull in Part 123 into my program?

Thanks in advance for your help.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Jan 15, 2009 at 07:05 PM

    That's right, the component can be used in more than one BOM, so you have to take that into account. But any way, you would need to get the internal BOM number from STPO where you find your ABC material in field IDNRK. Then use this internal BOM number and select against, the MAST table. This MAST table will give you the parent material and plant. So you may need to use STKO as well to get some of other field values to use to narrow your search against MAST.

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

    • Or you could use this function.

      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                      = lv_matnr
                  postp                      = ' '
                  stlan                      = ' '
                  werks                      = lv_werks
                  stltp                      = ' '
             importing
                  topmat                     = selpool  "Not Currently Used
             tables
                  wultb                      = itab  "Contains the where-used records
                  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.

      Regards,

      Rich Heilman

  • author's profile photo Former Member
    Former Member
    Posted on Jan 15, 2009 at 07:01 PM

    Hi ,

    I have a conern regarding your requiremnet , as a material can be used in a number of BOM , so the material ABC can be in more than one BOM , so what exactly is your requirement to get all the materisl which have the material ABC as a component in the bom ,

    Regards

    Arun

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 15, 2009 at 07:11 PM

    Give the material component in the field IDNRK ( component) in the table STPO

    BOM category ( STLTY) = M and then you will get BOM ( STLNR )

    Give this STLNR to table MAST and find header material in matnr.

    select single stlnr from stpo into stpo-stlnr where idnrk = p_component

    and stlty = 'M' .

    if sy-subrc = 0

    select single matnr from mast into mast-matnr where stlnr = stpo-stlnr.

    endif.

    mast-matnr is the bom header material.

    If there are multiple BOM's for the given component, then you will have to specify more conditions in the where clause.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 15, 2009 at 08:04 PM

    Thanks so much to all of you for your help!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.