Hi, Follow the following code:
REPORT alv_top_of_page.
TABLES : t001.
TYPE-POOLS: slis.
DATA : w_repid LIKE sy-repid.
TYPES : BEGIN OF ty_comp.
INCLUDE STRUCTURE t001.
TYPES : END OF ty_comp.
DATA: wa_layout TYPE slis_layout_alv.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA : it_comp TYPE TABLE OF ty_comp.
INITIALIZATION.
w_repid = sy-repid.
START-OF-SELECTION.
SELECT * FROM t001 INTO TABLE it_comp.
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = w_repid
i_internal_tabname = 'IT_COMP'
i_inclname = w_repid
CHANGING
ct_fieldcat = it_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
is_layout = wa_layout
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_comp
EXCEPTIONS
program_error = 1
OTHERS = 2.
&----
*& Form html_top_of_page
&----
FORM html_top_of_page USING document TYPE REF TO cl_dd_document.
DATA: text TYPE sdydo_text_element.
CALL METHOD document->add_gap
EXPORTING
width = 100.
text = 'Company Code Data'.
CALL METHOD document->add_text
EXPORTING
text = text
sap_style = 'HEADING'.
CALL METHOD document->new_line.
CALL METHOD document->new_line.
CALL METHOD document->new_line.
text = 'User Name : '.
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = 'Strong'.
CALL METHOD document->add_gap
EXPORTING
width = 6.
text = sy-uname.
CALL METHOD document->add_text
EXPORTING
text = text
sap_style = 'Key'.
CALL METHOD document->add_gap
EXPORTING
width = 50.
text = 'Date : '.
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = 'Strong'.
CALL METHOD document->add_gap
EXPORTING
width = 6.
text = sy-datum.
CALL METHOD document->add_text
EXPORTING
text = text
sap_style = 'Key'.
CALL METHOD document->add_gap
EXPORTING
width = 50.
text = 'Time : '.
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = 'Strong'.
CALL METHOD document->add_gap
EXPORTING
width = 6.
text = sy-uzeit.
CALL METHOD document->add_text
EXPORTING
text = text
sap_style = 'Key'.
CALL METHOD document->new_line.
CALL METHOD document->new_line.
ENDFORM. "HTML_TOP_OF_PAGE
Regards,
DS
Hi Sameer,
try with this code..
DATA : g_position TYPE i,
g_length TYPE i,
g_timestamp(15) TYPE c,
g_page(4),
g_jobname LIKE tbtcm-jobname,
g_system(15),
gv_time(8),
gv_date(10),
wa_header TYPE slis_listheader.
Move the Report header text
wa_header-typ = 'H'.
wa_header-info = text-008.
APPEND wa_header TO t_header.
CLEAR wa_header.
Move the Report header text
wa_header-typ = 'H'.
wa_header-info = report_header.
APPEND wa_header TO t_header.
CLEAR wa_header.
System and client information
wa_header-typ = 'S'.
wa_header-key = text-001. "'System & Client'.
CONCATENATE sy-sysid '/' sy-mandt INTO wa_header-info.
APPEND wa_header TO t_header.
CLEAR wa_header.
User id running the executables.
wa_header-typ = 'S'.
wa_header-key = text-004. "'Userid'.
wa_header-info = sy-uname.
APPEND wa_header TO t_header.
CLEAR wa_header.
wa_header-typ = 'S'.
wa_header-key = text-005 ."'Date'.
wa_header-info = gv_date .
APPEND wa_header TO t_header.
CLEAR wa_header.
Convert time stamp
MOVE: syst-uzeit+0(2) TO gv_time(2),
':' TO gv_time+2(1),
sy-uzeit2(2) TO gv_time3(2),
':' TO gv_time+5(1),
sy-uzeit4(2) TO gv_time6(2).
wa_header-typ = 'S'.
wa_header-key = text-003 . "'Time'.
wa_header-info = gv_time .
APPEND wa_header TO t_header.
CLEAR wa_header.
Page number information
wa_header-typ = 'S'.
wa_header-key = text-009 ."'Page Number'.
g_page = sy-pagno.
IF g_page = 0.
g_page = 1.
ENDIF.
SHIFT g_page LEFT DELETING LEADING space.
wa_header-info = g_page.
APPEND wa_header TO t_header.
CLEAR wa_header.
Thanks,
murali
Add a comment