<?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 Regarding SUM in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-sum/m-p/6660752#M1446246</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Scenario is i have the internal table with the fallowing data&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;      GPID            Name        Invoice_ID       Total_Amount         Subsidy_Amount&lt;/P&gt;&lt;P&gt;  123456          david          1234567          12344                      12356&lt;/P&gt;&lt;P&gt; 132564           john            2536498          32568                      12456&lt;/P&gt;&lt;P&gt; 123456           david          135648            36958                       5689&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here if we have Same GPID then i need to sum the record and append this record into another internal table as single record as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GPID           Name              Invoice_ID                 Total_Amount                Subsidy_Amount&lt;/P&gt;&lt;P&gt;123456        david           1234567/135648     49302                               18045&lt;/P&gt;&lt;P&gt; 132564           john            2536498               32568                               12456&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like this i need to do, here i have done &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT GT_DATA INTO LS_DATA.&lt;/P&gt;&lt;P&gt;            MOVE: LS_DATA-GPID TO LS_DATA1-GPID,&lt;/P&gt;&lt;P&gt;                  LS_DATA-TP_NAME TO LS_DATA1-TP_NAME,&lt;/P&gt;&lt;P&gt;                  LS_DATA-INV_ID TO  ls_data1-inv_id.&lt;/P&gt;&lt;P&gt;        AT END OF GPID.&lt;/P&gt;&lt;P&gt;           SUM .&lt;/P&gt;&lt;P&gt;          MOVE: LS_DATA-TOT_INV_AMOUNT TO  LS_DATA1-TOT_INV_AMOUNT,&lt;/P&gt;&lt;P&gt;          LS_DATA-TOT_SUB_AMOUNT TO  LS_DATA1-TOT_SUB_AMOUNT.&lt;/P&gt;&lt;P&gt;          APPEND LS_DATA1 TO GT_data1.&lt;/P&gt;&lt;P&gt;          ENDAT.&lt;/P&gt;&lt;P&gt;          ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but with this code the invoice_id i am getting as a single value only but i required as mentioned above 1234567/135648.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please correct my code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Mar 2010 10:20:59 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-03-17T10:20:59Z</dc:date>
    <item>
      <title>Regarding SUM</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-sum/m-p/6660752#M1446246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Scenario is i have the internal table with the fallowing data&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;      GPID            Name        Invoice_ID       Total_Amount         Subsidy_Amount&lt;/P&gt;&lt;P&gt;  123456          david          1234567          12344                      12356&lt;/P&gt;&lt;P&gt; 132564           john            2536498          32568                      12456&lt;/P&gt;&lt;P&gt; 123456           david          135648            36958                       5689&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here if we have Same GPID then i need to sum the record and append this record into another internal table as single record as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GPID           Name              Invoice_ID                 Total_Amount                Subsidy_Amount&lt;/P&gt;&lt;P&gt;123456        david           1234567/135648     49302                               18045&lt;/P&gt;&lt;P&gt; 132564           john            2536498               32568                               12456&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like this i need to do, here i have done &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT GT_DATA INTO LS_DATA.&lt;/P&gt;&lt;P&gt;            MOVE: LS_DATA-GPID TO LS_DATA1-GPID,&lt;/P&gt;&lt;P&gt;                  LS_DATA-TP_NAME TO LS_DATA1-TP_NAME,&lt;/P&gt;&lt;P&gt;                  LS_DATA-INV_ID TO  ls_data1-inv_id.&lt;/P&gt;&lt;P&gt;        AT END OF GPID.&lt;/P&gt;&lt;P&gt;           SUM .&lt;/P&gt;&lt;P&gt;          MOVE: LS_DATA-TOT_INV_AMOUNT TO  LS_DATA1-TOT_INV_AMOUNT,&lt;/P&gt;&lt;P&gt;          LS_DATA-TOT_SUB_AMOUNT TO  LS_DATA1-TOT_SUB_AMOUNT.&lt;/P&gt;&lt;P&gt;          APPEND LS_DATA1 TO GT_data1.&lt;/P&gt;&lt;P&gt;          ENDAT.&lt;/P&gt;&lt;P&gt;          ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but with this code the invoice_id i am getting as a single value only but i required as mentioned above 1234567/135648.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please correct my code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Mar 2010 10:20:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-sum/m-p/6660752#M1446246</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-17T10:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding SUM</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-sum/m-p/6660753#M1446247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try as following&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT GT_DATA INTO LS_DATA.
