I'm using CL_GUI_ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY and Splittter Containers to displays my ALV Output with TOP-OF-PAGE.
I'm unable to run this program in background. Can you please suggest what steps do I need to include to run this program in background.
My Code:
DATA: OREF_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
OREF_GRID TYPE REF TO CL_GUI_ALV_GRID,
OREF_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT,
OREF_SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
OREF_PARENT_GRID TYPE REF TO CL_GUI_CONTAINER,
OREF_PARENT_HTML TYPE REF TO CL_GUI_CONTAINER.
DATA: ls_layout TYPE lvc_s_layo,
lt_fieldcatalog TYPE lvc_t_fcat.
* Create Container reference
IF oref_container IS NOT BOUND.
CREATE OBJECT oref_container
EXPORTING
container_name = 'CONTAINER'.
ENDIF.
* This is for top of page
"Create TOP-Document
IF oref_dyndoc_id IS NOT BOUND.
CREATE OBJECT oref_dyndoc_id
EXPORTING
style = 'ALV_GRID'.
ENDIF.
* Create Splitter for custom_container
IF oref_splitter IS NOT BOUND.
CREATE OBJECT oref_splitter
EXPORTING
parent = oref_container
rows = 2
columns = 1.
ENDIF.
* Split the custom_container to two containers and move the reference
* to receiving containers oref_parent_html and oref_parent_grid
"Allocating the space for grid and top of page
CALL METHOD oref_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = oref_parent_html.
CALL METHOD oref_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = oref_parent_grid.
* Set height for oref_parent_html
CALL METHOD oref_splitter->set_row_height
EXPORTING
id = 1
height = 25.
* Need to specify parent as splitter part which we alloted for grid
IF oref_grid IS NOT BOUND.
CREATE OBJECT oref_grid
EXPORTING
i_parent = oref_parent_grid.
ENDIF.
SET HANDLER top_of_page FOR oref_grid.
* setting focus for created grid control
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = oref_grid.
*-Build Layout
ls_layout = build_layout( ).
*-Build Fieldcatalog
lt_fieldcatalog = build_fieldcatalog( ).
*- Grid display
CALL METHOD oref_grid->set_table_for_first_display
EXPORTING
is_layout = ls_layout
CHANGING
it_fieldcatalog = lt_fieldcatalog
it_outtab = ct_table
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
ENDIF.
* Initializing document
CALL METHOD oref_dyndoc_id->initialize_document.
* Processing events
CALL METHOD oref_grid->list_processing_events
EXPORTING
i_event_name = 'TOP_OF_PAGE'
i_dyndoc_id = oref_dyndoc_id.
Thanks & Regards,
Adithya M.