SAP ABAP DYNPROS PROCESSING
Get Example source ABAP code based on a different SAP table
ABAP_DYNPRO - Dynpro Flow and Dynpro Sequences
For the user, an application program consists of a series of dynpros that are displayed one after the other. The major difference between the program flow of an executable program and a dialog program is that, in a dialog program, dynpros can be programmed to appear in any sequence required. In executable programs, the dynpro sequence is controlled by events, which occur in a fixed order. In a dialog program, the programmer is free to program any sequence of dynpros, and the user can affect the program flow by his or her actions. However, it is still possible to call a freely defined dynpro sequence within an executable program and hence to branch into a form of dialog program.
Dynpros are always part of an ABAP program. The dialog modules in an ABAP program can only be called from the dynpros in the same program. The system field
IMAGE dynpro_seq_static_next.PNG 525 380
A dynpro sequence is started by calling its first dynpro. This is done either by starting a transaction where the first dynpro is defined or by using the statement
The actual sequence of dynpros is defined by setting the next dynpro for each dynpro in the chain. The dynpro attributes of every dynpro in Screen Painter contain a static next dynpro. This defines a static dynpro sequence. The value of the static next dynpro can be overwritten dynamically in the ABAP processing logic. This enables dynamic dynpro sequences to be defined that change according to user actions.
Dynpro sequences can also be executed without displaying all of the screens. The statement
Dynpro sequences always end when they the number of the next dynpro is zero. For this reason, it is not possible to create dynpros with the number zero. The dynpro number zero is used only to end a dynpro sequence. When a dynpro sequence ends, the system returns to the point from which the first dynpro in the sequence was called. If a transaction code was called, this is the point where the transaction started. If
The following sections describe in more detail how to define dynpro sequences.
In the Screen Painter tool, the dynpro attribute Next Dynpro is defined for every dynpro. This attribute contains the number of the dynpro that follows the current dynpro statically. However, the static attribute is always bypassed if the next dynpro is overwritten dynamically while the dynpro is being executed.
The default next dynpro in Screen Painter is always the number of the dynpro itself. If the default value is used and not overwritten dynamically, the dynpro calls itself recursively. In this case, the sequence consists of a single dynpro only.
If the next dynpro specified has the value zero (or no value at all) and it is not overridden dynamically, the current dynpro is the last in the dynpro sequence. After the dynpro has been processed, control returns to the point from which the dynpro sequence was called. If the dynpro sequence was embedded, the system returns to the calling dynpro sequence. If the dynpro sequence is not embedded, the application program terminates.
IMAGE dynpro_seq_static_next.PNG 517 427
Every dynpro has a static next dynpro that specifies the next dynpro to be called after the current one, as long as it is not overwritten dynamically. In the processing logic, that is, a dialog module called by the dynpro, you can use the
This statement defines a new next dynpro for the current program run. You can also specify the number of the next dynpro as a field containing a dynpro number. The statically defined next dynpro is ignored. However, this only overrides the static dynpro sequence temporarily. The static value for the next dynpro, as defined in the Screen Painter, is always retained.
If you specify the value 0 for next dynpro, the current dynpro becomes the last in the dynpro chain. After the dynpro has been processed, control returns to the point from which the dynpro sequence was called. If the dynpro sequence was embedded, the system returns to the previous dynpro sequence containing the relevant
The
IMAGE dynpro_seq_next_screen.png 531 396
In a program, you can use one of the two following ABAP statements to leave a dynpro:
The
The
There are two ways of calling a dynpro sequence. Starting a sequence from an ABAP program allows you to insert a sequence of dynpros into the existing program flow.
When you use a transaction code to start a dynpro sequence, the corresponding ABAP program is automatically loaded as well. The processing logic of the program is controlled by the dynpro flow logic. On reaching the end of the dynpro sequence (next dynpro 0), the entire application program terminates at the same time. Control returns to the point from which the transaction was called.
IMAGE dynpro_seq_call_scr_transaction.PNG 526 352
You can start a dynpro sequence from an ABAP program using the
IMAGE dynpro_seq_call_scr_prog.PNG 499 333
If you use the
IMAGE dynpro_seq_call_scr_insert_seq.PNG 510 430
This works as a kind of stack, since the
Since during an SAP Web AS ABAP session you are always in a dynpro sequence of some kind, each
Calling a single dynpro is a special case of embedding a dynpro sequence. If you want to prevent the called dynpro from covering the current dynpro completely, you can use the
STARTING AT x1 y1
ENDING AT x2 y2.>
This calls the dynpro number
IMAGE dynpro_seq_call_scr_embed_modal.PNG 507 432