无法关闭模式对话框

发布于 2024-12-03 01:48:02 字数 353 浏览 0 评论 0原文

我正在尝试将屏幕称为弹出窗口。屏幕类型设置为模态对话框,我可以调用屏幕,但无法关闭它。当我点击小十字时什么也没有发生。下一个屏幕设置为0

我作为弹出窗口调用的屏幕不包含任何按钮,也不包含任何硬编码的按钮。有什么想法我做错了吗?

我还希望它返回的屏幕能够刷新(因此它会再次加载 PBO)。我该怎么做?

这是代码:

MODULE werkende_knoppen_subscreen INPUT.
  CASE ok_code.
    WHEN 'X'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDMODULE.

I'm trying to call a screen as a popup. The screen type is set to Modal dialog box and I'm able to call the screen, but unable to close it. Nothing happens when I click on the little cross. The next screen is set to 0.

The screen I'm calling as a popup, doesn't contain any buttons, not any hard coded ones anyway. Any ideas what I'm doing wrong?

I'd also like the screen it returns to, to be refreshed (so it loads the PBO again). How do I do that?

Here is the code:

MODULE werkende_knoppen_subscreen INPUT.
  CASE ok_code.
    WHEN 'X'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDMODULE.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

深居我梦 2024-12-10 01:48:02

您应该在弹出窗口的 PAI 部分中检查 'EXIT'(或者,在您的情况下为自定义关闭按钮,'X')用户命令。
例如:

MODULE user_command_0010 INPUT.
  ok = sy-ucomm.
  CLEAR sy-ucomm.
  CASE ok.
    WHEN 'EXIT' OR 'X'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDMODULE.

You should be checking for the 'EXIT' (or, in your case for the custom close button, 'X') user command in the PAI part of your popup.
For example:

MODULE user_command_0010 INPUT.
  ok = sy-ucomm.
  CLEAR sy-ucomm.
  CASE ok.
    WHEN 'EXIT' OR 'X'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDMODULE.
饮湿 2024-12-10 01:48:02

这是一个未记录的功能,但在模式对话框(弹出窗口)中,用于关闭弹出窗口的右上角按钮被分配了 F12 键,因此您必须将此键分配给功能代码并像任何其他功能代码一样处理它。

分步过程:

1) 创建ABAP程序(事务代码SE38SE80

REPORT.

CALL SCREEN 100 STARTING AT 10 10 ENDING AT 60 20.

MODULE status_0100 OUTPUT. " <=== called "before output"
  SET PF-STATUS '0100'.    " <=== choose the GUI status
ENDMODULE.

MODULE user_command_0100 INPUT. " <=== called "after input" (after user action)
  IF sy-ucomm = 'CANCEL'.       " <=== the function code you chose in your GUI status
    SET SCREEN 0.               " <=== 0 is a special number which ends "CALL SCREEN"
  ENDIF.
ENDMODULE.

注意:设置屏幕0是关闭对话框(0表示“当前dynpro序列结束”);如果您有一个复杂的屏幕,您也可以使用 LEAVE TO SCREEN(相当于 2 个语句 SET SCREEN + LEAVE SCREEN)。

2)创建画面0100(事务码SE51或双击CALL SCREEN后面的0100

画面类型:模态对话框

流程逻辑:

PROCESS BEFORE OUTPUT.
  MODULE status_0100.

PROCESS AFTER INPUT.
  MODULE user_command_0100.

3 ) 创建GUI状态0100(事务代码SE41或双击SET PF-STATUS后面的0100

状态类型:对话框

将 F12 键分配给任意功能代码(我选择名称 CANCEL),并激活该功能代码(按钮“功能代码”):
输入图片此处描述

4) 测试

运行程序,您现在可以单击右上角的按钮(或者按 F12 如果您愿意)关闭模式对话框:

在此处输入图像描述

This is a non-documented feature but in a modal dialog box (popup), the top-right button to close the popup is assigned the F12 key, so you must assign this key to a function code and process it as any other function code.

Step-by-step procedure:

1) Create the ABAP program (transaction code SE38 or SE80)

REPORT.

CALL SCREEN 100 STARTING AT 10 10 ENDING AT 60 20.

MODULE status_0100 OUTPUT. " <=== called "before output"
  SET PF-STATUS '0100'.    " <=== choose the GUI status
ENDMODULE.

MODULE user_command_0100 INPUT. " <=== called "after input" (after user action)
  IF sy-ucomm = 'CANCEL'.       " <=== the function code you chose in your GUI status
    SET SCREEN 0.               " <=== 0 is a special number which ends "CALL SCREEN"
  ENDIF.
ENDMODULE.

Note: SET SCREEN 0 is to close the dialog box (0 means "the current dynpro sequence is ended") ; if you have a complex screen you may also use LEAVE TO SCREEN (which is equivalent to the 2 statements SET SCREEN + LEAVE SCREEN).

2) Create the screen 0100 (transaction code SE51 or double-click 0100 behind CALL SCREEN)

Screen type: modal dialog box

Flow logic:

PROCESS BEFORE OUTPUT.
  MODULE status_0100.

PROCESS AFTER INPUT.
  MODULE user_command_0100.

3) Create the GUI status 0100 (transaction code SE41 or double-click 0100 behind SET PF-STATUS)

Status type: dialog box

Assign the F12 key to an arbitrary function code (I chose the name CANCEL), and activate this function code (button "Function Code"):
enter image description here

4) Test

Run the program, you may now click the top-right button (or press F12 if you prefer) which closes the modal dialog box:

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文