MOVE: LS_DATA-GPID         TO LS_DATA1-GPID,
            LS_DATA-TP_NAME TO LS_DATA1-TP_NAME,
            LS_DATA-INV_ID      TO ls_data1-inv_id,
            LS_DATA-TOT_INV_AMOUNT TO LS_DATA1-TOT_INV_AMOUNT,
            LS_DATA-TOT_SUB_AMOUNT TO LS_DATA1-TOT_SUB_AMOUNT.
  COLLECT LS_DATA1 INTO GT_data1.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Mar 2010 10:26:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-sum/m-p/6660753#M1446247</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-17T10:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding SUM</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-sum/m-p/6660754#M1446248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kumar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Keep concatneating the invoice_id separated by a / into a temporary variable. This statement should be a line above AT END OF GPID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After SUM with the move statements move this temp variable to the LS_DATA-invoice_id. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After Append statement, clear the temporary variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Mani&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Mar 2010 10:28:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-sum/m-p/6660754#M1446248</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-17T10:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding SUM</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-sum/m-p/6660755#M1446249</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;If i use Collect statement it will sum the Invoice Numbers also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i need the Invoice Numbers to Display as 123456/25638 as two invoice numbers if we collect the two records.&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;kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Mar 2010 10:30:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-sum/m-p/6660755#M1446249</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-17T10:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding SUM</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-sum/m-p/6660756#M1446250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of using at end and append, use collect only. That way, records with the same key will be summed in the new table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Mar 2010 10:32:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-sum/m-p/6660756#M1446250</guid>
      <dc:creator>PedroGuarita</dc:creator>
      <dc:date>2010-03-17T10:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding SUM</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-sum/m-p/6660757#M1446251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, so you want to concatenate all invoice_id of the same group_id and sum the value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's a bit strange, as the invoice_id field will have to be of an undetermined size, so you better use a char type field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for the code, it's not as clear cut as that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at table1.
  read table2 with key group_id = table1-group_id.
  if sy-subrc = 0.
    concatenate table2-invoice_id '/' table1-invoice_id into table2-invoice_id.
    table2-value = table2-value + table1-value.
    modify table2.
  else.
     table2-group_id = table1-group_id.
     table2-invoice_id = table1-invoice_id.
     table2-value = table1-value.
     append table2.
  endif.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like this will do.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Mar 2010 10:39:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-sum/m-p/6660757#M1446251</guid>
      <dc:creator>PedroGuarita</dc:creator>
      <dc:date>2010-03-17T10:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding SUM</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-sum/m-p/6660758#M1446252</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;If i use Collect statement it will sum the Invoice Numbers also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i need the Invoice Numbers to Display as 123456/25638 as two invoice numbers if we collect the two records.&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;kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Mar 2010 12:06:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-sum/m-p/6660758#M1446252</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-17T12:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding SUM</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-sum/m-p/6660759#M1446253</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;Not sure if you noticed my earlier message, this shud work i suppose.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT GT_DATA INTO LS_DATA.
MOVE: LS_DATA-GPID TO LS_DATA1-GPID,
LS_DATA-TP_NAME TO LS_DATA1-TP_NAME,
LS_DATA-INV_ID TO ls_data1-inv_id.
CONCATENATE  GT_DATA-INVOICE_ID '/' TEMP_VAR INTO TEMP_VAR.
AT END OF GPID.
SUM .
MOVE: LS_DATA-TOT_INV_AMOUNT TO LS_DATA1-TOT_INV_AMOUNT,
LS_DATA-TOT_SUB_AMOUNT TO LS_DATA1-TOT_SUB_AMOUNT.
MOVE TEMP_VAR into LS_DATA-invoice_id.
APPEND LS_DATA1 TO GT_data1.
CLEAR TEMP_VAR.
ENDAT.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THanks&lt;/P&gt;&lt;P&gt;Mani&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Mar 2010 14:30:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-sum/m-p/6660759#M1446253</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-17T14:30:02Z</dc:date>
    </item>
  </channel>
</rss>

