Return dynpro 序列返回两个屏幕
Return two screens back in dynpro sequence
我想开发如下逻辑:
方框“DISPLAY ALV
”对应功能模块REUSE_ALV_GRID_DISPLAY
.
使用 LEAVE TO SCREEN 0
我无法直接传递给 DISPLAY ALV
。可能吗?
谢谢。
我不能肯定这是否有效,但你应该试试 'set screen 0'。我最近不得不在将 'refresh' 按钮编程到我的 ALV 报告后执行此操作,因为在刷新并重新显示数据后,需要多次 'green arrow' 点击才能退出报告。
不,你不能像你打算的那样return到FM,因为FM是一个特殊的可调用单元并且LEAVE TO SCREEN
语句有效仅适用于屏幕。但是,您可以 return 到显示 ALV 的屏幕 100。
考虑以下编码,您应该在屏幕 100 和 300 上使用自定义容器 100_CONT
和 300_CONT
。
屏幕 100 PBO
MODULE pbo_100 OUTPUT.
SET PF-STATUS 'YOUR_PF_STATUS'.
IF custom_container1 IS INITIAL.
SELECT *
FROM mara AS m
INTO TABLE gt_mara
WHERE EXISTS ( SELECT * FROM vbrp WHERE matnr = m~matnr ).
CREATE OBJECT custom_container1
EXPORTING
container_name = cont_on_main.
CREATE OBJECT grid1
EXPORTING
i_parent = custom_container1.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'mara'
is_layout = gs_layout
CHANGING
it_outtab = gt_mara.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_double_click FOR grid1.
ENDIF.
ENDMODULE. " PBO_100 OUTPUT
屏幕 300 PBO
MODULE pbo_0300 OUTPUT.
IF custom_container2 IS INITIAL.
CREATE OBJECT custom_container2
EXPORTING
container_name = cont_on_dialog.
CREATE OBJECT grid2
EXPORTING
i_parent = custom_container2.
gs_layout-grid_title = 'Orders'.
CALL METHOD grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'VBRP'
is_layout = gs_layout
CHANGING
it_outtab = gt_vbrp.
ELSE.
CALL METHOD grid2->refresh_table_display.
ENDIF.
ENDMODULE. " PBO_0300 OUTPUT
屏幕300PAI
MODULE pai_0300 INPUT.
CASE ok_code.
WHEN 'RETURN'.
DATA: ans.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'SO sample'
text_question = 'Select next action'
text_button_1 = 'Yes'
icon_button_1 = 'ICON_CHECKED'
text_button_2 = 'No'
icon_button_2 = 'ICON_CANCEL'
display_cancel_button = ' '
IMPORTING
answer = ans.
CASE ans.
WHEN 1.
LEAVE TO SCREEN 0.
WHEN 2.
LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE.
ENDCASE.
CLEAR ok_code.
ENDMODULE.
主程序
CLASS lcl_event_receiver DEFINITION DEFERRED.
DATA: ok_code LIKE sy-ucomm,
gt_mara TYPE TABLE OF mara,
gt_vbrp TYPE TABLE OF vbrp,
grid1 TYPE REF TO cl_gui_alv_grid,
grid2 TYPE REF TO cl_gui_alv_grid,
cont_on_main TYPE scrfname VALUE '100_CONT',
cont_on_dialog TYPE scrfname VALUE '300_CONT',
custom_container1 TYPE REF TO cl_gui_custom_container,
custom_container2 TYPE REF TO cl_gui_custom_container,
event_receiver TYPE REF TO lcl_event_receiver.
START-OF-SELECTION.
CALL SCREEN 100.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS: handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_double_click.
READ TABLE gt_mara INDEX e_row-index ASSIGNING FIELD-SYMBOL(<fs_mara>).
SELECT *
INTO TABLE gt_vbrp
FROM vbrp
WHERE matnr = <fs_mara>-matnr.
CALL SCREEN 300 STARTING AT 10 5.
ENDMETHOD.
ENDCLASS.
在程序启动时,我们在系统中获取 material 销售订单列表,然后在屏幕 100 上双击,这些订单将显示在屏幕 300 中。
通过带有功能代码RETURN
的特殊按钮(你应该把它放在屏幕300上)我们调用弹出窗口window来与用户交互。按 Yes return 到初始屏幕 100,按 No 程序完全中断。
这里你应该注意语句 LEAVE TO SCREEN 0
终止当前 dynpro 序列(即 300),因此 returns 到 100。
我想开发如下逻辑:
方框“DISPLAY ALV
”对应功能模块REUSE_ALV_GRID_DISPLAY
.
使用 LEAVE TO SCREEN 0
我无法直接传递给 DISPLAY ALV
。可能吗?
谢谢。
我不能肯定这是否有效,但你应该试试 'set screen 0'。我最近不得不在将 'refresh' 按钮编程到我的 ALV 报告后执行此操作,因为在刷新并重新显示数据后,需要多次 'green arrow' 点击才能退出报告。
不,你不能像你打算的那样return到FM,因为FM是一个特殊的可调用单元并且LEAVE TO SCREEN
语句有效仅适用于屏幕。但是,您可以 return 到显示 ALV 的屏幕 100。
考虑以下编码,您应该在屏幕 100 和 300 上使用自定义容器 100_CONT
和 300_CONT
。
屏幕 100 PBO
MODULE pbo_100 OUTPUT.
SET PF-STATUS 'YOUR_PF_STATUS'.
IF custom_container1 IS INITIAL.
SELECT *
FROM mara AS m
INTO TABLE gt_mara
WHERE EXISTS ( SELECT * FROM vbrp WHERE matnr = m~matnr ).
CREATE OBJECT custom_container1
EXPORTING
container_name = cont_on_main.
CREATE OBJECT grid1
EXPORTING
i_parent = custom_container1.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'mara'
is_layout = gs_layout
CHANGING
it_outtab = gt_mara.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_double_click FOR grid1.
ENDIF.
ENDMODULE. " PBO_100 OUTPUT
屏幕 300 PBO
MODULE pbo_0300 OUTPUT.
IF custom_container2 IS INITIAL.
CREATE OBJECT custom_container2
EXPORTING
container_name = cont_on_dialog.
CREATE OBJECT grid2
EXPORTING
i_parent = custom_container2.
gs_layout-grid_title = 'Orders'.
CALL METHOD grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'VBRP'
is_layout = gs_layout
CHANGING
it_outtab = gt_vbrp.
ELSE.
CALL METHOD grid2->refresh_table_display.
ENDIF.
ENDMODULE. " PBO_0300 OUTPUT
屏幕300PAI
MODULE pai_0300 INPUT.
CASE ok_code.
WHEN 'RETURN'.
DATA: ans.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'SO sample'
text_question = 'Select next action'
text_button_1 = 'Yes'
icon_button_1 = 'ICON_CHECKED'
text_button_2 = 'No'
icon_button_2 = 'ICON_CANCEL'
display_cancel_button = ' '
IMPORTING
answer = ans.
CASE ans.
WHEN 1.
LEAVE TO SCREEN 0.
WHEN 2.
LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE.
ENDCASE.
CLEAR ok_code.
ENDMODULE.
主程序
CLASS lcl_event_receiver DEFINITION DEFERRED.
DATA: ok_code LIKE sy-ucomm,
gt_mara TYPE TABLE OF mara,
gt_vbrp TYPE TABLE OF vbrp,
grid1 TYPE REF TO cl_gui_alv_grid,
grid2 TYPE REF TO cl_gui_alv_grid,
cont_on_main TYPE scrfname VALUE '100_CONT',
cont_on_dialog TYPE scrfname VALUE '300_CONT',
custom_container1 TYPE REF TO cl_gui_custom_container,
custom_container2 TYPE REF TO cl_gui_custom_container,
event_receiver TYPE REF TO lcl_event_receiver.
START-OF-SELECTION.
CALL SCREEN 100.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS: handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_double_click.
READ TABLE gt_mara INDEX e_row-index ASSIGNING FIELD-SYMBOL(<fs_mara>).
SELECT *
INTO TABLE gt_vbrp
FROM vbrp
WHERE matnr = <fs_mara>-matnr.
CALL SCREEN 300 STARTING AT 10 5.
ENDMETHOD.
ENDCLASS.
在程序启动时,我们在系统中获取 material 销售订单列表,然后在屏幕 100 上双击,这些订单将显示在屏幕 300 中。
通过带有功能代码RETURN
的特殊按钮(你应该把它放在屏幕300上)我们调用弹出窗口window来与用户交互。按 Yes return 到初始屏幕 100,按 No 程序完全中断。
这里你应该注意语句 LEAVE TO SCREEN 0
终止当前 dynpro 序列(即 300),因此 returns 到 100。