08-14-2009 4:57 PM
Hi this is saroj.
i am new to alv reports.i have done a alv report by using FMs events_get,commentary_write,grid_display.
i am getting the data but i am not getting the header text of report and logo.
my coding is like this.
tables: kna1.
types: begin of it,
----------
end of it.
data: it_field type slis_t_fieldcat_alv,
wa_field type slis_fieldcat_alv,
it_event type slis_t_event,
wa_event type slis_alv_event,
it_list type slis_t_listheader,
wa_list type slis_listheader,
repid type sy-repid.
perform select.
perform event.
perform header.
perform logo using it_list.
perform display.
in subroutine event:
-----------------------------------
reuse_alv_events_get
exporting
i_list_type = 0.
importing
et_events = it_event.
wa_event-name = 'top_of_page'.
wa_event-form = 'logo'.
append wa_event to it_event.
in subroutine header:
---------------------------------------
wa_list-typ = 'H'.
WA_LIST-INFO = 'SOME TEXT'.
APPEND WA_LIST TO IT_LIST.
IN SUBROUTINE LOGO.
---------------------------------------
REUSE_ALV_COMMENTARY_WRITE
EXPORTING
IT_LIST_COMMENTARY = 'IT_LIST'
I_LOGO = 'ENJOYSAP_LOGO'.
-
my issue is that i am getting the data but i am not getting the header text and logo.
please solve the issue.please give sample code.
regards
saroj kanta
Edited by: Julius Bussche on Aug 15, 2009 7:03 AM
08-14-2009 6:11 PM
Hi Saroj,
Try this
***Declarations,
*STEP1*
DATA : gt_events TYPE slis_t_event, " Internal table to capture various events in ALV
gs_events TYPE slis_alv_event.
*STEP2*
Perform event.
FORM event .
CLEAR : gt_events[],
gs_events.
*PASS THE VALUE AS FOLLOWS*
gs_events-name = slis_ev_top_of_page.
gs_events-form = slis_ev_top_of_page.
APPEND gs_events TO gt_events.
ENDFORM.
*STEP3*
*DECLARE TOP OF PAGE AS BELOW.*
*&---------------------------------------------------------------------**
**& Form TOP_OF_PAGE*
**&---------------------------------------------------------------------**
FORM top_of_page. "#EC CALLED
CONSTANTS: lc_header TYPE char1 VALUE 'H',
lc_selection TYPE char1 VALUE 'S'.
DATA: ls_header TYPE slis_listheader,
lt_header TYPE slis_t_listheader.
*-- Report Title
CLEAR ls_header.
REFRESH lt_header.
ls_header-typ = lc_header.
ls_header-key = 'Report :'(015). "Report
ls_header-info = sy-title.
APPEND ls_header TO lt_header.
*-- Client
ls_header-typ = lc_selection.
ls_header-key = 'Client :'(012). "Client
ls_header-info = sy-mandt.
APPEND ls_header TO lt_header.
CLEAR ls_header.
*-- User ID
ls_header-typ = lc_selection.
ls_header-key = 'User ID :'(013). "User ID
ls_header-info = sy-uname.
APPEND ls_header TO lt_header.
CLEAR ls_header.
*-- Date (MM/DD/YYYY)
ls_header-typ = lc_selection.
ls_header-key = 'Date :'(014). "Date
WRITE sy-datum TO ls_header-info.
APPEND ls_header TO lt_header.
CLEAR ls_header.
*-- Time
ls_header-typ = lc_selection.
ls_header-key = 'Time :'(016). "Time
WRITE sy-uzeit TO ls_header-info.
APPEND ls_header TO lt_header.
CLEAR ls_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = lt_header.
ENDFORM. "top_of_page
Regards,
Vimal.
Edited by: Julius Bussche on Aug 15, 2009 7:04 AM
Added code tags...
08-14-2009 7:22 PM
Hi Saroj,
along with Vimol's answer you also can use the I_CALLBACK_TOP_OF_PAGE parameter like this
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE' <here 'TOP-OF-PAGE' is the name of a subroutine where you have to create the header>.
just use search engine with REUSE_ALV_GRID_DISPLAY ,you get lots of code.
Regards.
Sarbajit.
10-07-2009 2:59 PM