11-25-2013 5:40 AM
Hi Team,
i need a help.How to display the selection screen information ( , i.e. what the user has entered in the selection screen(input Details) before executing the report ) in the o/p of the Alv report at top of page.
Please provide the relevant info.
11-25-2013 5:45 AM
11-25-2013 5:45 AM
Create a subroutine in your program named "TOP-OF-PAGE" as follows:
FORM top-of-page.
*ALV Header declarations
DATA: t_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader,
t_line LIKE wa_header-info,
ld_lines TYPE i,
ld_linesc(10) TYPE c.
wa_header-typ = 'H'.
wa_header-info = sel_field. "This is your selection screen parameter..
APPEND wa_header TO t_header.
CLEAR wa_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header.
ENDFORM. "top-of-page
In ALV Grid function call,
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
TABLES
t_outtab = inv_doc
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.
Regards
11-25-2013 5:45 AM
Hi Karthik
If i understand you need to show in report output header the selection screen parameters. Please check TOP OF PAGE for the same. Search it you will find many .
Nabheet
11-25-2013 5:48 AM
Hi Karthik ,
Within Top of page ,You can use PRINT_SELECTIONS function module to print the selection information.
please check this & follow steps.
http://wiki.scn.sap.com/wiki/display/ABAP/print+the+selection+screen++data+on+the+report++output
Thanks
Gourav.
11-25-2013 6:02 AM
Build the ALV header table.
Pass the TOP-OF-EVENT subroutine name and callback program name to I_CALLBACK_TOP_OF_PAGE and I_CALLBACK_PROGRAM parameters of REUSE_ALV_GRID_DISPLAY function module.
Display the ALV header by passing the ALV header table built in step one to function module ‘REUSE_ALV_COMMENTARY_WRITE’ inside TOP-OF-EVENT subroutine.
Try this sample code :
TYPE-POOLS: slis.
*----------------------------------------------------------------------*
* Data Decalaration
*----------------------------------------------------------------------*
DATA: it_spfli TYPE TABLE OF spfli.
DATA: g_repid TYPE sy-repid.
DATA: it_listheader TYPE slis_t_listheader,
wa_listheader TYPE slis_listheader.
*----------------------------------------------------------------------*
* START-OF-SELECTION
*----------------------------------------------------------------------*
START-OF-SELECTION.
g_repid = sy-repid.
SELECT * FROM spfli INTO TABLE it_spfli.
PERFORM build_alv_header.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_top_of_page = 'TOP_OF_PAGE'
i_structure_name = 'SPFLI'
TABLES
t_outtab = it_spfli.
*&---------------------------------------------------------------------*
*& Form BUILD_ALV_HEADER
*&---------------------------------------------------------------------*
FORM build_alv_header .
* Type H is used to display headers i.e. big font
wa_listheader-typ = 'H'.
wa_listheader-info ='Flight Details'.
APPEND wa_listheader TO it_listheader.
CLEAR wa_listheader.
* Type S is used to display key and value pairs
wa_listheader-typ = 'S'.
wa_listheader-key = 'Date :' .
CONCATENATE sy-datum+6(2)
sy-datum+4(2)
sy-datum(4)
INTO wa_listheader-info
SEPARATED BY '/'.
APPEND wa_listheader TO it_listheader.
CLEAR wa_listheader.
* Type A is used to display italic font
wa_listheader-typ = 'A'.
wa_listheader-info ='SAP ALV Report'.
APPEND wa_listheader TO it_listheader.
CLEAR wa_listheader.
ENDFORM. " BUILD_ALV_HEADER
*&---------------------------------------------------------------------*
*& Form top_of_page
*&---------------------------------------------------------------------*
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheader.
ENDFORM. "top_of_page