2023 Jun 07 8:55 AM
Hi guys, can u pls help me with it.
I created a grid , which i show after selection screen, then i add a button at alvgrid toolbar. When i click it i want to show values inside listview. But now it's not working like that, after i click it it just shows me the same grid at the second screen. I use cl_gui_alv_grid and set_table_for_first_display at the first, but why it showing at the second?
i did exactly the same few months ago, but i used handle_double_click and showed 2 grids(not grid and listview, as i want now), and don't understand why it works wrong
with handle_user_command and how make it right.
here's my code:
SET HANDLER mo_controller->handle_user_command for lo_alv.
SET HANDLER mo_controller->handle_toolbar FOR lo_alv .
lo_alv->set_table_for_first_display(
EXPORTING
is_layout = ls_layout
i_save = 'A'
is_variant = w_variant
CHANGING
it_outtab = <gfs_dyn_table>
it_fieldcatalog = gt_fieldcat ).
METHOD handle_user_command.
case e_ucomm.
when 'EXCH'.
call screen 1200.
endcase.
ENdMETHOD.
MODULE STATUS_1200 OUTPUT.
SET PF-STATUS '1200'.
SET TITLEBAR '1200'.
IF lo_custom_container2 IS INITIAL.
CREATE OBJECT lo_custom_container2
EXPORTING
container_name = lv_container2.
CREATE OBJECT lo_alv2
EXPORTING
i_parent = lo_custom_container2.
endif.
ENDMODULE.
2023 Jun 07 12:29 PM
even if i try to replace all components of grid at the second screen, it still show me first grid
MODULE STATUS_1200 OUTPUT.
SET PF-STATUS '1200'.
SET TITLEBAR '1200'.
IF lo_custom_container2 IS INITIAL.
CREATE OBJECT lo_custom_container2
EXPORTING
container_name = lv_container2.
CREATE OBJECT lo_alv2
EXPORTING
i_parent = lo_custom_container2.
data : qr_tab type TABLE OF mara.
data : gt_fieldcat2 TYPE lvc_t_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 'MARA'
I_BYPASSING_BUFFER = 'X'
CHANGING
CT_FIELDCAT = gt_fieldcat2
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
select * from mara into table qr_tab up to 10 ROWS.
lo_alv2->set_table_for_first_display(
EXPORTING
is_layout = ls_layout
i_save = 'A'
is_variant = w_variant
CHANGING
it_outtab = qr_tab
it_fieldcatalog = gt_fieldcat2 ).
endif.
ENDMODULE. " STATUS_1200 OUTPUT