Screen Flow Logic
Screen flow logic contains the procedural part of a screen. You create it in the flow logic editor in the Screen Painter, which is very similar to the ABAP Editor. The language used to program screen flow logic has a similar syntax to ABAP, but is not part of ABAP itself. It is sometimes referred to as screen language.
Unlike ABAP programs, screen flow logic contains no explicit data declarations. You define screen fields by placing elements on the screen mask.
The screen flow logic is like an ABAP program in that it serves as a container for processing blocks. There are four event blocks, each of which is introduced with the screen keyword PROCESS:
PROCESS BEFORE OUTPUT.
...
PROCESS AFTER INPUT.
...
PROCESS ON HELP-REQUEST.
...
PROCESS ON VALUE-REQUEST.
...
As in ABAP, the event block is introduced by the corresponding keyword statement, and it concludes either when the next block is introduced, or at the end of the program. The first two statements are created automatically by the Screen Painter when you create a new screen. The corresponding events are triggered by the runtime environment:
· PROCESS BEFORE OUTPUT (PBO) is automatically triggered after the PAI processing of the previous screen and before the current screen is displayed. You can program the PBO processing of the screen in this block. At the end of the PBO processing, the screen is displayed.
· PROCESS AFTER INPUT (PAI) is triggered when the user chooses a function on the screen. You can program the PAI processing of the screen in this block. At the end of the PAI processing, the system either calls the next screen or carries on processing at the point from which the screen was called.
· PROCESS ON HELP-REQUEST (POH) and PROCESS ON VALUE-REQUEST (POV) are triggered when the user requests field help (F1) or possible values help (F4) respectively. You can program the appropriate coding in the corresponding event blocks. At the end of processing, the system carries on processing the current screen.
As is normal with events, you must only program event blocks for the events to which you want the flow logic to react. However, the screen flow logic must contain at least the two statements PROCESS BEFORE OUTPUT and PROCESS AFTER INPUT in the correct order.
Within the event blocks, you can use the following screen-keywords:
Keyword |
Description |
MODULE |
Calls a dialog module in an ABAP program |
FIELD |
Specifies the point at which the contents of a screen field should be transported
|
ON |
Used in conjunction with FIELD |
VALUES |
Used in conjunction with FIELD |
CHAIN |
Starts a processing chain. |
ENDCHAIN |
Ends a processing chain. |
CALL |
Calls a subscreen. |
LOOP |
Starts processing a screen table |
ENDLOOP |
Ends processing a screen table |
The functions of the individual statements are described in the following sections.
The Flow Logic Editor
To display a screen's flow logic from the Repository Browser, double-click a screen name. The system starts the flow logic editor of the Screen Painter:
The flow logic editor is similar to the ABAP Editor and provides functions for editing screen flow logic.
Getting Help on Screen Keywords
The flow logic offers help on flow logic keywords.
Position the cursor on the corresponding keyword and choose F1 .
Navigation
The Screen Painter supports the same navigation features provided with all Workbench tools. You should be aware of the following features of navigation in the Screen Painter:
Double-click (F2) on... |
To reach... |
a field name in the element list or in flow logic |
the point in the program where the field is defined. |
The number of the next screen |
the screen attributes of the next screen. |
A screen number in the flow logic |
the flow logic of that screen. |
A module name in the flow logic |
the point in the module pool where the module is defined. |
The Screen Painter also offers the global find and replace features of the ABAP Workbench. You can find and replace element names (including generic searches) in the flow logic and element lists. Each search generates a hit list, from which you can navigate to the corresponding object.
Flow Logic Keywords
You define the flow logic in the flow logic editor of the Screen Painter, using the following keywords:
Keyword |
Description |
CALL |
Calls a subscreen. |
CHAIN |
Starts a processing chain. |
ENDCHAIN |
Ends a processing chain. |
ENDLOOP |
Ends loop processing. |
FIELD |
Refers to a field. You can combine this with the MODULE and SELECT keywords. |
LOOP |
Starts loop processing. |
MODIFY |
Modifies a table. |
MODULE |
Identifies a processing module. |
ON |
Used with FIELD assignments. |
PROCESS |
Defines a processing event. |
SELECT |
Checks an entry against a table. |
VALUES |
Defines allowed input values. |
For more information about transaction programming, see the ABAP User’s Guide
Example of Flow Logic Example
The following example shows some use of screen flow logic:
*------------------------------------------------
* Sample Code
*---------------------------------------------------
*Processing Before Screen Output
PROCESS BEFORE OUTPUT.
MODULE INIT_FIELDS.
* Self-programmed F1 Help
PROCESS ON HELP-REQUEST.
FIELD GSSG-BUKRG MODULE V-BUKRG.
* Processing after user input
PROCESS AFTER INPUT.
* Lock customer master record
CHAIN.
FIELD GSSG-KTNRG
MODULE ENQUEUE_CUSTOMER_MASTER.
* Read customer master record
MODULE READ_CUSTOMER_MASTER.
* Read business area
MODULE READ_GSSG.
ENDCHAIN.
* Process function code
FIELD OK-CODE MODULE OKCODE ON INPUT.