<?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: ALV subtotals using methods in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-subtotals-using-methods/m-p/1521720#M239515</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 have to do the subtotal column wise.In the field catalog specify the following in addition to the corresponding field name(i.e. Column)&lt;/P&gt;&lt;P&gt;DATA ls_fcat TYPE lvc_s_fcat.&lt;/P&gt;&lt;P&gt;ls_fcat-do_sum = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps u out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Shalini&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Aug 2006 06:33:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-08-24T06:33:37Z</dc:date>
    <item>
      <title>ALV subtotals using methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-subtotals-using-methods/m-p/1521717#M239512</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;Please provide me sample code for subtotals using methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code is &lt;/P&gt;&lt;P&gt;DATA: ls_sort TYPE lvc_s_sort. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ls_sort-spos = '1' . &lt;/P&gt;&lt;P&gt;ls_sort-fieldname = 'BWART'. &lt;/P&gt;&lt;P&gt;ls_sort-up = 'X'. &lt;/P&gt;&lt;P&gt;ls_sort-subtot = 'X'. &lt;/P&gt;&lt;P&gt;*ls_sort-group = 'UL'. &lt;/P&gt;&lt;P&gt;APPEND ls_sort TO p_gt_sort. &lt;/P&gt;&lt;P&gt;endform &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it is not working&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 05:26:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-subtotals-using-methods/m-p/1521717#M239512</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-24T05:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: ALV subtotals using methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-subtotals-using-methods/m-p/1521718#M239513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Alekhya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Use like this....&lt;/P&gt;&lt;P&gt;  Instead of ls_sort-subtot = 'X'. Use&lt;/P&gt;&lt;P&gt;    ls_sort-do_sum = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Cheers,&lt;/P&gt;&lt;P&gt;   priya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 05:36:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-subtotals-using-methods/m-p/1521718#M239513</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-24T05:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: ALV subtotals using methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-subtotals-using-methods/m-p/1521719#M239514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;go through this link&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.cdg-inc.com/news/WhitePaper_ALV_Reporting_Power.htm" target="test_blank"&gt;http://www.cdg-inc.com/news/WhitePaper_ALV_Reporting_Power.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;mrutyun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 06:10:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-subtotals-using-methods/m-p/1521719#M239514</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-24T06:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: ALV subtotals using methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-subtotals-using-methods/m-p/1521720#M239515</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 have to do the subtotal column wise.In the field catalog specify the following in addition to the corresponding field name(i.e. Column)&lt;/P&gt;&lt;P&gt;DATA ls_fcat TYPE lvc_s_fcat.&lt;/P&gt;&lt;P&gt;ls_fcat-do_sum = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps u out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Shalini&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 06:33:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-subtotals-using-methods/m-p/1521720#M239515</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-24T06:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: ALV subtotals using methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-subtotals-using-methods/m-p/1521721#M239516</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;this is how you should do...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLASS lcl_event_handler DEFINITION DEFERRED.

DATA: dg_events_receiver TYPE REF
                            TO lcl_event_handler.  "event receiver

*---------------------------------------------------------------------*
*       CLASS lcl_event_handler DEFINITION
*---------------------------------------------------------------------*
*       For Event handling                                             *
*---------------------------------------------------------------------*
CLASS lcl_event_handler DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS:

       subtotal_text        FOR EVENT subtotal_text
                         OF cl_gui_alv_grid
                         IMPORTING es_subtottxt_info
                                   ep_subtot_line
                                   e_event_data.


ENDCLASS.                    "VERIFY_EVENT_HANDLER DEFINITION

*---------------------------------------------------------------------*
*       CLASS lcl_event_handler IMPLEMENTATION
*---------------------------------------------------------------------*
*       Implementation of event handler method                        *
*---------------------------------------------------------------------*
CLASS lcl_event_handler IMPLEMENTATION.

  METHOD subtotal_text.
    PERFORM d0100_event_subtotal_text USING es_subtottxt_info
                                            ep_subtot_line
                                            e_event_data.
  ENDMETHOD.                    "subtotal_text

ENDCLASS.                    "lcl_event_handler IMPLEMENTATION

*--set event handler
  PERFORM set_event_handler.
 
  CALL METHOD dg_grid-&amp;gt;set_table_for_first_display
    EXPORTING
      is_layout                     = ds_layout
    CHANGING
      it_outtab                     = &amp;lt;fs_f&amp;gt;
      it_fieldcatalog               = dt_alv_cat
      it_sort                       = dt_sort
    EXCEPTIONS
      invalid_parameter_combination = 1
      program_error                 = 2
      too_many_lines                = 3
      OTHERS                        = 4.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE i000 WITH
         'Error in calling SET_TABLE_FOR_FIRST_DISPLAY'(026).
  ENDIF.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  set_event_handler
*&amp;amp;---------------------------------------------------------------------*
*       event handler
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM set_event_handler .
  CREATE OBJECT dg_events_receiver.
  SET HANDLER dg_events_receiver-&amp;gt;subtotal_text
              FOR dg_grid.
ENDFORM.                    " set_event_handler

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  d0100_event_subtotal_text
*&amp;amp;---------------------------------------------------------------------*
*       To handle subtotal text event
*----------------------------------------------------------------------*
*      --&amp;gt;P_ES_SUBTOTTXT_INFO  text
*      --&amp;gt;P_EP_SUBTOT_LINE  text
*      --&amp;gt;P_E_EVENT_DATA  text
*----------------------------------------------------------------------*
FORM d0100_event_subtotal_text  USING
                        p_es_subtottxt_info TYPE lvc_s_stxt
                       p_ep_subtot_line TYPE REF TO data
                       p_e_event_data TYPE REF TO cl_alv_event_data .
  FIELD-SYMBOLS: &amp;lt;fs&amp;gt; TYPE ANY.

  ASSIGN p_e_event_data-&amp;gt;m_data-&amp;gt;* TO &amp;lt;fs&amp;gt;.
  &amp;lt;fs&amp;gt; = 'TOTAL'(027).
ENDFORM.                    " d0100_event_subtotal_text&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 07:00:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-subtotals-using-methods/m-p/1521721#M239516</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-24T07:00:15Z</dc:date>
    </item>
  </channel>
</rss>

