ABAP Subscreens Tutorial: Call Subscreen in SAP
โก Smart Summary
ABAP Subscreens embed one screen inside an area of another screen at runtime, together with its flow logic. This page explains subscreen areas, the CALL SUBSCREEN statement in PBO and PAI, data transfer, and the restrictions that cause runtime errors.

What is a Subscreen in SAP ABAP?
Before you read this tutorial make sure you know what a Dialog Program is.
- A subscreen is an independent screen that is displayed in an area of another (“main”) screen.
- Subscreens allow you to embed one screen within another at runtime. You can include multiple sub-screens on main screen.
- The term subscreen applies both to the screen that you embed, and the area on the main screen in which you place it. This tutorial is about subscreen areas. The actual screens created through SE51 transaction, are called subscreen screens if defined in screen attributes.
- When you use a subscreen, the flow logic of the embedded screen is also embedded in the flow logic of the main screen.Hence, Using subscreens on screens is like using includes in ABAP programs.
To use a subscreen, you must follow three simple steps
- Define the subscreen area(s) on a screen
- Define suitable subscreen screens
- Include the subscreen screen in the subscreen area.
Also, you need to adjust the frame of sub-screen and main screen. You need to name it in the field name field.
Further, you also need to adjust the fields within the subscreen to make them appear in main screen. In case the sub-screen is defined to be larger than the available area in the main screen, only the part of subscreen will be visible that fits in the the area available. The area is always measured from the top left corner of screen. Hence you should take adequate care while defining sub-screen areas and creating sub-screens.
CALL SUBSCREEN
EXAMPLE
For instance here we have defined two sub-screen areas on main screen and have attached two different Sub-screen to corresponding areas. Whenever main screen is called, the PBO of main screen is called. But before display, the PBO’s of each screen attached with sub-screen areas on main screen are also called.
The screenshot shows the main screen with the two subscreen areas filled by two separate subscreen screens.
You can include a subscreen screen using the CALL SUBSCREEN statement in the flow logic of the main screen.
Calling the subscreen in PBO
To include a subscreen screen in the subscreen area of the main screen and call its PBO flow logic, use the following statement in the PBO event of the main screen:
PROCESS BEFORE OUTPUT. CALL SUBSCREEN <area> INCLUDING [<prog>] <dynp>.
This statement assigns the subscreen screen with number <dynp> to the subscreen area called <area>. You can also specify the program in which the subscreen screen is defined (optional). If you do not specify the program explicitly, the system looks for the subscreen screen in the same ABAP program as the main program. If it does not find a corresponding subscreen screen, a runtime error occurs. The PBO flow logic of the subscreen screen is also included at the same point. This can call PBO modules of the ABAP program in which the subscreen screen is defined. At the end of the subscreen PBO, the global fields from the program are passed to any identically-named screen fields in the subscreen screen. The PBO flow logic of the subscreen screen can itself include further subscreens.
The name <area> of the subscreen area must be entered directly without inverted commas. You can specify the names <prog> and <dynp> either as literals or variables. If you use variables, you must declare and fill identically-named variables in the ABAP program. The screen number <dynp> must be 4 characters long. If you do not assign a subscreen screen to an area, it remains empty.
Calling the subscreen in PAI
To call the PAI flow logic of the subscreen screen, use the following statement in the PAI flow logic of the main screen:
PROCESS AFTER INPUT. CALL SUBSCREEN <area>.
This statement includes the PAI flow logic of the subscreen screen included in the subscreen area <area> in the PBO event. This can call PAI modules of the ABAP program in which the subscreen screen is defined. Data is transported between identically-named fields in the subscreen screen and the ABAP program either when the PAI event is triggered, or at the corresponding FIELD statements in the PAI flow logic of the subscreen screen.
How to Create and Embed a Subscreen
The three steps listed earlier are carried out in the Screen Painter and in the flow logic of the main screen. The sequence below creates one main screen with a single subscreen area.
- Create the subscreen area: Open the main screen, for example screen 100, in the Screen Painter (SE51). Choose the Subscreen element from the element bar, draw it on the layout, and enter a name such as SUB_AREA in the Name field. That name is used later in the CALL SUBSCREEN statement.
- Create the subscreen screen: Create a second screen, for example screen 110, and set its screen type to Subscreen in the attributes. A subscreen screen has no OK code field and no GUI status of its own.
- Place the fields: Draw the input fields on screen 110. Keep the layout inside the size of the subscreen area, because only the part that fits is displayed, measured from the top left corner.
- Declare the global data: Put the fields in the TOP include of the module pool, so both the main screen and the subscreen read the same global variables.
- Call the subscreen: Add CALL SUBSCREEN to the PBO and to the PAI of the main screen, as shown below.
- Activate and test: Activate the screens and the program, then start the transaction. The subscreen area is filled by screen 110, and its modules run inside the flow logic of screen 100.
* Flow logic of the main screen 100 PROCESS BEFORE OUTPUT. MODULE status_0100. CALL SUBSCREEN sub_area INCLUDING 'SAPMZDEMO' '0110'. PROCESS AFTER INPUT. CALL SUBSCREEN sub_area. MODULE user_command_0100.
๐ก Tip: Store the screen number in a global variable instead of a literal when the area has to show a different subscreen depending on the user input. The variable must carry the same name in the program and in the CALL SUBSCREEN statement.
Points to Remember
- Names of elements of sub-screens within a screen should be unique
- You should not have OK_CODE or FCODE attached with sub-screen. The OK_CODE of main screen itself is OK_CODE of sub-screen
- Sub-screens cannot have any dialog modules containing SET TITLEBAR, SET PF-STATUS, SET SCREEN, LEAVE SCREEN or LEAVE TO SCREEN. This will cause runtime error.
- You need to call it in the flow logic (both PBO and PAI) of the main screen.
- CALL SUBSCREEN is not allowed in CHAIN..ENDCHAIN and LOOP ENDLOOP statements
- Can not have an AT EXIT-COMMAND module
- The fields that you use are the global fields. They must be declared in the top include
- If using subscreens from another dialog program the data transfer will not happen unless you add specific code.
โ ๏ธ Warning: Placing CALL SUBSCREEN inside CHAIN … ENDCHAIN or inside a screen LOOP produces a syntax error, and calling a screen number that does not exist produces a runtime error at the first display.

