在 dynpro 技术中,要将屏幕“A”包含到屏幕“B”中,屏幕“A”必须定义为子屏幕,屏幕“B”必须定义“子屏幕区域”以包含屏幕“A” . 屏幕“B”的流程逻辑必须包含语句CALL SUBSCREEN <subscreen_area> INCLUDING ...
,该语句引用子屏幕编号以静态或通过全局变量包含。
与普通屏幕一样,选择屏幕也可以定义为子屏幕,方法是将其定义为“独立选择屏幕”(将其元素包装在 ABAP 语句SELECTION-SCREEN BEGIN OF SCREEN <any-screen-number>
和中),并在之后SELECTION-SCREEN END OF SCREEN <any-screen-number>
添加单词“AS SUBSCREEN”BEGIN OF SCREEN <any-screen-number>
)。例如:
SELECTION-SCREEN BEGIN OF SCREEN 1001 AS SUBSCREEN.
PARAMETERS test AS CHECKBOX.
SELECTION-SCREEN END OF SCREEN 1001.
如果您必须包含尚未定义为子屏幕的现有选择屏幕,则有两种主要可能性:
- 如果它已经被定义为“独立屏幕”(带有
SELECTION-SCREEN BEGIN OF SCREEN ...
),并且它只能用作子屏幕,您可以简单地AS SUBSCREEN
按照上面的说明添加。
- 如果它必须同时用作子屏幕和普通屏幕,那么最简单的解决方案是将其元素包装在一个块中(ABAP 语句
SELECTION-SCREEN BEGIN OF BLOCK <block ID>
和SELECTION-SCREEN END OF BLOCK <block ID>
),并定义另一个包含该块的选择屏幕(ABAP 语句SELECTION-SCREEN INCLUDE BLOCKS <block ID>
)。
以下是案例 2 的两个示例。
示例 1,使用默认选择屏幕(1000 cf 脚注)
REPORT zprg1.
PARAMETERS test AS CHECKBOX. " screen 1000 cf footnote
REPORT zprg1.
SELECTION-SCREEN BEGIN OF BLOCK b1000.
PARAMETERS test AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b1000.
SELECTION-SCREEN BEGIN OF SCREEN 1001 AS SUBSCREEN.
SELECTION-SCREEN INCLUDE BLOCKS b1000.
SELECTION-SCREEN END OF SCREEN 1002.
带有独立选择屏幕的示例 2(1002,包括使用CALL SUBSCREEN subarea INCLUDING 'ZPRG1' '1002'.
)
REPORT zprg1.
SELECTION-SCREEN BEGIN OF SCREEN 1002.
PARAMETERS test AS CHECKBOX.
SELECTION-SCREEN END OF SCREEN 1002.
REPORT zprg1.
SELECTION-SCREEN BEGIN OF SCREEN 1002.
SELECTION-SCREEN BEGIN OF BLOCK b1002.
PARAMETERS test AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b1002.
SELECTION-SCREEN END OF SCREEN 1002.
SELECTION-SCREEN BEGIN OF SCREEN 1003 AS SUBSCREEN.
SELECTION-SCREEN INCLUDE BLOCKS b1002.
SELECTION-SCREEN END OF SCREEN 1003.
脚注:
(1) 未放置在内部的选择屏幕参数SELECTION-SCREEN BEGIN OF SCREEN ... END OF SCREEN ...
隐含地属于“默认选择屏幕”( 1000
)。请注意,使用SELECTION-SCREEN BEGIN OF SCREEN 1000...
会导致语法错误。