0% found this document useful (0 votes)
8 views2 pages

ALV Grid TOP_OF_PAGE Character Limit Fix

This document discusses how to print more than 60 characters in the top-of-page area of an ALV grid, which is normally limited to 60 characters. It proposes using a dynamic document via the CL_DD_DOCUMENT class, which allows HTML formatting. The solution calls a subroutine to generate HTML for the top of page, and passes it to the ALV function module via the I_CALLBACK_HTML_TOP_OF_PAGE parameter instead of triggering the TOP_OF_PAGE event. This overcomes the 60 character limitation by using the HTML viewer control instead.

Uploaded by

sona352
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

ALV Grid TOP_OF_PAGE Character Limit Fix

This document discusses how to print more than 60 characters in the top-of-page area of an ALV grid, which is normally limited to 60 characters. It proposes using a dynamic document via the CL_DD_DOCUMENT class, which allows HTML formatting. The solution calls a subroutine to generate HTML for the top of page, and passes it to the ALV function module via the I_CALLBACK_HTML_TOP_OF_PAGE parameter instead of triggering the TOP_OF_PAGE event. This overcomes the 60 character limitation by using the HTML viewer control instead.

Uploaded by

sona352
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

Problem with ALV Grid Top-of-Page - How to print more than 60 characters?

By Joyjit Ghosh, IBM India


Problem: Normally in ALV grid TOP_OF_PAGE, we cannot display information of more than 60 characters long. This is due to the limitation of the FM REUSE_ALV_COMMENTARY_WRITE. Usually we call this FM from the subroutine that is linked with TOP_OF_PAGE event. CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING it_list_commentary = i_logo = i_end_of_list_grid = . *"--------------------------------------------------------------*"*"Lokale Schnittstelle: *" IMPORTING *" VALUE(IT_LIST_COMMENTARY) TYPE SLIS_T_LISTHEADER *" REFERENCE(I_LOGO) OPTIONAL *" REFERENCE(I_END_OF_LIST_GRID) OPTIONAL *"-------------------------------------------------------------In this above FM, exporting parameter IT_LIST_COMMENTARY contains a field INFO that is only 60 characters long. And it is responsible for displaying the information in the TOP_OF_PAGE area. Solution: To overcome this limitation we can use dynamic document, which can be implemented through the class CL_DD_DOCUMENT. As dynamic documents use HTML viewer control so instead of triggering the TOP_OF_PAGE event we should trigger event of HTML TOP_OF_PAGE. First create a subroutine for top of page in HTML format and send that name in I_CALLBACK_HTML_TOP_OF_PAGE parameter of ALV function module. The input parameter for this subroutine will be a variable of class CL_DD_DOCUMENT. *-----------------------------------------------------------------* * FORM html_top_of_page * *-----------------------------------------------------------------* FORM html_top_of_page USING top TYPE REF TO cl_dd_document. data: l_text(255) type c. do 180 times. l_text+sy-index(1) = '*'. enddo. CALL METHOD top->add_text EXPORTING text = 'Hello world ' sap_style = 'heading' . CALL METHOD top->add_gap EXPORTING width = 200. CALL METHOD top->add_picture EXPORTING picture_id = 'ENJOYSAP_LOGO'. CALL METHOD top->NEW_LINE( ). CALL METHOD top->add_text EXPORTING text = l_text. ENDFORM. * Display ALV grid CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING

i_callback_html_top_of_page i_callback_program i_structure_name TABLES t_outtab Output:

= 'HTML_TOP_OF_PAGE' = g_repid = 'SFLIGHT' = gt_outtab.

Limitations: As dynamic documents use SAP HTML Viewer control internally, so whatever limitations exist for SAP HTML Viewer, same limitations hold true for dynamic documents also.

You might also like