<?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: collect statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/5562278#M1269113</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use it..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 May 2009 11:15:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-05-13T11:15:01Z</dc:date>
    <item>
      <title>collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/5562274#M1269109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My requirement is that i have one internal table from which if date is same for suppose 2 records,&lt;/P&gt;&lt;P&gt;that corresponding columns get added.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can i use colllect statement for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PLz suggest.&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2009 11:08:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/5562274#M1269109</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-13T11:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/5562275#M1269110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you can use the collect statement If an entry with the same key already exists, the COLLECT statement does not append a new line, but adds the contents of the numeric fields in the work area to the contents of the numeric fields in the existing entry&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2009 11:10:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/5562275#M1269110</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-13T11:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/5562276#M1269111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have only date as key field you can use COLLECT to add all the numeric fields. But if you have a key field other than date it will only collect for lines which is having similiar key fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eg:-&lt;/P&gt;&lt;P&gt;Date        Qty&lt;/P&gt;&lt;P&gt;20090513 100&lt;/P&gt;&lt;P&gt;20090513 200&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After Collect u will get&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;20090513 300&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But for the following scenario&lt;/P&gt;&lt;P&gt;Date       Co.Code Qty&lt;/P&gt;&lt;P&gt;20090513 IN01 100&lt;/P&gt;&lt;P&gt;20090513 IN02 200&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After collect the output will be same because the key fields are different&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2009 11:13:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/5562276#M1269111</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-13T11:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/5562277#M1269112</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;Prerequisite for the use of collect is that work area is compatible with the row type of internal table to which we are appending the data and all components that are not part of the table key must have a numeric data type (i, p, f). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if there is only date column and rest all the column are of data type (i, p ,f) in your internal table then you can go for collect. Else its better you use the control statement AT New and At end of.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nikhil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2009 11:14:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/5562277#M1269112</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-13T11:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/5562278#M1269113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use it..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2009 11:15:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/5562278#M1269113</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-13T11:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/5562279#M1269114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Following Sample Code will help you in this way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: BEGIN OF ty_it,
  key TYPE i,
  amount TYPE i,
  END OF ty_it.

DATA: it TYPE STANDARD TABLE OF ty_it WITH HEADER LINE WITH KEY key.
DATA: it2 TYPE STANDARD TABLE OF ty_it WITH HEADER LINE WITH KEY key.

it-key = 1. it-amount = 12. APPEND it.
it-key = 1. it-amount = 12. APPEND it.
it-key = 1. it-amount = 12. APPEND it.
it-key = 2. it-amount = 12. APPEND it.

LOOP AT it.
  COLLECT it INTO it2.
ENDLOOP.

LOOP AT it2.
  WRITE: / it2-key, it2-amount.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Faisal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2009 11:17:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/5562279#M1269114</guid>
      <dc:creator>faisalatsap</dc:creator>
      <dc:date>2009-05-13T11:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/5562280#M1269115</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;Yes you can use it for the Quantity and Currency fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For that..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: itab type standard table of structure1.
data: ctab type standard table of structure1.
data: wa type structure1.

fill the itab with select query.

now..
loop at itab into wa.
 collect wa into ctab.
 clear wa.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thats it, Now your ctab contains required data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naveen I&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2009 11:17:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/5562280#M1269115</guid>
      <dc:creator>naveen_inuganti2</dc:creator>
      <dc:date>2009-05-13T11:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/5562281#M1269116</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;To know how collect statement works, refer to this link..http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb36d5358411d1829f0000e829fbfe/content.htm&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2009 11:21:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/5562281#M1269116</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-13T11:21:58Z</dc:date>
    </item>
  </channel>
</rss>

