<?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: how can i add total in Module Pool Programming in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-can-i-add-total-in-module-pool-programming/m-p/2024162#M414691</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check the  following ex code. &lt;/P&gt;&lt;P&gt;You need to write logic in PAI event for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROCESS AFTER INPUT.&lt;/P&gt;&lt;P&gt;*&amp;amp;SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TC1'&lt;/P&gt;&lt;P&gt;*BREAK POINT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT G_TC1_ITAB.&lt;/P&gt;&lt;P&gt;    CHAIN.&lt;/P&gt;&lt;P&gt;      FIELD ZFG_SRNO-ZSRNO.&lt;/P&gt;&lt;P&gt;      MODULE TC1_MODIFY ON CHAIN-REQUEST.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     MODULE TC1_MODIFY.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    ENDCHAIN.&lt;/P&gt;&lt;P&gt;      MODULE MESSAGE .&lt;/P&gt;&lt;P&gt;    MODULE DELETE_RECORD.&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;MODULE TC1_MODIFY INPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*break-point.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; MOVE-CORRESPONDING ZFG_SRNO TO  G_TC1_ITAB.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; MODIFY G_TC1_ITAB INDEX TC1-CURRENT_LINE.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; G_TC1_COPIED = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; REFRESH CONTROL 'TC1' FROM SCREEN '8001'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  MOVE-CORRESPONDING ZFG_SRNO TO G_TC1_WA.&lt;/P&gt;&lt;P&gt;  MODIFY G_TC1_ITAB&lt;/P&gt;&lt;P&gt;    FROM G_TC1_WA&lt;/P&gt;&lt;P&gt;    INDEX TC1-CURRENT_LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      G_TC1_COPIED = 'X'.&lt;/P&gt;&lt;P&gt;      if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;append G_TC1_WA to G_TC1_ITAB.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;ENDMODULE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Mar 2007 08:02:54 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-03-20T08:02:54Z</dc:date>
    <item>
      <title>how can i add total in Module Pool Programming</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-can-i-add-total-in-module-pool-programming/m-p/2024160#M414689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai abapers,&lt;/P&gt;&lt;P&gt;My problem is I have 15 fields in a tablecontrol.The 15th field is total field...&lt;/P&gt;&lt;P&gt;When ever user enter a values in remaing fields,the 15 the field must be updated...&lt;/P&gt;&lt;P&gt;how can i achieve in module pool programming..................&lt;/P&gt;&lt;P&gt;i have one more problem.That is when user pressing any key.my content in table control r clearing..i need to restrict clearing values..how can i achieve it ...&lt;/P&gt;&lt;P&gt;Waiting for y r favourable replies&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Maruthi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2007 07:42:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-can-i-add-total-in-module-pool-programming/m-p/2024160#M414689</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-20T07:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: how can i add total in Module Pool Programming</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-can-i-add-total-in-module-pool-programming/m-p/2024161#M414690</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;There are two ways you can do the summation thing..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Make any field of other 14 fields as &amp;lt;b&amp;gt;'responds to double click'&amp;lt;/b&amp;gt; and fill fcode , say 'select' for F2 function key in GUI Status .  &lt;/P&gt;&lt;P&gt;then program for it like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;case 'ok_code'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when 'select'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;15 field = sum of all 14 fields .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. If you would like to do the sum for all the rows in one go ,then:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create a &amp;lt;b&amp;gt;pushbutton&amp;lt;/b&amp;gt; with ok_code sum.&lt;/P&gt;&lt;P&gt;and after filling all 14 fields , you can get the sum programmed for this push button in a case statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding clearing of the table control,&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;perhaps you have not included a  loop for populating your table control in your PBO .&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Pls reward if useful ..Feel free to ask anything else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Warm Regards,&lt;/P&gt;&lt;P&gt;Shweta Soni&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2007 07:51:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-can-i-add-total-in-module-pool-programming/m-p/2024161#M414690</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-20T07:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: how can i add total in Module Pool Programming</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-can-i-add-total-in-module-pool-programming/m-p/2024162#M414691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check the  following ex code. &lt;/P&gt;&lt;P&gt;You need to write logic in PAI event for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROCESS AFTER INPUT.&lt;/P&gt;&lt;P&gt;*&amp;amp;SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TC1'&lt;/P&gt;&lt;P&gt;*BREAK POINT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT G_TC1_ITAB.&lt;/P&gt;&lt;P&gt;    CHAIN.&lt;/P&gt;&lt;P&gt;      FIELD ZFG_SRNO-ZSRNO.&lt;/P&gt;&lt;P&gt;      MODULE TC1_MODIFY ON CHAIN-REQUEST.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     MODULE TC1_MODIFY.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    ENDCHAIN.&lt;/P&gt;&lt;P&gt;      MODULE MESSAGE .&lt;/P&gt;&lt;P&gt;    MODULE DELETE_RECORD.&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;MODULE TC1_MODIFY INPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*break-point.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; MOVE-CORRESPONDING ZFG_SRNO TO  G_TC1_ITAB.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; MODIFY G_TC1_ITAB INDEX TC1-CURRENT_LINE.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; G_TC1_COPIED = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; REFRESH CONTROL 'TC1' FROM SCREEN '8001'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  MOVE-CORRESPONDING ZFG_SRNO TO G_TC1_WA.&lt;/P&gt;&lt;P&gt;  MODIFY G_TC1_ITAB&lt;/P&gt;&lt;P&gt;    FROM G_TC1_WA&lt;/P&gt;&lt;P&gt;    INDEX TC1-CURRENT_LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      G_TC1_COPIED = 'X'.&lt;/P&gt;&lt;P&gt;      if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;append G_TC1_WA to G_TC1_ITAB.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;ENDMODULE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2007 08:02:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-can-i-add-total-in-module-pool-programming/m-p/2024162#M414691</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-20T08:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: how can i add total in Module Pool Programming</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-can-i-add-total-in-module-pool-programming/m-p/2024163#M414692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Maruthi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem you are facing is having a common solution which you can use..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

