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

Subtotal text print in alv grid report

HI all,

I am trying to print the text for the column e.g. "SUBTOTAL TEXT" when i click on event button on the tool bar.

total is getting generated but text is not printing i am giving the code what i had written please tel me what changes should be done in this code .

***********Code

FORM sub_get_event .

CONSTANTS : c_formname_subtotal_text TYPE slis_formname VALUE 'SUBTOTAL_TEXT'.

DATA: l_s_event TYPE slis_alv_event.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 4

IMPORTING

ET_EVENTS = i_event

EXCEPTIONS

LIST_TYPE_WRONG = 0

OTHERS = 0.

  • Subtotal

READ TABLE i_event INTO l_s_event

WITH KEY name = slis_ev_subtotal_text.

IF sy-subrc = 0.

MOVE c_formname_subtotal_text TO l_s_event-form.

MODIFY i_event FROM l_s_event INDEX sy-tabix.

ENDIF.

ENDFORM. " sub_get_event

&----


*& Form subtotal_text

&----


  • Build subtotal text

----


  • P_total Total

  • p_subtot_text Subtotal text info

----


FORM subtotal_text CHANGING

p_total TYPE any

p_subtot_text TYPE slis_subtot_text.

  • Material level sub total

IF p_subtot_text-criteria = 'KWMENG'.

p_subtot_text-display_text_for_subtotal = 'Total '(009).

ENDIF.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = it_repid

I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE' "#EC *

IS_LAYOUT = it_lay

IT_FIELDCAT = it_fldct[]

IT_EVENTS = i_event

TABLES

t_outtab = it_outtb

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. "Alv_Display

Thank you,

Supriya.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Aug 13, 2008 at 07:51 AM

    in order to get the subtotals and subtotal texts you need to have sort option. without sort option it is not possible to trigger this event.

    first populate the sort table then it will tirgger. check this thread for sample code

    subtotal-text-in-alv

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 13, 2008 at 08:24 AM

    Hi Supriya,

    Check this link:

    http://sap.javaeye.com/blog/188861

    Regards,

    Chandra Sekhar

    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.