Screens and Screen Sequences
Screens and their flow logic, which together form dynamic programs, are instances that control the flow of an ABAP program by calling a series of dialog modules. Screens can be combined into sequences, where the next screen in the sequence can be defined either statically or dynamically. The simplest screen sequence is a single screen. The sequence starts when you call its first screen. You can do this in a variety of ways.
Calling Screens Internally from the Same ABAP Program
In any ABAP program that can have its own screens (type 1, M, or F), you can use the
CALL SCREEN <dynnr>.
statement to call a screen and its subsequent sequence within that program. The flow logic of each screen calls dialog modules in the program that called the screen.
When the screen sequence ends, control returns to the statement after the original CALL SCREEN statement.
Calling Screens as a Transaction
A transaction (or transaction code) links a screen to a main program (usually a module pool).
You can call a transaction from any ABAP program using the
CALL TRANSACTION <tcod> ...
LEAVE TO TRANSACTION <tcod> ...
statement. The transaction starts with the initial screen that you specified when you defined the transaction code. The program of the transaction is started in a new internal session, and has its own SAP LUW. The screens in the screen sequence call the various dialog modules of the main program.
When the screen sequence is finished, control returns to the program that contained the CALL TRANSACTION statement. If you start a transaction using LEAVE TO TRANSACTION, control returns to the point from which the calling program was started.
Calling Screens as a Dialog Module
A dialog module can be linked to a screen of any main program, usually a module pool.
You can call a dialog module from any ABAP program using the
CALL DIALOG <diag> ...
statement. The dialog module starts with the initial screen that you specified when you defined it. The program of the dialog module is started in a new internal session, and has its own SAP LUW. The screens in the screen sequence call the various dialog modules of the main program.
When the screen sequence ends, control returns to the statement after the dialog module call.
Dialog modules are obsolete, and should no longer be used. Instead, you can encapsulate screen sequences in function groups and call them from an appropriately-programmed function module.
Leaving a Screen Sequence
A screen sequence terminates when a screen ends and the defined next screen has the number 0.
You can leave a single screen within a sequence using the
LEAVE TO SCREEN <dynnr>.
statement. These statements exit the current screen and call the defined next screen. If the next screen is screen 0, the entire screen sequence concludes.
Special Single Screens
There are three special types of screen:
A selection screen is a special screen, created using ABAP statements. You can only call them using the
CALL SELECTION-SCREEN <dynnr> ...
statement. The selection screen is processed (reaction to user input in the selection screen events) in the calling program.
Each screen in a screen sequence has a corresponding list system of twenty levels. You can start this list system using the
LEAVE TO LIST-PROCESSING [AND RETURN TO SCREEN <dynnr>].
statement. This statement calls a system program that contains the standard container screen used for lists. This replaces the current screen. On this screen, you can display a basic list and up to 19 detail lists. List processing (reacting to user actions in list events) takes place in the calling program.
You can leave the list system using the
In an executable program, the list system is automatically called after the last reporting event.
In the PBO event of the flow logic of a screen, you can call a subscreen using the following statement:
CALL SUBSCREEN <area> INCLUDING [<prog>] <dynnr>.
The screen of a subscreen that you call is placed in the subscreen area <area> on the main screen.
If you do not specify a program <prog>, the system uses a screen from the current ABAP program. If you do specify a program <prog>, the system uses a screen from the program <prog> for the subscreen. This program is treated in the same way as an external subroutine call. In other words, it is loaded into the program group of the calling program, or, if it is a function group, as its own program group in the same internal session as the calling ABAP program.