03-03-2015 12:11 AM
Hi Experts,
Can anyone explain me how to maintain texts in the alv grid display with a demo program.
How To Maintain Sub Total texts in the ALV grid display.
Thanks,
Narendra Reddy.
03-03-2015 1:40 AM
Hello Narendra,
In ALV grid display, when we hide a column on which subtotals are computed, then the hidden column name and its value appear in the subtotal line. In the following picture Equipment column on which subtotals of Dly(Mn) column was computed, was hidden. So the Equipment number is appearing in the sub total line.
Is this your requirement?
KJogeswaraRao
03-03-2015 2:32 AM
Hi,
You want change subtotal text by your abap code?
Then you need register a form(subtotal_text) in alv event, as below code:
*
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
.
FORM
subtotal_text CHANGING
p_total
TYPE
any
p_subtot_text
TYPE
slis_subtot_text.
*
Material level sub total
IF
p_subtot_text-criteria =
'MATNR'
.
p_subtot_text-display_text_for_subtotal
=
'Material level total'
(009).
ENDIF
.
*
Plant level sub total
IF
p_subtot_text-criteria =
'WERKS'
.
p_subtot_text-display_text_for_subtotal =
'Plant level total'
(010).
ENDIF
.
ENDFORM
. "subtotal_text
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_events = i_event...
regards,
Archer
03-03-2015 5:41 AM
Hi Narendra,
For maintaining the subtotal text, we need to do the following steps.
* Sort on material
wa_sort-spos = '01' .
wa_sort-fieldname = 'MATNR'.
wa_sort-tabname = 'I_EKPO'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort .
CLEAR wa_sort.
*
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
.
p_subtot_text-display_text_for_subtotal =
'Plant level total'
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_top_of_page = 'SUB_ALV_TOP_OF_PAGE'
it_fieldcat = it_fieldcat
it_sort = i_sort
it_events = i_event
i_default = 'X'
i_save = 'A'
TABLES
t_outtab = it_final.
Please find the link below
Display subtotal text in ALV grid - Code Gallery - SCN Wiki
Regards
Rajkumar Narasimman