<?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: Problem with collect itab in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect-itab/m-p/3243239#M774090</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT matnr mjahr erfmg
INTO CORRESPONDING FIELDS OF itab1
FROM mseg
WHERE bwart = '501'.
  COLLECT itab1.
ENDSELECT.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Jan 2008 16:03:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-01-10T16:03:37Z</dc:date>
    <item>
      <title>Problem with collect itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect-itab/m-p/3243238#M774089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is wrong with my coding?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;BEGIN OF itab1 OCCURS 0,&lt;/P&gt;&lt;P&gt;     matnr  type mseg-matnr,&lt;/P&gt;&lt;P&gt;     mjahr type mseg-mjahr,&lt;/P&gt;&lt;P&gt;     erfmg type mseg-erfmg,&lt;/P&gt;&lt;P&gt;END OF   itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select MATNR MJAHR ERFMG&lt;/P&gt;&lt;P&gt;          into  corresponding fields of table itab1&lt;/P&gt;&lt;P&gt;          from mseg&lt;/P&gt;&lt;P&gt;         where bwart = '501'.&lt;/P&gt;&lt;P&gt;     collect itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought I get a sum per Jahr for each material. When I look into the itab I get more then one entry per year per material.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mat	Year	Sum&lt;/P&gt;&lt;P&gt;123 	2007	100&lt;/P&gt;&lt;P&gt;123	2007	009&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What am I doing wrong, I thought the collect sums it up?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2008 16:00:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect-itab/m-p/3243238#M774089</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-10T16:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with collect itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect-itab/m-p/3243239#M774090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT matnr mjahr erfmg
INTO CORRESPONDING FIELDS OF itab1
FROM mseg
WHERE bwart = '501'.
  COLLECT itab1.
ENDSELECT.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2008 16:03:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect-itab/m-p/3243239#M774090</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-10T16:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with collect itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect-itab/m-p/3243240#M774091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you have to put the "collect" into a loop, as it does not work on the entire table at once.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as in &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at itab into wa.
  collect wa into itab2.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you might also be able to get the desired result directly with the select by removing the "TABLE" addition and adding ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2008 16:05:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect-itab/m-p/3243240#M774091</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2008-01-10T16:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with collect itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect-itab/m-p/3243241#M774092</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;Write the select statement in between select and endselect if you are using collect statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you get the data into itab, do as below :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create another internal table and work area same as itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab into wa.&lt;/P&gt;&lt;P&gt;collect wa to itab2.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sriram Ponna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2008 16:05:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect-itab/m-p/3243241#M774092</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-10T16:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with collect itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect-itab/m-p/3243242#M774093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just as a side note, you may want to reconsider getting rid of the into corresponding fields and just send this into table Itab.  This will help you in performance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2008 16:09:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect-itab/m-p/3243242#M774093</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-10T16:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with collect itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect-itab/m-p/3243243#M774094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;stat. collect sums up all curr or quantities fields and it should be with in the loop.&lt;/P&gt;&lt;P&gt;it checks each and every record, if it matches with same record, its sums the curr/quantities to same record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT matnr mjahr erfmg&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF itab1&lt;/P&gt;&lt;P&gt;FROM mseg&lt;/P&gt;&lt;P&gt;WHERE bwart = '501'.&lt;/P&gt;&lt;P&gt;  COLLECT itab1.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2008 16:16:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect-itab/m-p/3243243#M774094</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-10T16:16:47Z</dc:date>
    </item>
  </channel>
</rss>

