Entering content frame

Selection Screens as Subscreens Locate the document in its SAP Library structure

In the same way that you can define a screen as a subscreen in the Screen Painter, it is now possible to define selection screens as subscreens in an ABAP program:

SELECTION-SCREEN BEGIN OF SCREEN scrn AS SUBSCREEN
                                     [NO INTERVALS]
                                     [NESTING LEVEL n].
  ...
SELECTION-SCREEN END OF SCREEN scrn.

Selection screens that you define in this way can be included in:

        Subscreens on screens

        Tabstrip Controls on screens

        Tabstrip Controls on Selection Screens

You cannot call them using CALL SELECTION-SCREEN.

If you use the NO INTERVALS addition, the subscreen is made smaller and the selection criteria are all displayed with single input fields.

The NESTING LEVEL also reduces the size of the subscreen. You can use it to prevent scrollbars from appearing when you use the subscreen in a tabstrip control on the selection screen and the tabstrip already has a frame. If there is no frame around the tabstrip control, use NESTING LEVEL 0. For each frame around the tabstrip control, increase NESTING LEVEL by one.

When you include a selection screen as a subscreen on a screen or in a tabstrip control on a screen, you should remember that the CALL SUBSCREENstatement is executed in both the PBO and PAI events in the screen flow logic. Although you cannot program PAI modules for selection screens as subscreens, the CALL SUBSCREEN statement ensures that the input data is transferred to the ABAP program in the PAI event.

As on normal selection screens, the usual permitted user actions trigger the usual selection screen processing. This allows you to check user input or process function codes.

Examples

Example

Selection screens as subscreens on screens.

REPORT demo_sel_screen_as_subscreen.

SELECTION-SCREEN BEGIN OF SCREEN 1100 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-010.
PARAMETERS: p1(10) TYPE c,
            p2(10) TYPE c,
            p3(10) TYPE c.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN END OF SCREEN 1100.

SELECTION-SCREEN BEGIN OF SCREEN 1200 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-020.
PARAMETERS: q1(10) TYPE c OBLIGATORY,
            q2(10) TYPE c OBLIGATORY,
            q3(10) TYPE c OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN END OF SCREEN 1200.

DATA: ok_code TYPE sy-ucomm,
      save_ok TYPE sy-ucomm.

DATA: number(4) TYPE n VALUE '1100'.

START-OF-SELECTION.
  CALL SCREEN 100.

MODULE status_0100 OUTPUT.
  SET PF-STATUS 'SCREEN_100'.
ENDMODULE.

MODULE cancel INPUT.
  LEAVE PROGRAM.
ENDMODULE.

MODULE user_command_0100 INPUT.
  save_ok = ok_code.
  CLEAR ok_code.
  CASE save_ok.
    WHEN 'BUTTON1'.
      number = 1100.
    WHEN 'BUTTON2'.

      number = 1200.
  ENDCASE.

ENDMODULE.

AT SELECTION-SCREEN.
  MESSAGE s888(sabapdocu) WITH text-030 sy-dynnr.

This defines two selection screens – 1100 and 1200 – as subscreens.

The next screen number of screen 100 is 100 (statically-defined). Its layout is as follows:

This graphic is explained in the accompanying text

The screen contains a subscreen area area and two pushbuttons with the function codes BUTTON1 and BUTTON2.

The screen flow logic for screen 100 is as follows:

PROCESS BEFORE OUTPUT.
  MODULE status_0100.
  CALL SUBSCREEN area INCLUDING sy-repid number.

PROCESS AFTER INPUT.
  MODULE cancel AT EXIT-COMMAND.
  CALL SUBSCREEN area.
  MODULE user_command_0100.

When you run the program, a screen appears on which selection screen 1100 is displayed as a subscreen. You can display either selection screen in the subscreen area, using the pushbuttons to switch between them. Before you switch from selection screen 1200 to 1100, you must fill out the obligatory fields. The data you enter is available to the program in the parameters in the PAI event.

Example

Selection screens as subscreens in a tabstrip control on a screen.

REPORT demo_sel_screen_in_tabstrip.

SELECTION-SCREEN BEGIN OF SCREEN 1100 AS SUBSCREEN
                                      NO INTERVALS.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-010.
PARAMETERS: p1(10) TYPE c,
            p2(10) TYPE c,
            p3(10) TYPE c.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN END OF SCREEN 1100.

SELECTION-SCREEN BEGIN OF SCREEN 1200 AS SUBSCREEN
                                      NO INTERVALS.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-020.
PARAMETERS: q1(10) TYPE c OBLIGATORY,
            q2(10) TYPE c OBLIGATORY,
            q3(10) TYPE c OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN END OF SCREEN 1200.

CONTROLS mytabstrip TYPE TABSTRIP.

DATA: ok_code TYPE sy-ucomm,
      save_ok TYPE sy-ucomm.

DATA: number(4) TYPE n VALUE '1100'.

START-OF-SELECTION.
  mytabstrip-activetab = 'BUTTON1'.
  CALL SCREEN 100.

MODULE status_0100 OUTPUT.
  SET PF-STATUS 'SCREEN_100'.
ENDMODULE.

MODULE cancel INPUT.
  LEAVE PROGRAM.
ENDMODULE.

MODULE user_command_0100 INPUT.
  save_ok = ok_code.
  CLEAR ok_code.
  CASE save_ok.
    WHEN 'BUTTON1'.
      mytabstrip-activetab = save_ok.
      number = 1100.
    WHEN 'BUTTON2'.

      mytabstrip-activetab = save_ok.
      number = 1200.
  ENDCASE.

ENDMODULE.

AT SELECTION-SCREEN.
  MESSAGE s888(sabapdocu) WITH text-030 sy-dynnr.

This defines two selection screens – 1100 and 1200 – as subscreens.

The next screen number of screen 100 is 100 (statically-defined). Its layout is as follows:

This graphic is explained in the accompanying text

The screen contains a tabstrip area called mytabstrip with three tab titles BUTTON1, BUTTON2 and BUTTON3. The function codes have the same name, and no special function type. All of the tab titles are assigned to a single subscreen area area .

The screen flow logic for screen 100 is as follows:

PROCESS BEFORE OUTPUT.
  MODULE status_0100.
  CALL SUBSCREEN area INCLUDING sy-repid number.

PROCESS AFTER INPUT.
  MODULE cancel AT EXIT-COMMAND.
  CALL SUBSCREEN area.
  MODULE user_command_0100.

This example is programmed in almost exactly the same way as the last one, and behaves in the same way. The only difference is that the pushbuttons have been replaced with tab titles, and the control mytabstrip has been declared and filled. Scrolling between the tab pages is programmed in the ABAP program. Each time the user chooses a tab title, the function code from the OK field is assigned to the activetab component of structure mytabstrip. At the same time, the variable number is filled with the screen number of the subscreen that has to be displayed in the subscreen area area of the tabstrip control.

 

 

Leaving content frame