<?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: prog  logic in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827153#M352769</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use COLLECT instead of APPEND when filling the itab..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Jan 2007 18:38:35 GMT</pubDate>
    <dc:creator>suresh_datti</dc:creator>
    <dc:date>2007-01-04T18:38:35Z</dc:date>
    <item>
      <title>prog  logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827152#M352768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have ainternal table with 4 fields....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;material quantity  field3      field4      &lt;/P&gt;&lt;P&gt;auv123   100  xxxxx  xxxx    &lt;/P&gt;&lt;P&gt;auv123   200  xxxxx xxxx     &lt;/P&gt;&lt;P&gt;auv111   100  xxxxx  xxxx    &lt;/P&gt;&lt;P&gt;auv123   400  xxxxx  xxxx   &lt;/P&gt;&lt;P&gt;auv111   200  xxxxx  xxxx   &lt;/P&gt;&lt;P&gt;auv222   100   xxxxx xxxx   &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;i nedd a simple logic to get a o/p table like:&lt;/P&gt;&lt;P&gt;o/p result:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;auv123  700  xxxxx xxxx &lt;/P&gt;&lt;P&gt;auv111  300  xxxxx xxxx &lt;/P&gt;&lt;P&gt;auv222 100  xxxxx  xxxx &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e I nedd to add QUANITY when MATERIAL number is same...and delete the extra rows...&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;data types:&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;material field is char &lt;/P&gt;&lt;P&gt;quantity fields is quan&lt;/P&gt;&lt;P&gt;other 2 fields( field 3 and field 4) in internal table are char and date type..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i need a simple logic for  it...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it may sound bit silly for you ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jan 2007 18:35:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827152#M352768</guid>
      <dc:creator>former_member611341</dc:creator>
      <dc:date>2007-01-04T18:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: prog  logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827153#M352769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use COLLECT instead of APPEND when filling the itab..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jan 2007 18:38:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827153#M352769</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2007-01-04T18:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: prog  logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827154#M352770</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;You can use collect statement and make sure you sort the internal table first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SORT ITAB1.

LOOP AT ITAB1.
  MOVE-CORRESPONDING ITAB1 TO ITAB2.
  COLLECT ITAB2.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ferry Lianto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jan 2007 18:39:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827154#M352770</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-04T18:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: prog  logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827155#M352771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Aday,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use &amp;lt;b&amp;gt;COLLECT&amp;lt;/b&amp;gt; statement to meet your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COLLECT statement will sum up all numeric fields when all other non-numeric fields are same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jan 2007 18:40:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827155#M352771</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-04T18:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: prog  logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827156#M352772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In order to get a sum of the materials, you need to have another internal table with just Material and qty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: begin of isum,
        matnr type mara-matnr,
        qty type mseg-menge,
        end of isum.

clear isum.  refresh isum.

loop at itab.
   isum-matnr = itab-matnr.
   isum-qty    = itab-qty.
   collect isum.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jan 2007 18:41:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827156#M352772</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-01-04T18:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: prog  logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827157#M352773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks for your quick responses...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here i have two other fields in the  internal table...which are type DATE and CHAR..&lt;/P&gt;&lt;P&gt;im gettin problem when im using COLLECT statement..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im using R/3 620 release...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jan 2007 18:51:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827157#M352773</guid>
      <dc:creator>former_member611341</dc:creator>
      <dc:date>2007-01-04T18:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: prog  logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827158#M352774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;then use SUM ie..&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
sort itab.
loop at itab.
at new matnr.
sum.
write: / itab-fld1,itab-fld2,itabfld3,itab-fld4.
endat.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jan 2007 18:54:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827158#M352774</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2007-01-04T18:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: prog  logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827159#M352775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Right,  you should try summing using another internal table,  loop at the first and COLLECT into the second, the second internal table will only have material and qty,  then when you want to know the total for material, you can simply read the ISUM internal table using the READ statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jan 2007 18:59:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827159#M352775</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-01-04T18:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: prog  logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827160#M352776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks guys for all your quick replies....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i  declared another table with only two fields...and used COLLECT statement...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then read the quantity and modified my original table after deleting adjacent duplicates..( as rich advised)...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;once again thanks...&lt;/P&gt;&lt;P&gt;points will be awarded...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jan 2007 19:40:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/prog-logic/m-p/1827160#M352776</guid>
      <dc:creator>former_member611341</dc:creator>
      <dc:date>2007-01-04T19:40:57Z</dc:date>
    </item>
  </channel>
</rss>

