Dynpro Sequences

Use

For the user, an application program consists of a series of screens 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, screens can be programmed to appear in any sequence required. In executable programs, the screen 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 sy-dynnr always contains the number of the current dynpro. Any number of complex dynpro sequences can be called from the dynpros in a single program. For example, it is possible to navigate from one dynpro to any other dynpro in the same program, or repeat part of a sequence any number of times.

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 CALL SCREEN in an ABAP program. When a dynpro sequence is called using the statement CALL SCREEN, it is always embedded in the dynpro sequence of the application program that is already running.

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 SUPPRESS DIALOG, used in a PBO module, prevents a dynpro from being displayed. In this case, the entire PBO and PAI logic is executed, but the screen is not displayed. It can be useful to suppress screens if lists are to be displayed in a dynpro sequence.

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 CALL SCREEN was called, this is a point in the associated ABAP program.

The following sections describe in more detail how to define dynpro sequences.

Leaving a Dynpro from a Program

Calling Dynpro Sequences

Embedding Modal Dialog Boxes

Dynpro Sequences: Example Transaction