<?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: subtotal logic is wrong...please help... in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/subtotal-logic-is-wrong-please-help/m-p/1042517#M86930</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks to all for the information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was able to use the slis_sortinfo_alv type and solve my problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Nov 2005 23:11:40 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-11-15T23:11:40Z</dc:date>
    <item>
      <title>subtotal logic is wrong...please help...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subtotal-logic-is-wrong-please-help/m-p/1042513#M86926</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;I am trying to generate subtotal of dmbtr based on txjcd. I can feel that my logic here is wrong but not able to trace the issue. Can anyone please help...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want output like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;txjcd   material   qty   local curr amt(dmbtr)&lt;/P&gt;&lt;P&gt;CA0000              1        15.50&lt;/P&gt;&lt;P&gt;CA0000              2        45.00&lt;/P&gt;&lt;P&gt;subtotal                     55.50&lt;/P&gt;&lt;P&gt;CR0000              1        15.50&lt;/P&gt;&lt;P&gt;CR0000              2        30.00&lt;/P&gt;&lt;P&gt;subtotal                     45.50&lt;/P&gt;&lt;P&gt;Total                       101.00  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at migo_data.&lt;/P&gt;&lt;P&gt;   move-corresponding migo_data to migo_data_alv.&lt;/P&gt;&lt;P&gt;   append migo_data_alv.&lt;/P&gt;&lt;P&gt;   at end of txjcd.&lt;/P&gt;&lt;P&gt;      sum.&lt;/P&gt;&lt;P&gt;      migo_data_alv-dmbtr = migo_data-dmbtr.&lt;/P&gt;&lt;P&gt;      append migo_data_alv.&lt;/P&gt;&lt;P&gt;   endat.&lt;/P&gt;&lt;P&gt;   at last.&lt;/P&gt;&lt;P&gt;      sum.&lt;/P&gt;&lt;P&gt;      migo_data_alv-dmbtr = migo_data-dmbtr.&lt;/P&gt;&lt;P&gt;      append migo_data_alv.&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;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 21:41:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subtotal-logic-is-wrong-please-help/m-p/1042513#M86926</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-15T21:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: subtotal logic is wrong...please help...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subtotal-logic-is-wrong-please-help/m-p/1042514#M86927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are using ALV,it has the variable which you can set it for totals &amp;amp; sub-totals.&lt;/P&gt;&lt;P&gt;  DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.&lt;/P&gt;&lt;P&gt;  DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.&lt;/P&gt;&lt;P&gt; CLEAR GS_SORT.&lt;/P&gt;&lt;P&gt;  GS_SORT-FIELDNAME = 'EBELN'.&lt;/P&gt;&lt;P&gt;  GS_SORT-SUBTOT    = 'X'.&lt;/P&gt;&lt;P&gt;  APPEND GS_SORT TO GT_SORT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 21:50:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subtotal-logic-is-wrong-please-help/m-p/1042514#M86927</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-15T21:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: subtotal logic is wrong...please help...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subtotal-logic-is-wrong-please-help/m-p/1042515#M86928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;instead of EBELN use TXJCD.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 22:02:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subtotal-logic-is-wrong-please-help/m-p/1042515#M86928</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-15T22:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: subtotal logic is wrong...please help...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subtotal-logic-is-wrong-please-help/m-p/1042516#M86929</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 SUM Statement will never work between AT (FIRST/NEW/END/LAST) and ENDAT statements. If you want to get the sum then use a counter and increment it . &lt;/P&gt;&lt;P&gt;This is only way you can achieve this. &lt;/P&gt;&lt;P&gt;  The SUM command will have effect only in between the LOOP and ENDLOOP statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vara&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 22:09:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subtotal-logic-is-wrong-please-help/m-p/1042516#M86929</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-15T22:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: subtotal logic is wrong...please help...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subtotal-logic-is-wrong-please-help/m-p/1042517#M86930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks to all for the information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was able to use the slis_sortinfo_alv type and solve my problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 23:11:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subtotal-logic-is-wrong-please-help/m-p/1042517#M86930</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-15T23:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: subtotal logic is wrong...please help...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subtotal-logic-is-wrong-please-help/m-p/1042518#M86931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;pl award points to those who helped you &amp;amp; close this thread..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;have fun,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suresh Datti&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Nov 2005 00:09:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subtotal-logic-is-wrong-please-help/m-p/1042518#M86931</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2005-11-16T00:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: subtotal logic is wrong...please help...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subtotal-logic-is-wrong-please-help/m-p/1042519#M86932</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;U can do like this also&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  SORT migo_data BY txjcd dmbtr.
  LOOP AT migo_data.
&amp;lt;b&amp;gt;    AT END OF txjcd.
      SUM.&amp;lt;/b&amp;gt;
*      migo_data_alv-txjcd = migo_data-txjcd.
      migo_data_alv-dmbtr = migo_data-dmbtr.
      APPEND migo_data_alv.
      CLEAR migo_data_alv.
    ENDAT.
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above logic will work. I have tried that in a report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next way is &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: i_sort_fcat    TYPE lvc_t_sort,
  struct_gridsort TYPE lvc_t_sort WITH HEADER LINE.

 FORM sort_outtable CHANGING p_i_sort_fcat.
  struct_gridsort-fieldname = 'TXJCD'.
  struct_gridsort-up       = 'X'.
  APPEND struct_gridsort TO i_sort_fcat.
  CLEAR struct_gridsort.

  struct_gridsort-fieldname = 'DMBTR'.
  struct_gridsort-up       = 'X'.
  struct_gridsort-subtot    = 'X'.
  APPEND struct_gridsort TO i_sort_fcat.
  CLEAR struct_gridsort.

ENDFORM.                    " sort_outtable&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly reward points and close the thread if ur problem got solved.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Nov 2005 03:25:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subtotal-logic-is-wrong-please-help/m-p/1042519#M86932</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-16T03:25:18Z</dc:date>
    </item>
  </channel>
</rss>