PBO

MODULE CALCULATE_TOTAL.

LOOP AT INTERNAL_TABLE INTO WORK_AREA WITH CONTROL TABLE_CONTROL.

MODULE POPULATE_TABLE_CONTROL.

ENDLOOP.


PAI

LOOP AT INTERNAL_TABLE.

FIELD: &amp;lt;i&amp;gt;**mention all the fields in the internal table&amp;lt;/i&amp;gt;
           MODULE FETCH_DATA.

ENDLOOP.

********************************************************************************

MODULE POPULATE_TABLE_CONTROL.

&amp;lt;b&amp;gt;******move contents of the fields from internal table to field structure of the table control.&amp;lt;/b&amp;gt;

*END OF MODULE POPULATE_TABLE_CONTROL

MODULE CALCULATE_TOTAL.

LOOP AT INTERNAL_TABLE INTO WORK_AREA.

**add the fields you would wish to find the total for.
W_TOTAL = W_TOTAL + WORK_AREA-PRICE.


MOVE W_TOTAL TO WORK_AREA-PRICE.

**this statement is written assuming that there are 15 lines already existing in the **internal table. If this is not the case then you can use append to add the total to last **line. or you can modify the logic as per your requirements.

MODIFY WORK_AREA TO INTERNAL_TABLE INDEX 15.

ENDLOOP.

*END OF MODULE CALCULATE_TOTAL.

MODULE FETCH_DATA.

***copy all the data from the table control structure in to work area for the internal table.
***append the work area into the internal table

*END OF MODULE FETCH_DATA.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kunjal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2007 08:17:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-can-i-add-total-in-module-pool-programming/m-p/2024163#M414692</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-20T08:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: how can i add total in Module Pool Programming</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-can-i-add-total-in-module-pool-programming/m-p/2024164#M414693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;maruthi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. when user pressing any key.my content in table control r clearing..i need to&lt;/P&gt;&lt;P&gt;    restrict clearing values..how can i achieve it ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ans. When ever you press button it will go first to PAI event and will go back to&lt;/P&gt;&lt;P&gt;        PBO.So in PBO event you might have wriiten some coding that will get&lt;/P&gt;&lt;P&gt;        process and  updated in Table control.That time your updated data will get &lt;/P&gt;&lt;P&gt;       removed.&lt;/P&gt;&lt;P&gt;         &lt;/P&gt;&lt;P&gt;         For this take all your function codes of your buttons on screen and write&lt;/P&gt;&lt;P&gt;        condition&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;          if sy-ucom ne 'ADD'  or &lt;/P&gt;&lt;P&gt;             sy-ucom ne 'Delete'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;********Here you keep your  PBO code&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;Now it will work fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.When ever user enter a values in remaing fields,the 15 the field must be updated&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ans)After you entered the data in 14 fields some event has to get trigger then&lt;/P&gt;&lt;P&gt;       only  you can achieve your goal.&lt;/P&gt;&lt;P&gt;        &lt;/P&gt;&lt;P&gt;In PBO write  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         If SY-UCOM is eq 'ADD'.             &lt;/P&gt;&lt;P&gt;             collect all fields records and add here  &lt;/P&gt;&lt;P&gt;             move total value to 15th record .&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;when you press ADD button  you will achieve .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls. reward if useful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2007 08:39:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-can-i-add-total-in-module-pool-programming/m-p/2024164#M414693</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-20T08:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: how can i add total in Module Pool Programming</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-can-i-add-total-in-module-pool-programming/m-p/2024165#M414694</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;Any type of user interaction with the module pool screen triggers the PBO of your module pool. This is the reason why the contents of your table control are getting refreshed. The only way out is to capture the current state of your table control into some internal table and refresh the table control in the PBO using this internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***********************&lt;STRONG&gt;Reward points if found useful&lt;/STRONG&gt;***********************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kriththika&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2007 11:03:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-can-i-add-total-in-module-pool-programming/m-p/2024165#M414694</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-20T11:03:26Z</dc:date>
    </item>
  </channel>
</rss>

