<?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: Control Break statements logic in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements-logic/m-p/1649362#M288672</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not so difficult... Use COLLECT Statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Collect statement adds all the numeric fields for which the non-numeric fields are common..&lt;/P&gt;&lt;P&gt;consider this example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field1(Type C)     Field2(Type C)     Field3(Type N or any type that can be summed)&lt;/P&gt;&lt;P&gt;  A1                          B1                  5&lt;/P&gt;&lt;P&gt;  A1                          B1                  3&lt;/P&gt;&lt;P&gt;  A2                          B1                  7&lt;/P&gt;&lt;P&gt;  A2                          B2                  4&lt;/P&gt;&lt;P&gt;  A2                          B1                  2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loot at ITAB_1 into WA.&lt;/P&gt;&lt;P&gt;   collect wa into ITAB_2&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the ITAB_2 will look like this :        A1            B1      8&lt;/P&gt;&lt;P&gt;                                                          A2            B1      9&lt;/P&gt;&lt;P&gt;                                                          A2            B2      4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what you want right.... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note : If the tax(%) field is type p.. it will be added... so u store it in a temp internal table with type c so that it does not adds up...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this works... If it doesnt tell me.. I will explain in detail... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS : Do F1 on collect and see if my explanation is not clear. Believe me this is the easiest way to do this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And Plz reward points if you think your problem is answered.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Varun Verma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Nov 2006 05:16:11 GMT</pubDate>
    <dc:creator>former_member69765</dc:creator>
    <dc:date>2006-11-16T05:16:11Z</dc:date>
    <item>
      <title>Control Break statements logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements-logic/m-p/1649359#M288669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Consider table ITAB with three fields BELNR, TAX and AMOUNT. The body has the following records.&lt;/P&gt;&lt;P&gt;BELNR	TAX(%)	AMOUNT&lt;/P&gt;&lt;P&gt;doc1	12.5	1500&lt;/P&gt;&lt;P&gt;doc2 	10.0	2000&lt;/P&gt;&lt;P&gt;doc3	10.0	2100&lt;/P&gt;&lt;P&gt;doc4 	11.0	8900&lt;/P&gt;&lt;P&gt;doc4	11.0	900&lt;/P&gt;&lt;P&gt;doc4	12.0	7000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Needs to use the control break statements to add up the amounts for same TAX Rate for a particular DOC number.&lt;/P&gt;&lt;P&gt;What should be the logic?&lt;/P&gt;&lt;P&gt;I am using this. Is it correct?&lt;/P&gt;&lt;P&gt; loop at itab.&lt;/P&gt;&lt;P&gt;  at new BELNR.&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;  at end of TAX.&lt;/P&gt;&lt;P&gt;  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;is it correct? if not, pls advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;M A&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2006 04:58:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements-logic/m-p/1649359#M288669</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-16T04:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Control Break statements logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements-logic/m-p/1649360#M288670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think it is not correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First you need to sort the internal table and the SUM statement will not work for currency fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by belnr tax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;l_index = sy-tabix.&lt;/P&gt;&lt;P&gt;l_amount = l_amount + amount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at end of tax.&lt;/P&gt;&lt;P&gt;read table itab into wa_itab index l_index.&lt;/P&gt;&lt;P&gt;wa_itab-amount = l_amount.&lt;/P&gt;&lt;P&gt;append wa_itab to itab_final.&lt;/P&gt;&lt;P&gt;clear l_amount.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2006 05:01:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements-logic/m-p/1649360#M288670</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-16T05:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Control Break statements logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements-logic/m-p/1649361#M288671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are correct. AT END OF TAX will give you total of amounts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;at new BELNR.&lt;/P&gt;&lt;P&gt;ENDAT.&lt;/P&gt;&lt;P&gt;at end of TAX.&lt;/P&gt;&lt;P&gt;  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;YOu will get values like follows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;doc1 12.5 1500&lt;/P&gt;&lt;P&gt;doc2 10.0 2000&lt;/P&gt;&lt;P&gt;doc3 10.0 2100&lt;/P&gt;&lt;P&gt;doc4 11.0 9800&lt;/P&gt;&lt;P&gt;doc4 12.0 7000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ramakrishna&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Ramakrishna Ramisetti&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2006 05:02:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements-logic/m-p/1649361#M288671</guid>
      <dc:creator>venkata_ramisetti</dc:creator>
      <dc:date>2006-11-16T05:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Control Break statements logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements-logic/m-p/1649362#M288672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not so difficult... Use COLLECT Statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Collect statement adds all the numeric fields for which the non-numeric fields are common..&lt;/P&gt;&lt;P&gt;consider this example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field1(Type C)     Field2(Type C)     Field3(Type N or any type that can be summed)&lt;/P&gt;&lt;P&gt;  A1                          B1                  5&lt;/P&gt;&lt;P&gt;  A1                          B1                  3&lt;/P&gt;&lt;P&gt;  A2                          B1                  7&lt;/P&gt;&lt;P&gt;  A2                          B2                  4&lt;/P&gt;&lt;P&gt;  A2                          B1                  2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loot at ITAB_1 into WA.&lt;/P&gt;&lt;P&gt;   collect wa into ITAB_2&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the ITAB_2 will look like this :        A1            B1      8&lt;/P&gt;&lt;P&gt;                                                          A2            B1      9&lt;/P&gt;&lt;P&gt;                                                          A2            B2      4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what you want right.... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note : If the tax(%) field is type p.. it will be added... so u store it in a temp internal table with type c so that it does not adds up...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this works... If it doesnt tell me.. I will explain in detail... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS : Do F1 on collect and see if my explanation is not clear. Believe me this is the easiest way to do this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And Plz reward points if you think your problem is answered.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Varun Verma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2006 05:16:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements-logic/m-p/1649362#M288672</guid>
      <dc:creator>former_member69765</dc:creator>
      <dc:date>2006-11-16T05:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: Control Break statements logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements-logic/m-p/1649363#M288673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot to all.&lt;/P&gt;&lt;P&gt;Thanks a ton to Varun.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have resolved the issue with Varun's suggestion.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2006 07:07:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements-logic/m-p/1649363#M288673</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-16T07:07:40Z</dc:date>
    </item>
  </channel>
</rss>

