<?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: Internal Table Line Operations - Collect Statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-line-operations-collect-statement/m-p/2752875#M640399</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Balu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want the qty to be added, I believe that the field in your internal table should be defined as a numeric field. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gilberto Li&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Sep 2007 16:48:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-17T16:48:55Z</dc:date>
    <item>
      <title>Internal Table Line Operations - Collect Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-line-operations-collect-statement/m-p/2752871#M640395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Gurus,&lt;/P&gt;&lt;P&gt;I have an internal table with data in it. The fields of the internal table are &lt;/P&gt;&lt;P&gt;Location - Matnr - Qty - Flag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Same material can be at different locations with different quantities. I need to get material and total quantity of the material in all the locations in a new internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the table (it_tab) contains -&lt;/P&gt;&lt;P&gt;Location - matnr - qty - flag&lt;/P&gt;&lt;P&gt;1200        abc       10    S&lt;/P&gt;&lt;P&gt;1201        abc       20    S&lt;/P&gt;&lt;P&gt;1205        abc       30    S&lt;/P&gt;&lt;P&gt;1207        abc       50    S&lt;/P&gt;&lt;P&gt;1200        xyz       20    S&lt;/P&gt;&lt;P&gt;1201        xyz       25    S&lt;/P&gt;&lt;P&gt;1300        xyz       22    S&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From this table, I need to get the result int table (it_res) as below -&lt;/P&gt;&lt;P&gt;Matnr - qty&lt;/P&gt;&lt;P&gt;abc      110 &lt;/P&gt;&lt;P&gt;xyz       67 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;110 = 10&lt;EM&gt;20&lt;/EM&gt;30+50&lt;/P&gt;&lt;P&gt;67 = 25&lt;EM&gt;22&lt;/EM&gt;20&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My idea is we can use collect statement looping the it_tab table.&lt;/P&gt;&lt;P&gt;Please help me how to do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Balu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2007 15:03:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-line-operations-collect-statement/m-p/2752871#M640395</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-17T15:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: Internal Table Line Operations - Collect Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-line-operations-collect-statement/m-p/2752872#M640396</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;Please try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
sort it_tab by matnr ascending.

loop at it_tab.
  it_res-matnr = it_tab-matnr.
  it_res-qty = it_tab-qty.
  collect it_res.
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;Ferry Lianto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2007 15:07:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-line-operations-collect-statement/m-p/2752872#M640396</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-17T15:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Internal Table Line Operations - Collect Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-line-operations-collect-statement/m-p/2752873#M640397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi balu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Simple&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Create one another internal table STAB, &lt;/P&gt;&lt;P&gt;    with only two fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   a) MATNR&lt;/P&gt;&lt;P&gt;   b) QTY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Now,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. &lt;/P&gt;&lt;P&gt;Loop at Itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Move-corresponding itab to STAB.&lt;/P&gt;&lt;P&gt;COLLECT STAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2007 15:20:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-line-operations-collect-statement/m-p/2752873#M640397</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-17T15:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Internal Table Line Operations - Collect Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-line-operations-collect-statement/m-p/2752874#M640398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Ferry and Amit.&lt;/P&gt;&lt;P&gt;For some reason I am not getting the required out put.&lt;/P&gt;&lt;P&gt;I am getting the output as single entries for the repeated materials but the quantity is not being added up.&lt;/P&gt;&lt;P&gt;loc - mat - qty - flag&lt;/P&gt;&lt;P&gt;10    abc    10    s&lt;/P&gt;&lt;P&gt;20    xyz     10   s&lt;/P&gt;&lt;P&gt;30    abc     10   s&lt;/P&gt;&lt;P&gt;40   xyz     10   s&lt;/P&gt;&lt;P&gt;50   abc    50    s&lt;/P&gt;&lt;P&gt;30   xyz    50    s&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting the output as -&lt;/P&gt;&lt;P&gt;mat - qty &lt;/P&gt;&lt;P&gt;abc  10&lt;/P&gt;&lt;P&gt;abc  50&lt;/P&gt;&lt;P&gt;xyz  10&lt;/P&gt;&lt;P&gt;xyz  50&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I need as &lt;/P&gt;&lt;P&gt;abc 70 &lt;/P&gt;&lt;P&gt;xyz 70&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Balu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2007 16:40:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-line-operations-collect-statement/m-p/2752874#M640398</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-17T16:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Internal Table Line Operations - Collect Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-line-operations-collect-statement/m-p/2752875#M640399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Balu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want the qty to be added, I believe that the field in your internal table should be defined as a numeric field. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gilberto Li&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2007 16:48:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-line-operations-collect-statement/m-p/2752875#M640399</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-17T16:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Internal Table Line Operations - Collect Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-line-operations-collect-statement/m-p/2752876#M640400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Sep 2007 02:02:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-line-operations-collect-statement/m-p/2752876#M640400</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-25T02:02:03Z</dc:date>
    </item>
  </channel>
</rss>

