<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Getting the Parent Material (BOM) in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-parent-material-bom/m-p/1430956#M206067</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the function module CS_WHERE_USED_MAT.  You will need to loop  and do this function call over and over untill you get to the top level.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Jul 2006 13:57:08 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2006-07-11T13:57:08Z</dc:date>
    <item>
      <title>Getting the Parent Material (BOM)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-parent-material-bom/m-p/1430955#M206066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;Is there a function that returns the parent &lt;/P&gt;&lt;P&gt;material of the component, not the immediate ancestor&lt;/P&gt;&lt;P&gt;but the PARENT (root) level of the BOM.  &lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Rose&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2006 13:54:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-parent-material-bom/m-p/1430955#M206066</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-11T13:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Parent Material (BOM)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-parent-material-bom/m-p/1430956#M206067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the function module CS_WHERE_USED_MAT.  You will need to loop  and do this function call over and over untill you get to the top level.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2006 13:57:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-parent-material-bom/m-p/1430956#M206067</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-07-11T13:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Parent Material (BOM)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-parent-material-bom/m-p/1430957#M206068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This sample program may be of some help.  I fear that this may run a very long time depending on your BOM structure, if it is very complex and deep, then this will take a while, but if it is small like 1 for 1 for 1, then it should work fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001 .

data: begin of iitems occurs 0,
      matnr type marc-matnr,
      werks type marc-werks,
      end of iitems.

data: i_stpov type table of stpov with header line.

parameters: p_matnr type marc-matnr,
            p_werks type marc-werks.

start-of-selection.

  iitems-matnr = p_matnr.
  iitems-werks = p_werks.
  append iitems.


  loop at iitems.

    perform where_used tables i_stpov
                       using iitems-matnr
                             iitems-werks.
    if not i_stpov[] is initial.
      loop at i_stpov.
        iitems-matnr = i_stpov-matnr.
        iitems-werks = i_stpov-werks.
        append iitems.
      endloop.
      delete iitems.
    else.
     continue.
    endif.

  endloop.

  loop at iitems.
    write:/ iitems-matnr, iitems-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.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2006 14:19:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-parent-material-bom/m-p/1430957#M206068</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-07-11T14:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Parent Material (BOM)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-parent-material-bom/m-p/1430958#M206069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rich,&lt;/P&gt;&lt;P&gt;The code is helpful but I get more than one parent&lt;/P&gt;&lt;P&gt;material.  Is there a way to get the parent material&lt;/P&gt;&lt;P&gt;depending on which project it is being used?.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I actually need is just the parent material&lt;/P&gt;&lt;P&gt;of the components which have project stocks.&lt;/P&gt;&lt;P&gt;I was able to get the project stock using &lt;/P&gt;&lt;P&gt;the table MSPR but I also need to get the&lt;/P&gt;&lt;P&gt;parent of these components.  The parent of the&lt;/P&gt;&lt;P&gt;component should be the one which exists  in network &lt;/P&gt;&lt;P&gt;order. (in Transaction CJ20).  I was able to manually look trace the parent materiall using MD04, choose&lt;/P&gt;&lt;P&gt;procject stock then show the pegged requirements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you know a better way to do it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so very very much for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Rose&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2006 14:53:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-parent-material-bom/m-p/1430958#M206069</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-11T14:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Parent Material (BOM)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-parent-material-bom/m-p/1430959#M206070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Getting multple parents is the basic functionality of the WHERE USED function module, because your component can reside in any number of BOMs.  If you have specific requirements to narrow down to one specific parent, then you will need to come up with the logic, but you should still use the function module i have suggested.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please make sure to award points for helpful answers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2006 14:58:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-parent-material-bom/m-p/1430959#M206070</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-07-11T14:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Parent Material (BOM)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-parent-material-bom/m-p/1430960#M206071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt; try with function module BOM_HIERARCHY .&lt;/P&gt;&lt;P&gt; in the table parameters we can get the materials involved in this BOM and their level indicator in STUFE field, by checking this we can find the top-most level material.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2006 15:03:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-parent-material-bom/m-p/1430960#M206071</guid>
      <dc:creator>srinivas_akiri</dc:creator>
      <dc:date>2006-07-11T15:03:03Z</dc:date>
    </item>
  </channel>
</rss>

