<?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 in internal table calculation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-internal-table-calculation/m-p/4455356#M1056176</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;By Sakthi sri&lt;/P&gt;&lt;P&gt;thanks for your immediate response venkatesh.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;r u asking me to take g_1 and g_2 for person A and B. here i have given an example showing 2 persons alone. but i need to calculate for 1000's of person. in that case what i should do?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz guide me...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By Venkatesh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am sorry to mis guide you with the two variable called G_1 and g_2.  there is no use at all for these variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What ever may be number of persons in the list. I mean they are not effecting the logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for eg Persons from 1 to 100 or 1 to 1000 what ever it is the logic will work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Venkatesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Sep 2008 14:44:56 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-09-04T14:44:56Z</dc:date>
    <item>
      <title>problem in internal table calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-internal-table-calculation/m-p/4455350#M1056170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i have internal table values as follows ( for eg.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;person          month                  amount1                amount2 &lt;/P&gt;&lt;P&gt;     &lt;/P&gt;&lt;P&gt;A                   jan                     rs.500(1)                       rs.1000 (3)&lt;/P&gt;&lt;P&gt;A                  feb                       rs.500   (2)                   rs.1000&lt;/P&gt;&lt;P&gt;B                  jan                       rs.1000(1)                 rs.2000(4)&lt;/P&gt;&lt;P&gt;B                  feb                       rs.1500(2)                 rs.2000&lt;/P&gt;&lt;P&gt;B                  mar                       rs.1000(3)                rs.1000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i need to total the values - total = 1&lt;EM&gt;2&lt;/EM&gt;3+4 and populate to another table as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;person          amount&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A                   1&lt;EM&gt;2&lt;/EM&gt;3 so the value will be 2000&lt;/P&gt;&lt;P&gt;B                   1&lt;EM&gt;2&lt;/EM&gt;3+4 the value will be 5500.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have written the code using AT NEW AND AT END OF... but i need to work it with IF condition... so plz help me in this regard...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;removed_by_moderator&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Julius Bussche on Sep 5, 2008 7:55 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2008 15:04:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-internal-table-calculation/m-p/4455350#M1056170</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-03T15:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: problem in internal table calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-internal-table-calculation/m-p/4455351#M1056171</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;&lt;/P&gt;&lt;P&gt;Use the logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;person month amount1 amount2 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A jan rs.500(1) rs.1000 (3)&lt;/P&gt;&lt;P&gt;A feb rs.500 (2) rs.1000&lt;/P&gt;&lt;P&gt;B jan rs.1000(1) rs.2000(4)&lt;/P&gt;&lt;P&gt;B feb rs.1500(2) rs.2000&lt;/P&gt;&lt;P&gt;B mar rs.1000(3) rs.1000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sort it on person.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;take temporary variables for Person.&lt;/P&gt;&lt;P&gt;g_1 and g_2.&lt;/P&gt;&lt;P&gt;g_var is for the amount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop on itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MOve itab-peson to g_1.&lt;/P&gt;&lt;P&gt;g_index  = sY-tabix + 1.&lt;/P&gt;&lt;P&gt;read itab into wa index g_index.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0 and wa-person = itab-person.&lt;/P&gt;&lt;P&gt;  g_var = amount 1 + amount2 + g_var.&lt;/P&gt;&lt;P&gt;elseif sy-subrc eq 0 and wa-person NE itab-person.&lt;/P&gt;&lt;P&gt;  append a new record.&lt;/P&gt;&lt;P&gt; clear: g_var.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;  append a new record with the data&lt;/P&gt;&lt;P&gt; clear: g_var.&lt;/P&gt;&lt;P&gt;endif.&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;Regards,&lt;/P&gt;&lt;P&gt;Venkatesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2008 15:13:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-internal-table-calculation/m-p/4455351#M1056171</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-03T15:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: problem in internal table calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-internal-table-calculation/m-p/4455352#M1056172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks for your immediate response venkatesh.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;r u asking me to take g_1 and g_2 for person A and B. here i have given an example showing 2 persons alone. but i need to calculate for 1000's of person. in that case what i should do?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz guide me...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sri.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2008 15:24:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-internal-table-calculation/m-p/4455352#M1056172</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-03T15:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: problem in internal table calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-internal-table-calculation/m-p/4455353#M1056173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;As i see the requirement,&lt;/P&gt;&lt;P&gt;You need the sum of &lt;/P&gt;&lt;P&gt;total for the amount1 for each person&lt;/P&gt;&lt;P&gt;and amount2 for first month&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Loop at itab into wa

at new person.
clear amt1.
v_amt2 = wa-amount2. "ONLY FIRST RECORD
endat.
v_amt1 = wa_amount1 + v_amt1 . "EACH TIME

at end of person.
tot_amount = v_amt1 + v_amt2 .
clear  : v_amt1 ,v_amt2 .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 14:25:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-internal-table-calculation/m-p/4455353#M1056173</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-04T14:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: problem in internal table calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-internal-table-calculation/m-p/4455354#M1056174</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;something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SORT itab.
LOOP AT itab INTO wa.
wa_temp = wa. "because of the control break statements
AT FIRST person.
total = total + wa_temp-amount2. "amount2 only needed if first line for person
ENDAT.
total = total + wa-amount1. "amount1 always needed
AT LAST person.
APPEND total TO itab2. "last line of person =&amp;gt; data into another internal table
CLEAR total.
ENDAT.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;ec&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 14:32:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-internal-table-calculation/m-p/4455354#M1056174</guid>
      <dc:creator>JozsefSzikszai</dc:creator>
      <dc:date>2008-09-04T14:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: problem in internal table calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-internal-table-calculation/m-p/4455355#M1056175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shakthi,&lt;/P&gt;&lt;P&gt;Its very simple. I hope u have the records in internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just Sort the table by person.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab INTO wa.&lt;/P&gt;&lt;P&gt;AT END OF person.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SUM.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CLEAR l_sum.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;l_sum  = wa-amount1 + wa-amount2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;WRITE: /1 wa-person, l_sum.&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;Thanks,&lt;/P&gt;&lt;P&gt;Vinod.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 14:43:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-internal-table-calculation/m-p/4455355#M1056175</guid>
      <dc:creator>vinod_vemuru2</dc:creator>
      <dc:date>2008-09-04T14:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: problem in internal table calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-internal-table-calculation/m-p/4455356#M1056176</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;By Sakthi sri&lt;/P&gt;&lt;P&gt;thanks for your immediate response venkatesh.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;r u asking me to take g_1 and g_2 for person A and B. here i have given an example showing 2 persons alone. but i need to calculate for 1000's of person. in that case what i should do?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz guide me...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By Venkatesh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am sorry to mis guide you with the two variable called G_1 and g_2.  there is no use at all for these variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What ever may be number of persons in the list. I mean they are not effecting the logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for eg Persons from 1 to 100 or 1 to 1000 what ever it is the logic will work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Venkatesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 14:44:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-internal-table-calculation/m-p/4455356#M1056176</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-04T14:44:56Z</dc:date>
    </item>
  </channel>
</rss>

