Screen返回选择界面的问题
自己写的Report,用到了自己定义的Screen,如何在任何一个Screen直接返回选择界面(1000)?
可以用: SET SCREEN 0.
LEAVE SCREEN.
LEAVE SCREEN.
或者 : LEAVE TO SCREEN 0 .
但是,有时候不是返回选择界面,而是返回了调用这个Screen的地方。
这是因为:
LEAVE TO SCREEN scr. :Leaves the current screen and processes the screen scr.
If scr = 0, processing in CALL mode continues after the CALL SCREEN statement. Otherwise, you branch to the transaction selection screen.
If scr = 0, processing in CALL mode continues after the CALL SCREEN statement. Otherwise, you branch to the transaction selection screen.
所以,如果100调用200,不要用CALL,用Leave to screen 200 .就可以在200直接返回1000了。
下面是一个例子:
REPORT z_scm_ftp_manager NO STANDARD PAGE HEADING .
DATA: ok_code LIKE sy-ucomm .
SELECT-OPTIONS:
s_date FOR sy-datum DEFAULT sy-datum .
s_date FOR sy-datum DEFAULT sy-datum .
START-OF-SELECTION.
CALL SCREEN 100.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'BACK'.
* SET SCREEN 0.
* LEAVE SCREEN.
LEAVE TO SCREEN 0 .
WHEN 'CALLSCR'.
CALL SCREEN 200.
WHEN 'LEAVESCR'.
LEAVE TO SCREEN 200.
ENDCASE.
CLEAR ok_code .
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'BACK'.
* SET SCREEN 0.
* LEAVE SCREEN.
LEAVE TO SCREEN 0 .
WHEN 'CALLSCR'.
CALL SCREEN 200.
WHEN 'LEAVESCR'.
LEAVE TO SCREEN 200.
ENDCASE.
CLEAR ok_code .
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0200 INPUT
*&---------------------------------------------------------------------*
MODULE user_command_0200 INPUT.
CASE ok_code.
WHEN 'BACKBTN'.
SET SCREEN 0.
LEAVE SCREEN.
ENDCASE.
CLEAR ok_code .
ENDMODULE. " USER_COMMAND_0200 INPUT
*&---------------------------------------------------------------------*
*& Module STATUS_0200 OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0200 OUTPUT.
SET PF-STATUS space.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0200 INPUT
*&---------------------------------------------------------------------*
MODULE user_command_0200 INPUT.
CASE ok_code.
WHEN 'BACKBTN'.
SET SCREEN 0.
LEAVE SCREEN.
ENDCASE.
CLEAR ok_code .
ENDMODULE. " USER_COMMAND_0200 INPUT
*&---------------------------------------------------------------------*
*& Module STATUS_0200 OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0200 OUTPUT.
SET PF-STATUS space.
ENDMODULE. " STATUS_0200 OUTPUT