2025 Feb 06 2:42 AM - edited 2025 Feb 07 3:05 PM
No selection screen,I use dialogue to implement it, But this has caused some problems.
When calling ooalv for the first time, Then we updated the message field of ooalv and refreshed the display, everything was normal
When I exit ooalv (LEAVE TO SCREEN 0.), the PBO of the dialog is triggered.Now the screen is on the dialog page。
Then we trigger the PAI event of the dialog again, call OOALV, and the display content of OOALV is exactly the same as the previous time.This is amazing.When I tried to obtain the selected row information, he couldn't capture any data.
I have tried some methods that can serve as a reference
1When calling ooalv, release some resources
2Try using the FREE method
The key code is as follows
REPORT zewme0014 MESSAGE-ID zmm01.
CALL SCREEN 9502.
PROCESS BEFORE OUTPUT.
MODULE status_9502.
MODULE pbo.
CALL SUBSCREEN: sub1 INCLUDING sy-repid '9202'.
CALL SUBSCREEN: sub2 INCLUDING sy-repid '9203'.
CALL SUBSCREEN: sub0 INCLUDING sy-repid call_subscreen.
*
PROCESS AFTER INPUT.
CALL SUBSCREEN: sub1.
CALL SUBSCREEN: sub2.
CALL SUBSCREEN: sub0.
MODULE user_command_9502.
“user_command_9502 to call ooalv”
PROCESS BEFORE OUTPUT.
MODULE status_9005.
MODULE create_a_two-part_container."
MODULE display_ooalv9005."
*
PROCESS AFTER INPUT.
MODULE user_command_9005.
*&---------------------------------------------------------------------*
*& Module CREATE_A_TWO-PART_CONTAINER OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE create_a_two-part_container OUTPUT.
"
CREATE OBJECT go_docking_two_part
EXPORTING
** parent = lo_con
repid = sy-repid
dynnr = sy-dynnr "
side = cl_gui_docking_container=>dock_at_left
extension = 99999 "
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
"引用屏幕容器,进行拆分
CREATE OBJECT go_split_top_two_part
EXPORTING
link_dynnr = sy-dynnr
link_repid = sy-repid
* shellstyle =
* left =
* top =
* width =
* height =
* metric = cntl_metric_dynpro
* align = 15
parent = go_docking_two_part
rows = 2 "2行 ---在这儿决定行和列
columns = 1 "1列
* no_autodef_progid_dynnr =
* name =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module DISPLAY_OOALV9005 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE display_ooalv9005 OUTPUT.
DATA: lo_container1 TYPE REF TO cl_gui_container, "Abstract Container for GUI Controls
lo_container2 TYPE REF TO cl_gui_container.
IF go_control_two_part_1 IS NOT INITIAL
OR go_control_two_part_2 IS NOT INITIAL.
CALL METHOD go_control_two_part_1->set_frontend_layout( gs_layout )."更新自适应
CALL METHOD go_control_two_part_1->refresh_table_display( is_stable = VALUE #( row = abap_true col = abap_true ) )."更新自适应
CALL METHOD go_control_two_part_2->set_frontend_layout( gs_layout )."更新自适应
CALL METHOD go_control_two_part_2->refresh_table_display( is_stable = VALUE #( row = abap_true col = abap_true ) )."更新自适应
ELSE.
"分配容器
lo_container1 = go_split_top_two_part->get_container(
EXPORTING
row = 1
column = 1
).
lo_container2 = go_split_top_two_part->get_container(
EXPORTING
row = 1
column = 1
).
"Init GRID object within container
CREATE OBJECT go_control_two_part_1
EXPORTING
i_parent = lo_container1.
CREATE OBJECT go_control_two_part_2
EXPORTING
i_parent = lo_container2.
"注册事件
IF grt_event_receiver1 IS NOT BOUND.
CREATE OBJECT grt_event_receiver1.
ENDIF.
"------------自定义-------------
* gv_variant-report = sy-repid && '1'.
* gt_fieldcat = gt_fieldcat06.
PERFORM frm_copy_fieldcat.
"------------自定义-------------
"抬头选择屏幕
IF <ft_table_two_part_1> IS ASSIGNED.
SET HANDLER grt_event_receiver1->handle_toolbar_head FOR go_control_two_part_1."注册按钮
SET HANDLER grt_event_receiver1->handle_command FOR go_control_two_part_1."注册COMMAND处理
SET HANDLER grt_event_receiver1->handle_enter2 FOR go_control_two_part_1."回车
go_control_two_part_1->set_table_for_first_display(
EXPORTING
* I_STRUCTURE_NAME = LV_TABLE
i_save = 'A'
is_layout = gs_layout
is_variant = VALUE disvariant( report = sy-repid handle = 'HEAD' )
i_default = abap_true
CHANGING
it_outtab = gt_data7
it_fieldcatalog = gt_fieldcat_two_part_1
).
CALL METHOD go_control_two_part_1->set_toolbar_interactive.
CALL METHOD go_control_two_part_1->register_edit_event( cl_gui_alv_grid=>mc_evt_modified ).
* CALL METHOD go_control_two_part_1->refresh_table_display( is_stable = VALUE #( row = abap_true col = abap_true ) )."更新自适应
ENDIF.
IF <ft_table_two_part_2> IS ASSIGNED.
SET HANDLER grt_event_receiver1->handle_toolbar_item FOR go_control_two_part_2."注册按钮
SET HANDLER grt_event_receiver1->handle_command FOR go_control_two_part_2."注册COMMAND处理
go_control_two_part_2->set_table_for_first_display(
EXPORTING
* I_STRUCTURE_NAME = LV_TABLE
i_save = 'A'
is_layout = gs_layout
is_variant = VALUE disvariant( report = sy-repid handle = 'ITEM' )
i_default = abap_true
CHANGING
it_outtab = <ft_table_two_part_2>
it_fieldcatalog = gt_fieldcat_two_part_2
).
ENDIF.
CALL METHOD go_control_two_part_2->set_toolbar_interactive.
CALL METHOD go_control_two_part_2->register_edit_event( cl_gui_alv_grid=>mc_evt_modified ).
* CALL METHOD go_control_two_part_2->refresh_table_display( is_stable = VALUE #( row = abap_true col = abap_true ) )."更新自适应
ENDIF.
ENDMODULE.
Request clarification before answering.
In module create_a_two-part_container OUTPUT: Check that go_docking_two_part is initial before creating a new object. Same for go_split_top_two_part.
Use both: methods free for containers and controls (first) and clear/free the variables for containers and controls.
I would move "free and clear" to process after input, maybe before leave to screen 0.
Are you sure the part with initializing containers and controls will pass? You have a condition (if p_01 = abap_true). Check it. Use debugging.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
62 | |
8 | |
7 | |
7 | |
5 | |
5 | |
5 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.