2012 Feb 22 8:27 PM
Hi,
How do I include a text for sub total field on ALV.
I got different columns on ALV which shows count. Want to put a text at the left end of Report for field BUKRS like "State level total"
I tried creating SUBTOTAL_TEXT with events and passed it on REUSE_ALV_GRID_DISPLAY for IT_EVENTS. It doesn't works. Not sure what am I missing.
Field catalog I created:
lw_fieldcat-tabname = 't_out_val'.
lw_fieldcat-fieldname = 'BUKRS1'.
lw_fieldcat-seltext_l = 'Company Code'.
lw_fieldcat-col_Pos = lv_col_pos.
lw_fieldcat-outputlen = 15.
APPEND lw_fieldcat TO pi_fieldcat.
lv_col_pos = +1.
CLEAR lw_fieldcat.
Event for Subtotal_text:
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.
READ TABLE i_event INTO l_s_event WITH KEY name = slis_ev_subtotal_text.
IF sy-subrc EQ 0.
MOVE c_formname_subtotal_text TO l_s_event-form.
MODIFY i_event FROM l_s_event INDEX sy-tabix.
ENDIF.
Text for subtotal:
FORM subtotal_text CHANGING
p_total TYPE any
p_subtot_text TYPE slis_subtot_text.
IF p_subtot_text-criteria = 'BUKRS1'.
p_subtot_text-display_text_for_subtotal = 'State level total'.
ENDIF.
ENDFORM. "subtotal_text
Thanks,
Francis
Hi,
How do I include a text for sub total field on ALV.
I got different columns on ALV which shows count. Want to put a text at the left end of Report for field BUKRS like "State level total"
I tried creating SUBTOTAL_TEXT with events and passed it on REUSE_ALV_GRID_DISPLAY for IT_EVENTS. It doesn't works. Not sure what am I missing.
Field catalog I created:
lw_fieldcat-tabname = 't_out_val'.
lw_fieldcat-fieldname = 'BUKRS1'.
lw_fieldcat-seltext_l = 'Company Code'.
lw_fieldcat-col_Pos = lv_col_pos.
lw_fieldcat-outputlen = 15.
APPEND lw_fieldcat TO pi_fieldcat.
lv_col_pos = +1.
CLEAR lw_fieldcat.
Event for Subtotal_text:
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.
READ TABLE i_event INTO l_s_event WITH KEY name = slis_ev_subtotal_text.
IF sy-subrc EQ 0.
MOVE c_formname_subtotal_text TO l_s_event-form.
MODIFY i_event FROM l_s_event INDEX sy-tabix.
ENDIF.
Text for subtotal:
FORM subtotal_text CHANGING
p_total TYPE any
p_subtot_text TYPE slis_subtot_text.
IF p_subtot_text-criteria = 'BUKRS1'.
p_subtot_text-display_text_for_subtotal = 'State level total'.
ENDIF.
ENDFORM. "subtotal_text
Thanks,
Francis
2012 Feb 22 8:53 PM
Hi
have sorted your table on BUKRS?
refer http://wiki.sdn.sap.com/wiki/display/Snippets/DisplaysubtotaltextinALV+grid
Regards
Vinit
2012 Feb 24 1:43 PM
hi,
Change your Field catalog a bit and Check with this..
lw_fieldcat-fieldname = 'BUKRS'.
lw_fieldcat-seltext_l = 'Company Code'.
lw_fieldcat-no_out= 'X'.
lw_fieldcat-TECH= ' '.
APPEND lw_fieldcat TO pi_fieldcat.
Regards,
PraVeen..
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |