<?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: Extracting MATNR: in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-matnr/m-p/1642076#M285935</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use table MARC.  First do a SELECT and get all of the materials for plant 4. Then loop at this internal table and do a select against MARC with that material, then check how many records where retrieved, if more than one, then you know that that material is extended to other plants, not just plant 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: imarc type table of marc with header line.
data: imarcx type table of marc with header line.
data: marc_lines type i.

select * into table imarc from marc
                 where werks = '0004'.

loop at imarc.

refresh imarcx.
select * into table imarcx from marc
                where matnr = imarc-matnr.
describe table imarcx lines marc_lines.
if marc_lines &amp;gt; 1.
  write:/ 'Material is extended to other plants, not just 0004'.
elseif marc_lines = 1.
  write:/ 'Material is extended to plant 0004 only'.
endif.

endloop.&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>Mon, 20 Nov 2006 00:19:10 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2006-11-20T00:19:10Z</dc:date>
    <item>
      <title>Extracting MATNR:</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-matnr/m-p/1642075#M285934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can some one help me with the sample code or a prototype or logic in: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Identifying the List of materials (MATNR) which are unique to Plant number(WERKS) 0004 only &amp;amp; Non shared with other Plants.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Nov 2006 00:13:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-matnr/m-p/1642075#M285934</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-20T00:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting MATNR:</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-matnr/m-p/1642076#M285935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use table MARC.  First do a SELECT and get all of the materials for plant 4. Then loop at this internal table and do a select against MARC with that material, then check how many records where retrieved, if more than one, then you know that that material is extended to other plants, not just plant 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: imarc type table of marc with header line.
data: imarcx type table of marc with header line.
data: marc_lines type i.

select * into table imarc from marc
                 where werks = '0004'.

loop at imarc.

refresh imarcx.
select * into table imarcx from marc
                where matnr = imarc-matnr.
describe table imarcx lines marc_lines.
if marc_lines &amp;gt; 1.
  write:/ 'Material is extended to other plants, not just 0004'.
elseif marc_lines = 1.
  write:/ 'Material is extended to plant 0004 only'.
endif.

endloop.&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>Mon, 20 Nov 2006 00:19:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-matnr/m-p/1642076#M285935</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-11-20T00:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting MATNR:</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-matnr/m-p/1642077#M285936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rich:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When using select * into table inside a loop, is the REFRESH still needed?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Nov 2006 01:57:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-matnr/m-p/1642077#M285936</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2006-11-20T01:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting MATNR:</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-matnr/m-p/1642078#M285937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sekhar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check another way of extracting the same.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TABLES: MARC.
TYPES: BEGIN OF T_MARC,
         MATNR TYPE MATNR,
         COUNT TYPE I,
       END OF T_MARC.
DATA: IT_MARC TYPE TABLE OF T_MARC.
PARAMETERS: P_WERKS TYPE WERKS_D OBLIGATORY.

SELECT MATNR COUNT( * ) INTO TABLE IT_MARC FROM MARC AS A
       WHERE EXISTS ( SELECT * FROM MARC WHERE MATNR = A~MATNR
                                         AND   WERKS = P_WERKS )
       GROUP BY MATNR
       HAVING COUNT( * ) EQ 1.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Nov 2006 02:34:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-matnr/m-p/1642078#M285937</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-20T02:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting MATNR:</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-matnr/m-p/1642079#M285938</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 THIS CODE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables: mara.&lt;/P&gt;&lt;P&gt;data: itab like marC occurs 0 with header line.&lt;/P&gt;&lt;P&gt;DATA: ITAB_TMP LIKE MARC OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;selection-screen: begin of block blk1 with frame title text-001.&lt;/P&gt;&lt;P&gt;  select-options: s_MATNR for mara-matnr.&lt;/P&gt;&lt;P&gt;selection-screen end of block blk1.&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from marC into table itab&lt;/P&gt;&lt;P&gt;              where matnr in s_MATNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ITAB.&lt;/P&gt;&lt;P&gt;ITAB_TMP[] = ITAB[].&lt;/P&gt;&lt;P&gt;SORT ITAB_TMP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;  LOOP AT ITAB_TMP WHERE MATNR = ITAB-MATNR AND&lt;/P&gt;&lt;P&gt;                         WERKS &amp;lt;&amp;gt; ITAB-WERKS.&lt;/P&gt;&lt;P&gt;    DELETE ITAB WHERE MATNR = ITAB-MATNR.&lt;/P&gt;&lt;P&gt;    EXIT.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;  WRITE : / ITAB-MATNR,20 ITAB-WERKS.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: Above code is sample only. needs to be tuned as per the requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;sundaramj.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Nov 2006 03:05:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-matnr/m-p/1642079#M285938</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-20T03:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting MATNR:</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-matnr/m-p/1642080#M285939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Rich!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That was awesome. I really didn,t get the thought of 'DESCRIBE'...&lt;/P&gt;&lt;P&gt;Anyways thank you once again for the detailed code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Nov 2006 03:07:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-matnr/m-p/1642080#M285939</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-20T03:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting MATNR:</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-matnr/m-p/1642081#M285940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks to others too.&lt;/P&gt;&lt;P&gt;But I felt much comfortable with his code i ment by RICH...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyways I'm rewardin you guys too .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Nov 2006 03:11:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-matnr/m-p/1642081#M285940</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-20T03:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting MATNR:</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-matnr/m-p/1642082#M285941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Suresh,  no the REFRESH is not needed.  It is just one of my habits to clear stuff.&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>Mon, 20 Nov 2006 14:00:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/extracting-matnr/m-p/1642082#M285941</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-11-20T14:00:09Z</dc:date>
    </item>
  </channel>
</rss>

