2007 Oct 08 12:26 PM
Hello!
I need to change header of alv according to internal table in herarical alv .
as internal table having 10 kunnr ,i need every kunnr name at the header level.
please guide me how is it possible.
surely points will be awarded.
Priya.
2007 Oct 08 12:53 PM
Hi,
Use the below code and declare as below :
data : gt_listheader TYPE slis_t_listheader,
gs_line TYPE slis_listheader,
PERFORM f_build_alv_title USING gt_listheader[].
&--------------------------------------------------------------------*
*& Form f_build_alv_title
*&--------------------------------------------------------------------*
* text : ALV Header Section
*---------------------------------------------------------------------*
FORM f_build_alv_title
USING lt_top_of_page
TYPE slis_t_listheader.
CLEAR gs_line.
*Customer Number
if not itab[] is initial.
loop at itab.
CLEAR: gs_line.
gs_line-typ = s.
gs_line-key = 'Customer'(015).
gs_line-info = itab-kunnr.
APPEND gs_line TO lt_top_of_page.
endloop.
endif.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gv_repid
i_callback_user_command = 'F_USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = gt_layout
it_fieldcat = gt_fieldcat[]
it_sort = gt_sort[]
i_save = 'A'
it_events = gt_event[]
TABLES
t_outtab = gt_output
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.
*&--------------------------------------------------------------------*
*& Form top_of_page
*&--------------------------------------------------------------------*
* text : Top of Page event
*---------------------------------------------------------------------*
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_listheader.
ENDFORM. "TOP_OF_PAGEThanks,
Sriram Ponna.
Message was edited by:
Sriram Ponna
Message was edited by:
Sriram Ponna
2007 Oct 08 12:53 PM
Hi,
Use the below code and declare as below :
data : gt_listheader TYPE slis_t_listheader,
gs_line TYPE slis_listheader,
PERFORM f_build_alv_title USING gt_listheader[].
&--------------------------------------------------------------------*
*& Form f_build_alv_title
*&--------------------------------------------------------------------*
* text : ALV Header Section
*---------------------------------------------------------------------*
FORM f_build_alv_title
USING lt_top_of_page
TYPE slis_t_listheader.
CLEAR gs_line.
*Customer Number
if not itab[] is initial.
loop at itab.
CLEAR: gs_line.
gs_line-typ = s.
gs_line-key = 'Customer'(015).
gs_line-info = itab-kunnr.
APPEND gs_line TO lt_top_of_page.
endloop.
endif.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gv_repid
i_callback_user_command = 'F_USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = gt_layout
it_fieldcat = gt_fieldcat[]
it_sort = gt_sort[]
i_save = 'A'
it_events = gt_event[]
TABLES
t_outtab = gt_output
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.
*&--------------------------------------------------------------------*
*& Form top_of_page
*&--------------------------------------------------------------------*
* text : Top of Page event
*---------------------------------------------------------------------*
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_listheader.
ENDFORM. "TOP_OF_PAGEThanks,
Sriram Ponna.
Message was edited by:
Sriram Ponna
Message was edited by:
Sriram Ponna
2007 Oct 09 8:30 AM