Skip to Content
author's profile photo Former Member
Former Member

Regarding ALV subtotal text.

Hi,

I need to add text for the subtotal value. Got an option like in the layout wa can add one of the attribute subtotals_text. But it is not working.Please give a solution.

Thanx in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 07:13 AM

    Hi,

    Output text for subtotals in the grid control if the subtotal criterion (column used by the user for calculating the subtotal) is hidden. In the default setting, the ALV Grid Control outputs the column header of the subtotal criterion and the value to which the subtotal calculated refers.

    ES_SUBTOTTXT_INFO -- Type LVC_S_STXT

    Structure with information on the subtotal criterion

    EP_SUBTOT_LINE --- Type Ref To DATA

    Reference variable to the inserted subtotal line in the grid control. Columns for which no total was calculated remain set to their initial value.

    E_EVENT_DATA -


    Type Ref To CL_ALV_EVENT_DATA

    Attribute M_DATA of this object is a reference to the subtotal text.

    <b>EXAMPLE</b>

    You display a table with data of structure SFLIGHT in an ALV Grid Control. We now change the pre-set subtotal text for subtotal criterion plane type of table SFLIGHT :

    1. Define and implement an event handler method for event

    2. subtotal_text . Register this event with SET HANDLER . Call a subroutine within this method and pass the event parameters to that subroutine.

    3. Event parameters

    ep_subtot_line and e_event_data contain reference variables to generic data type DATA . This is why you must use field symbols in the subroutine:

    FORM method_subtotal_text USING es_subtottxt_info TYPE lvc_s_stxt

    ep_subtot_line TYPE REF TO data

    e_event_data TYPE REF TO

    cl_alv_event_data.

    DATA ls_sflight LIKE sflight.

    FIELD-SYMBOLS: <fs1> STRUCTURE sflight DEFAULT ls_sflight,

    <fs2>.

    IF es_subtottxt_info-criteria = 'PLANETYPE'.

    ASSIGN ep_subtot_line->* TO <fs1>.

    ASSIGN e_event_data->m_data->* TO <fs2>.

    CONCATENATE es_subtottxt_info-keyword ': '

    <fs1>-planetype INTO <fs2>.

    ENDIF.

    ENDFORM. " METHOD_SUBTOTAL_TEXT

    Result

    Check your result as follows:

    1. Calculate the total for a column.

    2. Calculate subtotals for column

    3. plane type . Hide column

    plane type . To do this, use either the standard context menu or a new layout.

    The new text defined is displayed at the beginning of a subtotal line.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 09:49 AM

    Hi Sreekanth,

    Thankx for the reply.

    But it is little bit confusing.Can you please make it clear?

    One more thing is it is working for ALV list output.

    Regards,

    Selvakumar K.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.