I have a requirement where I need to display each group of items as a seperate ALV grid with top of page.
For e.g. if I have 2 sets of data where VBELN is 19 and POSNR is 10 and 20 then the set with VBELN 19 and POSNR 10 is one grid and VBELN 19 and POSNR 20 is another grid.
I have done this but the problem is that when I have more than 3 items it does not fit in the screen! It getting displayed below without the scrolling option.
Please guide me on what needs to be done!
Please find the code below:
DATA: o_top_container TYPE REF TO cl_gui_container, " Top Container
o_bottom_container TYPE REF TO cl_gui_container, " Bottom Container
o_document TYPE REF TO cl_dd_document,
o_docking TYPE REF TO cl_gui_docking_container,
o_split TYPE REF TO cl_gui_easy_splitter_container." cl_gui_splitter_container.
* DESCRIBE TABLE gt_vbap LINES lv_no.
lv_ratio = 50.
LOOP AT gt_vbap INTO ls_vbap.
*Creating Docking Container
CREATE OBJECT o_docking
EXPORTING
side = 2
ratio = lv_ratio.
IF sy-subrc = 0.
*Splitting the Docking container
CREATE OBJECT o_split
EXPORTING
parent = o_docking
sash_position = 20 "Position of Splitter Bar (in Percent)
with_border = 1. "With Border = 1 Without Border = 0
*Placing the containers in the splitter
o_top_container = o_split->top_left_container .
o_bottom_container = o_split->bottom_right_container .
***********
CREATE OBJECT l_tree
EXPORTING
i_parent = o_bottom_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT o_document
EXPORTING
style = 'ALV_GRID'.
ENDIF.
* for adding text in top of page
CALL METHOD o_document->add_text
EXPORTING
text = 'Top of Page '
sap_style = cl_dd_area=>heading
sap_emphasis = cl_dd_area=>strong. " For bold
*Display the data
CALL METHOD o_document->display_document
EXPORTING
parent = o_top_container.
*Calling the method of ALV to process top of page
CALL METHOD l_tree->list_processing_events
EXPORTING
i_event_name = 'TOP_OF_PAGE'
i_dyndoc_id = o_document.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = ls_vbap-vbeln
IMPORTING
output = ls_vbap-vbeln.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = ls_vbap-posnr
IMPORTING
output = ls_vbap-posnr.
LOOP AT gt_final INTO ls_final WHERE vbeln = ls_vbap-vbeln
AND vbpos = ls_vbap-posnr.
APPEND ls_final TO lt_item.
CLEAR ls_final.
ENDLOOP.
CALL METHOD l_tree->set_table_for_first_display
EXPORTING
* it_list_commentary = lt_list_commentary
* i_logo = l_logo
* i_background_id = 'ALV_BACKGROUND'
i_save = 'A'
is_variant = ls_variant
CHANGING
it_sort = lt_sort
it_outtab = lt_item
it_fieldcatalog = lt_fcat.
IF sy-subrc = 0.
CLEAR lt_item[].
ENDIF.
ENDLOOP.