You define the flow logic in the flow logic editor of the Screen Painter, using the following

keywords: Keyword CALL CHAIN ENDCHAIN ENDLOOP FIELD LOOP MODIFY MODULE ON PROCESS SELECT VALUES ON INPUT ON CHAIN-INPUT ON REQUEST ON CHAIN-REQUEST Description Calls a subscreen. Starts a processing chain. Ends a processing chain. Ends loop processing. Refers to a field. You can combine this with the MODULE and SELECT keywords. Starts loop processing. Modifies a table. Identifies a processing module. Used with FIELD assignments. Defines a processing event. Checks an entry against a table. Defines allowed input values.

This option triggers a module if any fields of a CHAIN/ENDCHAIN section

is changed

dynpro Exit Command
The dynpro exit command enables a user to implement dialog screen functionality which gets processed even if the user has entered data into a field which is invalid. An example use for this would be if you had a dialog screen containing fields which are mandatory but you still want to allow the user to exit the application without having to fill these otherwise mandatory fields in. You would therefore create a function code of type exit-command within the PFSTATUS and when this function is selected by the user the ABAP code within the PAI module of the screen is executed regardless of any validity checks associated with the dialog screen.

The element attribute HOLD DATA CALL TRANSACTION .Once the ‘exit command’ function code has been created you will then need to add it to the relevant PAI module call within the flow logic of the SAP dynpro. This includes cases when the user overwrites an existing value with the same value. Conditions for Single Screen Fields You can ensure that a PAI module is only called when a certain condition applies by using the following statement: FIELD <f> MODULE <mod> ON INPUT|REQUEST|*-INPUT. or explicitly enters the initial value. Even if the user enters the initial value of the screen as the initial value. In general. *EXIT-COMMAND means module will be called first bypassing any feild validation MODULE USER_COMMAND_0100 AT EXIT-COMMAND. the module is not called. the syntax of the screen language also allows you to make PAI module calls dependent on certain conditions by using the MODULE statement together with the FIELD statement. on the other hand. The functions of the FIELD statement for controlling data transport also apply when you use MODULE. the * is removed... USING Automatic settings of particular global fields ON *-INPUT The ABAP module is called if the user has entered a "*" in the first character of the field. As well as user input. and the field has the attribute *-entry in the Screen Painter. the ON REQUEST condition is triggered through any form of "manual input"... the following additional methods of entering values also call the module:      The element attribute PARAMETER-ID (SPA/GPA parameters). . *dynpro PAI flow logic PROCESS AFTER INPUT. You can apply conditions to both single fields and groups of fields. When the input field is passed to the program. Conditional module calls can help you to reduce the runtime of your program. zero for numeric fields. Conditional Module Calls Simple module calls are processed in the sequence in which they appear in the screen flow logic. (ON REQUEST. * behaves like an initial field in the ON INPUT condition. particularly with modules that communicate with database tables. The additions have the following effects:  ON INPUT The ABAP module is called only if the field contains a value other than its initial value. This initial value is determined by the data type of the field: Space for character fields. does trigger the call in this case.)  ON REQUEST The module <mod> is only called if the user has entered something in the field. However. .

CHAIN. . The module <mod1> is called when screen field <f> meets the specified condition for individual fields. FIELD <f> MODULE <mod1> ON INPUT|REQUEST|*-INPUT |CHAIN-INPUT|CHAIN-REQUEST. it is worth setting up a separate processing chain for each combination and calling different modules from within it... MODULE <mod2> ON CHAIN-INPUT|CHAIN-REQUEST.. You define processing chains as follows: CHAIN.. Within a processing chain.. you must combine the calls in the flow logic to form a processing chain. <f 2>. .. <mod2> is called when one of the fields <f i> or <g i> meets the condition. the condition also applies to the entire chain and module <mod1> and <mod2> are both called. To do this. <g 2>. If you use the addition ON CHAIN-INPUT or ON CHAIN-REQUEST with FIELD <f>. ENDCHAIN. All flow logic statements between CHAIN and ENDCHAIN belong to a processing chain. Within a processing chain. MODULE <mod2> ON CHAIN-INPUT|CHAIN-REQUEST.. . Calling Modules after Cursor Selection You can specify that a module should only be called if the cursor is positioned on a particular screen element. screen fields are not transported until the FIELD statement. <mod2> is called when one of the fields <fi> or <f> meets the condition... ENDCHAIN. use the statement MODULE <mod> AT CURSOR-SELECTION. <f 2>. MODULE <mod1> ON CHAIN-INPUT|CHAIN-REQUEST... FIELD: <g1>. Processing chains also have another function for the FIELDS statements that they contain.Conditions for Multiple Screen Fields To ensure that one or more PAI modules are only called when several screen fields meet a particular condition. ENDCHAIN.. This is described in the section on validity checks. So <mod1> is called when one of the fields <fi> meets the condition. The additions ON CHAIN-INPUT and ON CHAIN-REQUEST work like the additions ON INPUT and ON REQUEST that you use for individual fields. The fields in the various FIELD statements are combined. and can be used in shared conditions. FIELD: <f1>. The exception is that the module is called whenever at least one of the fields listed in a preceding FIELD statement within the chain meets the condition. In cases where you apply conditions to various combinations of screen fields. The functions of the FIELD statement for controlling data transport also apply when you use processing chains. FIELD: <f1>. you can combine individual FIELD statements with a MODULE statement to set a condition for a single field within the chain: CHAIN..

