<?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 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350778#M1838115</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Alexander,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you should read the following guideline on COLLECT - &lt;A href="http://help.sap.com/abapdocu_740/en/abencollect_guidl.htm" title="http://help.sap.com/abapdocu_740/en/abencollect_guidl.htm"&gt;ABAP Keyword Documentation&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you think about the semantics of the COLLECT statement, you'll also agree that it should be used on HASHED tables(ideally) or SORTED tables(with unique primary key).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 May 2014 12:47:26 GMT</pubDate>
    <dc:creator>SuhaSaha</dc:creator>
    <dc:date>2014-05-15T12:47:26Z</dc:date>
    <item>
      <title>problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350769#M1838106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: 1em; font-size: 14px; color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;Hello to all!&lt;/P&gt;&lt;P style="margin-bottom: 1em; font-size: 14px; color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;In sap I have a table, there are rows with the same name but with different quantity. I want to summarize this rows like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #575757; font-family: 'courier new', courier;"&gt;SELECT&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #575757; font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; c~aufnr&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #575757; font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; p~matnr p~bdter p~meins p~baugr p~dbskz p~erfmg p~aufnr&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #575757; font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; f~maktx&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #575757; font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO CORRESPONDING FIELDS OF TABLE it_tab&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #575757; font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM&amp;nbsp; afpo AS c&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #575757; font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INNER JOIN resb AS p ON c~aufnr = p~aufnr&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #575757; font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INNER JOIN makt AS f ON p~matnr = f~matnr.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #575757; font-family: 'courier new', courier;"&gt; loop at it_tab into fs_tab.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #575757; font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; collect fs_tab into it_tab_collected.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #575757; font-family: 'courier new', courier;"&gt; endloop.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757; font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; it_tab = it_tab_collected.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; font-size: 14px; color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;But in this case it sums only absolutelly identically rows. I need to sum up rows only with the same name.&lt;/P&gt;&lt;P style="margin-bottom: 1em; font-size: 14px; color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;How can I achieve this?&lt;/P&gt;&lt;P style="margin-bottom: 1em; font-size: 14px; color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;Regards, Alexander.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 11:32:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350769#M1838106</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-14T11:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350770#M1838107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Are both fields having the primary key?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 11:54:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350770#M1838107</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-14T11:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350771#M1838108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The meaning of collect statement is.. it inserts the contents of a work area &lt;STRONG style="font-size: 10pt; font-family: 'Courier New';"&gt;wa&lt;/STRONG&gt; either as single row into an internal table &lt;STRONG style="font-size: 10pt; font-family: 'Courier New';"&gt;itab&lt;/STRONG&gt; or adds the values of its numeric components to the corresponding values of existing rows with the same key.&lt;/P&gt;&lt;P&gt;if want to add fields with same name then use&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 10pt; font-family: 'Courier New';"&gt;ADD-CORRESPONDING struc1 TO struc2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 10pt; font-family: 'Courier New';"&gt;All components of the same name in &lt;STRONG style="font-size: 10pt; font-family: 'Courier New';"&gt;struc1&lt;/STRONG&gt; and &lt;STRONG style="font-size: 10pt; font-family: 'Courier New';"&gt;struct2&lt;/STRONG&gt; are added in pairs and the result is assigned to the respective component of &lt;STRONG style="font-size: 10pt; font-family: 'Courier New';"&gt;struct2&lt;/STRONG&gt;.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 10pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;tejas&lt;/SPAN&gt;&lt;STRONG style="font-size: 10pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 12:03:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350771#M1838108</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-14T12:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350772#M1838109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i dont think that the collect statement will check the name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;of the fields before summing up. it will sum the numeric fields in the given itab only if the itab and wa has the same type and considers the keys in case of sorted and hashed table(it will sum only the non unique keys if the unique keys have the same values)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which field field are you trying to summarize here &lt;STRONG&gt;ERFMG?&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 12:05:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350772#M1838109</guid>
      <dc:creator>former_member183073</dc:creator>
      <dc:date>2014-05-14T12:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350773#M1838110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thats right I try to sum ERFMG. So in to my table i can select only numeric fields?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 12:20:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350773#M1838110</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-14T12:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350774#M1838111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alex,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes. Using collect will add up only the numeric fields in the workarea whose key fields matches with the row already in the internal table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Abijith&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 12:24:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350774#M1838111</guid>
      <dc:creator>former_member196651</dc:creator>
      <dc:date>2014-05-14T12:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350775#M1838112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;Yes, you can sum up only numeric fields on the basis of all common character fields&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Tejas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 12:24:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350775#M1838112</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-14T12:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350776#M1838113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the collect statement will sum only the numeric fields, i think aufnr and matnr will make a unique key in your table, if right, declare it_tab_collected as sorted table with unique key aufnr matnr. then use collect statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i think that should work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 12:29:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350776#M1838113</guid>
      <dc:creator>former_member183073</dc:creator>
      <dc:date>2014-05-14T12:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350777#M1838114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Agree with Syed. U need to check the Aufnr and Matnr to be same. Let us know&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 12:12:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350777#M1838114</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-15T12:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350778#M1838115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Alexander,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you should read the following guideline on COLLECT - &lt;A href="http://help.sap.com/abapdocu_740/en/abencollect_guidl.htm" title="http://help.sap.com/abapdocu_740/en/abencollect_guidl.htm"&gt;ABAP Keyword Documentation&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you think about the semantics of the COLLECT statement, you'll also agree that it should be used on HASHED tables(ideally) or SORTED tables(with unique primary key).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 12:47:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350778#M1838115</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2014-05-15T12:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350779#M1838116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alex,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Please refer below code....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="qtext"&gt;DATA: BEGIN OF seats, &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; carrid&amp;nbsp;&amp;nbsp; TYPE sflight-carrid, &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; connid&amp;nbsp;&amp;nbsp; TYPE sflight-connid, &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; seatsocc TYPE sflight-seatsocc, &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END OF seats. &lt;BR /&gt;&lt;BR /&gt;DATA seats_tab LIKE HASHED TABLE OF seats &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WITH UNIQUE KEY carrid connid. &lt;BR /&gt;&lt;BR /&gt;SELECT carrid connid seatsocc &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM sflight &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO seats. &lt;BR /&gt;&amp;nbsp; COLLECT seats INTO seats_tab. &lt;BR /&gt;ENDSELECT. &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="qtext"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="qtext"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="qtext"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="qtext"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="qtext"&gt;&amp;nbsp; Thangam.P&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 12:56:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/10350779#M1838116</guid>
      <dc:creator>thangam_perumal</dc:creator>
      <dc:date>2014-05-15T12:56:09Z</dc:date>
    </item>
  </channel>
</rss>

