Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Subtotal text print in alv grid report

Former Member
0 Kudos

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.

2 REPLIES 2

former_member188685
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Supriya,

Check this link:

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

Regards,

Chandra Sekhar