01-23-2007 5:00 PM
Hello everyone,
Can anyone give me any idea how we can print contents of two internal tables of different structures in same screen while we are using GRID display fm. This is working fine in LIST display with fm's like REUSE_ALV_BLOCK_LIST_INIT , BLOCK_LIST_APPEND and BLOCK_LIST_DISPLAY. But what about the same in Grid display?
01-23-2007 5:05 PM
Hi
Yes this is possible using ALV with OO
What you need to is define a docking container using CLASS <b>cl_gui_docking_container</b> for the screen,
then use the split method to split the docking container into two using CLASS <b>cl_gui_easy_splitter_container</b>
then define two alv grids for the two containers defined.
Defining the properties for the ALV grid can be found using any material availble on ABAP OO
Thus both the structures can be on the same screen.
01-30-2007 6:39 PM
hi dominic,
Thanks for ur help. But can u give me a small program code how to use the classes in the program and what about the exporting parameters etc?
with regards,
rajasekhar.
01-23-2007 5:06 PM
Hi
U have to use the OO grid.
U can create two distinct grid but place them in the same dynpro by a container with two area.
Max
01-23-2007 5:36 PM
Hi,
You have to define two containers in a single Screen.
Define two containers on a single screen
DATA: ok_code LIKE sy-ucomm,
g_container TYPE scrfname VALUE 'CUSTOM2',
grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
DATA: i_cat TYPE kkblo_t_fieldcat,
i_fieldcatalog TYPE lvc_t_fcat,
ws_fcat TYPE lvc_s_fcat,
wa_layout TYPE lvc_s_layo.
DATA:
g_container1 TYPE scrfname VALUE 'CUSTOM3',
grid2 TYPE REF TO cl_gui_alv_grid,
g_custom_container1 TYPE REF TO cl_gui_custom_container.
DATA: i_cat1 TYPE kkblo_t_fieldcat,
i_fieldcatalog1 TYPE lvc_t_fcat,
wa_layout1 TYPE lvc_s_layo.
-
Display firstALV
wa_layout-grid_title = text-029.
wa_layout-zebra = 'X'. "Output rows with alternating colors
wa_layout-no_author = 'X'. "Allow users to enter global layouts
wa_layout-sel_mode = 'A'.
wa_layout-cwidth_opt = 'X'.
ws_repid = sy-repid.
*Function module to get the field catalog in the kkblo_t_fieldcat format
CALL FUNCTION 'K_KKB_FIELDCAT_MERGE'
EXPORTING
i_callback_program = ws_repid
i_tabname = 'WS_OPEN_SUM'
i_inclname = ws_repid
CHANGING
ct_fieldcat = i_cat
EXCEPTIONS
inconsistent_interface = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e000 WITH text-003.
ENDIF.
*Function module to get the field catalog in the lvc_t_fieldcat format
CALL FUNCTION 'LVC_TRANSFER_FROM_KKBLO'
EXPORTING
it_fieldcat_kkblo = i_cat
IMPORTING
et_fieldcat_lvc = i_fieldcatalog
EXCEPTIONS
it_data_missing = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e000 WITH text-003.
ENDIF.
LOOP AT i_fieldcatalog INTO ws_fcat.
IF ws_fcat-fieldname = 'BALANCE'. "#CCE
#CCE - IF required
ws_fcat-do_sum = 'X'.
MODIFY i_fieldcatalog FROM ws_fcat.
ENDIF.
ENDLOOP.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
CREATE OBJECT grid1
EXPORTING i_parent = g_custom_container.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
is_layout = wa_layout
CHANGING
it_fieldcatalog = i_fieldcatalog
it_outtab = i_open_sum.
ENDIF.
-
Display second ALV
wa_layout1-grid_title = 'SAP R/3 (GLPCT) Totals'.
wa_layout1-zebra = 'X'. "Output rows with alternating colors
wa_layout1-no_author = 'X'. "Allow users to enter global layouts
wa_layout1-sel_mode = 'A'.
wa_layout1-cwidth_opt = 'X'.
ws_repid = sy-repid.
*Function module to get the field catalog in the kkblo_t_fieldcat format
CALL FUNCTION 'K_KKB_FIELDCAT_MERGE'
EXPORTING
i_callback_program = ws_repid
i_tabname = 'WS_GLPCT_CHK'
i_inclname = ws_repid
CHANGING
ct_fieldcat = i_cat1
EXCEPTIONS
inconsistent_interface = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e000 WITH text-003.
ENDIF.
*Function module to get the field catalog in the lvc_t_fieldcat format
CALL FUNCTION 'LVC_TRANSFER_FROM_KKBLO'
EXPORTING
it_fieldcat_kkblo = i_cat1
IMPORTING
et_fieldcat_lvc = i_fieldcatalog1
EXCEPTIONS
it_data_missing = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e000 WITH text-003.
ENDIF.
LOOP AT i_fieldcatalog1 INTO ws_fcat.
CASE ws_fcat-fieldname.
WHEN 'HSLVT'.
ws_fcat-do_sum = 'X'.
WHEN 'HSL01' OR 'HSL02' OR 'HSL03' OR 'HSL04' OR
'HSL05' OR 'HSL06' OR 'HSL07' OR 'HSL08' OR
'HSL09' OR 'HSL10' OR 'HSL11' OR 'HSL12' OR
'HSL13' OR 'HSL14' OR 'HSL15' OR 'HSL16' .
ws_fcat-no_out = 'X'.
WHEN 'RBUKRS' OR 'RACCT' OR 'RPRCTR' .
ws_fcat-key = 'X'.
ENDCASE.
MODIFY i_fieldcatalog1 FROM ws_fcat.
ENDLOOP.
IF g_custom_container1 IS INITIAL.
CREATE OBJECT g_custom_container1
EXPORTING container_name = g_container1.
CREATE OBJECT grid2
EXPORTING i_parent = g_custom_container1.
CALL METHOD grid2->set_table_for_first_display
EXPORTING
is_layout = wa_layout1
CHANGING
it_fieldcatalog = i_fieldcatalog1
it_outtab = i_glpct_chk.
ENDIF.
-
Then call the screen
Call Screen 9000.
Regards
Subramanian