<?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 Internal table looping in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-looping/m-p/3324989#M796477</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;I used the code &lt;/P&gt;&lt;P&gt;SELECT aufnr bwart SUM( erfmg ) INTO TABLE qty FROM mseg WHERE bwart = '101' OR bwart = '102' GROUP BY aufnr bwart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and im getting the output like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;order no             movementtype         quantity&lt;/P&gt;&lt;P&gt;1000400                   101                      5&lt;/P&gt;&lt;P&gt;1000400                   102                      2&lt;/P&gt;&lt;P&gt;1000401                    101                     10&lt;/P&gt;&lt;P&gt;1000402                    101                      4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i want the another output like this&lt;/P&gt;&lt;P&gt;if the same order no has both the movement type 101, 102&lt;/P&gt;&lt;P&gt;it should subtract the value &lt;/P&gt;&lt;P&gt;ie.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;order no           quantity&lt;/P&gt;&lt;P&gt;1000400             3 ( 5 - 2 )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;otherwise if it has only one movement type 101&lt;/P&gt;&lt;P&gt;i should get&lt;/P&gt;&lt;P&gt;order no            quantity&lt;/P&gt;&lt;P&gt;1000401              10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the over all output should be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;order no          quantity&lt;/P&gt;&lt;P&gt;1000400             3&lt;/P&gt;&lt;P&gt;1000401             10&lt;/P&gt;&lt;P&gt;1000402              4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please send me the logic coding for this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Azhar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Jan 2008 08:18:58 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-01-23T08:18:58Z</dc:date>
    <item>
      <title>Internal table looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-looping/m-p/3324989#M796477</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;I used the code &lt;/P&gt;&lt;P&gt;SELECT aufnr bwart SUM( erfmg ) INTO TABLE qty FROM mseg WHERE bwart = '101' OR bwart = '102' GROUP BY aufnr bwart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and im getting the output like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;order no             movementtype         quantity&lt;/P&gt;&lt;P&gt;1000400                   101                      5&lt;/P&gt;&lt;P&gt;1000400                   102                      2&lt;/P&gt;&lt;P&gt;1000401                    101                     10&lt;/P&gt;&lt;P&gt;1000402                    101                      4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i want the another output like this&lt;/P&gt;&lt;P&gt;if the same order no has both the movement type 101, 102&lt;/P&gt;&lt;P&gt;it should subtract the value &lt;/P&gt;&lt;P&gt;ie.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;order no           quantity&lt;/P&gt;&lt;P&gt;1000400             3 ( 5 - 2 )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;otherwise if it has only one movement type 101&lt;/P&gt;&lt;P&gt;i should get&lt;/P&gt;&lt;P&gt;order no            quantity&lt;/P&gt;&lt;P&gt;1000401              10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the over all output should be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;order no          quantity&lt;/P&gt;&lt;P&gt;1000400             3&lt;/P&gt;&lt;P&gt;1000401             10&lt;/P&gt;&lt;P&gt;1000402              4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please send me the logic coding for this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Azhar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2008 08:18:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-looping/m-p/3324989#M796477</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-23T08:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-looping/m-p/3324990#M796478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you should use control break command&lt;/P&gt;&lt;P&gt;AT NEW &amp;lt;ORDER NO.&amp;gt;&lt;/P&gt;&lt;P&gt;then u need to have logic of substraction of the movements&lt;/P&gt;&lt;P&gt;then write statement.&lt;/P&gt;&lt;P&gt;ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PLZ REWARD IF USEFUL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards &lt;/P&gt;&lt;P&gt;vivek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2008 08:27:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-looping/m-p/3324990#M796478</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-23T08:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-looping/m-p/3324991#M796479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Azhar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at first.&lt;/P&gt;&lt;P&gt;gv_orderno = itab-orderno.&lt;/P&gt;&lt;P&gt;gv_quantity = itab-quantity.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;at new movementtype.&lt;/P&gt;&lt;P&gt;if itab-orderno. = gv_orderno.&lt;/P&gt;&lt;P&gt;itab1-quantity = itab-quantity-gv_quantity.&lt;/P&gt;&lt;P&gt;itab1-movementtype = itab-movementtype.&lt;/P&gt;&lt;P&gt;itab1-orderno. = itab-orderno.&lt;/P&gt;&lt;P&gt;append itab1.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;clear gv_orderno., quantity.&lt;/P&gt;&lt;P&gt;gv_orderno = itab-orderno.&lt;/P&gt;&lt;P&gt;gv_quantity = itab-quantity.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont know if this code helps..pls try this way..iam in a hurry..best of luck mate..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Shakir&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2008 08:30:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-looping/m-p/3324991#M796479</guid>
      <dc:creator>abdulazeez12</dc:creator>
      <dc:date>2008-01-23T08:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-looping/m-p/3324992#M796480</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;Follow this thread&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="4658750"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Satish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2008 08:34:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-looping/m-p/3324992#M796480</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-23T08:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-looping/m-p/3324993#M796481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;declare 2 variables a(1) type c,b like menge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort qty by aufnr bwart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at qty.&lt;/P&gt;&lt;P&gt;at end of bwart.       "(means at end of aufnr bwart combi)&lt;/P&gt;&lt;P&gt;if a = 'X'.&lt;/P&gt;&lt;P&gt;move qty-menge to b.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;subtract b from qty-menge.&lt;/P&gt;&lt;P&gt;endif. &lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;at new aufnr.&lt;/P&gt;&lt;P&gt;clear: a,b.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;modift qty.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2008 08:45:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-looping/m-p/3324993#M796481</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-23T08:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-looping/m-p/3324994#M796482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;AZAR,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Ex :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have internal table itab having the below records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;order no movementtype quantity&lt;/P&gt;&lt;P&gt;1000400 101 5&lt;/P&gt;&lt;P&gt;1000400 102 2&lt;/P&gt;&lt;P&gt;1000401 101 10&lt;/P&gt;&lt;P&gt;1000402 101 4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : v_num type i ,&lt;/P&gt;&lt;P&gt;           v_char&lt;/P&gt;&lt;P&gt;SORT itab BY  order no movementtype decending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab. &lt;/P&gt;&lt;P&gt;   v_num =  v_num + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; IF v_num &amp;gt; 1. &lt;/P&gt;&lt;P&gt;  ON CHANGE OF itab-order no.     &lt;/P&gt;&lt;P&gt;    v_char = 'X'.     &lt;/P&gt;&lt;P&gt;   ENDON.&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;IF v_char NE 'X'.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;   itab-order no = v_num -itab-order no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  MODIFY itab transporting order no.&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't forget to reward if useful.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2008 08:46:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-looping/m-p/3324994#M796482</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-23T08:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-looping/m-p/3324995#M796483</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 requirement can be done using Conrol statements only. Initialy get the data from MSEG table into internal table (itab) and use control statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Check the below logic:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT aufnr bwart erfmg  INTO TABLE itab FROM mseg WHERE bwart = '101' OR bwart = '102' .&lt;/P&gt;&lt;P&gt;Sort itab BY aufnr  bwart. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at itab.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  AT NEW bwart.&lt;/P&gt;&lt;P&gt;     If  itab-bwart  = :101:.&lt;/P&gt;&lt;P&gt;          sum = sum + itab-erfmg.&lt;/P&gt;&lt;P&gt;     else.&lt;/P&gt;&lt;P&gt;         sum = sum - itab-erfmg.&lt;/P&gt;&lt;P&gt;     endif.&lt;/P&gt;&lt;P&gt;  END AT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  AT END OF aufnr.&lt;/P&gt;&lt;P&gt;     itab1-aufnr =  itab-aufnr.&lt;/P&gt;&lt;P&gt;     itab1-qty = sum.&lt;/P&gt;&lt;P&gt;     Append itab1.&lt;/P&gt;&lt;P&gt;     Clear: itab1, sum.&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2008 08:47:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-looping/m-p/3324995#M796483</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-23T08:47:34Z</dc:date>
    </item>
  </channel>
</rss>

