<?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: Small and simple code required in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264691#M491287</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;  Collect will work for Quantity fields also. So, you can go ahead with Max's logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sailaja.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 May 2007 09:26:22 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-15T09:26:22Z</dc:date>
    <item>
      <title>Small and simple code required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264683#M491279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;I have following requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal table ITAB1 contains following values(ITAB1 is Sorted on F1,F2,F3)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;F1	F2	F3	F4&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------" /&gt;&lt;P&gt;1	2	2	10&lt;/P&gt;&lt;P&gt;1	2	2	20&lt;/P&gt;&lt;P&gt;1	2	2	15&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1	3	4	18&lt;/P&gt;&lt;P&gt;1	3	4	2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2	3	5	10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And Resultant ITAB2 must contain below values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;F1	F2	F3	F4&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------" /&gt;&lt;P&gt;1	2	2	45&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1	3	4	20&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2	3	5	10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(i.e The column F4 contains SUM of records having similar F1 F2 and F3)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can any body provide me with the code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points will be surely given..&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2007 09:01:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264683#M491279</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-15T09:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: Small and simple code required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264684#M491280</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;Use COLLECT statament: if there isn't a record with the same key it'll append the record else it'all update only the numeric fields calculating the total.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT ITAB1.
  ITAB2-F1 = ITAB1-F1.
  ITAB2-F2 = ITAB1-F2.
  ITAB2-F3 = ITAB1-F3.
  
  ITAB2-F4 = ITAB1-F4.
  COLLECT ITAB2.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fields F1, F2 and F3 of ITAB2 has to be char, in this way the system'll calculate the sum for field F4 only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2007 09:03:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264684#M491280</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-15T09:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: Small and simple code required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264685#M491281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;COLLECT [wa INTO] itab. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you append the records in to the internal table,&lt;/P&gt;&lt;P&gt;use can use COLLECT stmts&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2007 09:08:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264685#M491281</guid>
      <dc:creator>Bema</dc:creator>
      <dc:date>2007-05-15T09:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Small and simple code required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264686#M491282</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;Try this logic:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at itab.

at new f3. "assumed itab sorted on f1 f2 f3.
vf1 = itab-f1.
vf2 = itab-f2.
vf3 = itab-f3.
sum.
vf4 = itab-f4.

insert into itab2 values (vf1 vf2 vf3 vf4).
endat.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jogdand M B&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2007 09:08:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264686#M491282</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-15T09:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: Small and simple code required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264687#M491283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi tulip,&lt;/P&gt;&lt;P&gt;do you need the sum for the field f1 f2 f3 in f4 ..then it can be done this way..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: v_var type i.&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;v_var = iab1-f1 + itab1-f2 + itab1-f3.&lt;/P&gt;&lt;P&gt;itab1-f4 = v_var.&lt;/P&gt;&lt;P&gt;modify itab1 transporting f4.&lt;/P&gt;&lt;P&gt;clear v_var.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Repeat the same for itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you want to delete the duplicate entries then use &lt;/P&gt;&lt;P&gt;SORT itab1 by f1 f2 f3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jayant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2007 09:09:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264687#M491283</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-15T09:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: Small and simple code required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264688#M491284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Max&lt;/P&gt;&lt;P&gt;Thanks for the suggestion&lt;/P&gt;&lt;P&gt;But the Collect works with Numeric fields &lt;/P&gt;&lt;P&gt;But in my ITAB1 field F4 is a Quantity type field..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please consider this...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2007 09:10:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264688#M491284</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-15T09:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Small and simple code required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264689#M491285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;TAKE ITAB2 LIKE ITAB1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE ITAB2 WITH KEY F1 = ITAB1-F1 F2 = ITAB1-F2 F3 = ITAB1-F3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;ITAB2-F4 = ITAB1-F4 + ITAB2-F4.&lt;/P&gt;&lt;P&gt;MODIFY ITAB2 INDEX SY-TABIX.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;MOVE-CORRESPONDING ITAB1 TO ITAB2.&lt;/P&gt;&lt;P&gt;APPEND ITAB2.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HERE BOTH INT TABLE WITH HEADER LINE IF YOU HAVE WITHOUT HEADER LINE YOU HAVE TO USE WORK AREA TO DO ALL THE OPERATION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REGARDS&lt;/P&gt;&lt;P&gt;SHIBA DUTTA&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2007 09:11:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264689#M491285</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-15T09:11:07Z</dc:date>
    </item>
    <item>
      <title>Re: Small and simple code required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264690#M491286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Shiba Let me check with your suggestion...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2007 09:24:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264690#M491286</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-15T09:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: Small and simple code required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264691#M491287</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;  Collect will work for Quantity fields also. So, you can go ahead with Max's logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sailaja.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2007 09:26:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264691#M491287</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-15T09:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: Small and simple code required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264692#M491288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your problem can solve with using AT NEW.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First u will first fill all values into ITAB1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at ITAB1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT NEW ITAB1-f1,f2,f3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;collect itab-f4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it will work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please give points if it is works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2007 10:18:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/small-and-simple-code-required/m-p/2264692#M491288</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-15T10:18:32Z</dc:date>
    </item>
  </channel>
</rss>