. The module is called in the sequence in which it occurs in the flow logic. If a statement without FIELD occurs more than once. MESSAGE I888(BCTRAIN) WITH TEXT-001 FLD. INPUT2(20). a statement without FIELD is not executed. The call hierarchy of the different combinations is as follows:    If a MODULE. only the first statement is executed. If a statement using FIELD appears more than once for the same screen field <f>. The module <mod> is only called if the cursor is positioned on an input/output field <f> or an input/output field <fi> in the processing chain. Data is transported from screen fields in the order in which it is defined by the FIELD statements.. FIELD: <f1>.The module <mod> is called whenever the function code of the user action is CS with function type S. ENDCHAIN block or not. You can only apply this statement to input/output fields. MODULE CANCEL INPUT. ENDMODULE. MODULE <mod> AT CURSOR-SELECTION. GET CURSOR FIELD FLD. or. and neither SY-UCOMM nor the OK_CODE field is affected. <f 2>. MODULE INIT_SCREEN_100 OUTPUT. LEAVE PROGRAM. It is irrelevant whether the statements occur within a CHAIN . ENDCHAIN. AT CURSOR-SELECTION statement is executed that was combined with FIELD. INPUT1(20). only the last statement is executed. You can also combine this MODULE statement with the FIELD statement: FIELD <f> MODULE <mod> AT CURSOR-SELECTION. ENDMODULE. INPUT3(20). DATA: OK_CODE LIKE SY-UCOMM. for more than one field: CHAIN.. If you use this statement. It does not bypass the automatic input checks. ENDMODULE. CALL SCREEN 100. . Conditional module calls PROGRAM DEMO_DYNPRO_ON_CONDITION. SET PF-STATUS 'STATUS_100'. This also assigns it to the mouse double-click. MODULE CURSOR INPUT. The function code is empty. it is best to assign the function code CS to function key F2.... FLD(20)..

MESSAGE I888(BCTRAIN) WITH TEXT-005 '2' TEXT-006 '3'. MODULE MODULE_2 INPUT. PROCESS AFTER INPUT. The screen flow logic is as follows: PROCESS BEFORE OUTPUT. MESSAGE I888(BCTRAIN) WITH TEXT-004 INPUT3. ENDMODULE. . FIELD INPUT3 MODULE MODULE_* ON *-INPUT. MODULE C1 INPUT. ENDMODULE. MODULE INIT_SCREEN_100. It has the following layout: The screen fields INPUT1. the icon (F12) is active with function code CANCEL and function type E. ENDMODULE. MESSAGE I888(BCTRAIN) WITH TEXT-003. MESSAGE I888(BCTRAIN) WITH TEXT-002. ENDMODULE. MODULE MODULE_2 ON CHAIN-REQUEST. CHAIN. INPUT2. The function key F2 is also active with function code CS and function type S. MODULE C2 INPUT. The F8 key is active with the function code EXECUTE and no special function type. The next screen (statically defined) for screen 100 is itself. MODULE MODULE_1 ON CHAIN-INPUT. and INPUT3 are assigned to the input fields. The function code of the pushbutton is EXECUTE. FIELD: INPUT1. MODULE CANCEL AT EXIT-COMMAND. In the GUI status STATUS_100.MODULE MODULE_1 INPUT. ENDMODULE. INPUT2. MESSAGE I888(BCTRAIN) WITH TEXT-005 '1'. MODULE MODULE_* INPUT.

Whenever input field 3 contains a * entry. The program uses information messages to show which modules are called following user interaction and which data is transported.ENDCHAIN. Module C2 is never executed. CHAIN. since the MODULE . the system calls the module CURSOR. the system calls module MODULE_* for any user interaction. If the user chooses F2 or double-clicks input field 2 or 3. Whenever one of the three input fields is changed.. the system calls the module MODULE_2 for any user interaction. and only the last is processed. MODULE CURSOR AT CURSOR-SELECTION.. FIELD: INPUT2. FIELD INPUT1 MODULE C1 AT CURSOR-SELECTION. If the user chooses F2 or double-clicks a text field on the screen. ENDCHAIN.       Whenever one of the input fields 1 or 2 is not initial. . INPUT3. MODULE C2 AT CURSOR-SELECTION. If the user chooses F2 or double-clicks input field 1. the system calls the module MODULE_1 for any user interaction. AT CURSOR SELECTION statement occurs twice. the system calls the module CURSOR. the system calls the module C1.

Sign up to vote on this title
UsefulNot useful