Chain and field Statement
What are the field and chain Statements and use?
Input Checks in Dialog Modules :
You cannot perform input checks in PAI modules of programs until you have transported the contents of the input fields to the ABAP program. You can then use logical expressions to check the values that the user entered. You should then allow the user to correct any wrong entries before calling further modules.
You can do this by sending warning (type W) or error (type E) messages from PAI modules that are called in conjunction with the statements FIELD and CHAIN.
Checking Single Fields
If you send a warning or error message from a module mod that you called using a FIELDstatement as follows:
FIELD f MODULE mod.
the corresponding input field on the current screen is made ready for input again, allowing the user to enter a new value. If the field is only checked once, the PAI processing continues directly after the FIELDstatement, and the preceding modules are not called again.
Checking a Set of Fields
If a warning or an error message is sent in a module mod1 mod2 that you called within a processing chain:
FIELD: f1, f2,...
FIELD: g1, g2,...
all of the input fields on the current screen that belong to the processing chain are made ready for input again including those that are in FIELD statements after the MODULEstatement. All the other fields are not ready for input. Even if a MODULE statement appears within a processing chain, combined with a FIELD statement, all of the input fields in the chain are made ready for input again not just the field in question. The user can repeat the input. If the fields in the processing chain are only checked once, the PAI processing continues directly after the automatic checks at the CHAINstatement, and the preceding modules are not called again.
Controlling Input and Data Transport
If you use the FIELD statement outside a processing chain, only a single field is made ready for input when a warning or error message is displayed. If you use FIELD statements between CHAIN - ENDCHAIN, this controls a set of fields. All of the fields controlled by a FIELDstatement are transported back to the screen, bypassing PBO processing. This means that any changes made to the field contents before the message become visible on the screen. This also applies to information
Checking Fields Repeatedly
You may sometimes need to specify the same field in more than one FIELD or CHAIN statement. If one of the corresponding modules sends a warning or error message, PAI processing resumes with the value that the user corrected. However, in this case, processing cannot simply resume at the corresponding FIELD or CHAIN statement if the field in question has already been included in an earlier FIELD or CHAIN statement.
Instead, all of the FIELD and CHAIN statements containing a field in which an error occurred are repeated. PAI processing resumes at the first FIELD or CHAINstatement containing one or several of the fields in which the error occurred and that the user changed the last time the screen was displayed.
PROCESS AFTER INPUT.
FIELD f1 MODULE m1.
FIELD f2 MODULE m2.
FIELD: f1, f2, f3.
FIELD: f4, f5, f1.
If module m6contains a warning or error message, the screen is displayed again, after which processing resumes with the first CHAIN statement. Module m3 is called since this is the first occurrence of the field f4.
Remaining Functions in the FIELD Statement
All of the functions of the FIELD and CHAINstatements for controlling data transport and conditional module calls can also be used in combination with warning and error messages. The contents of each field are transported at the FIELD statement in which the field occurs. If a warning or error message occurs in a conditional module of a processing chain, all of the fields in that chain will be ready for input when the screen is redisplayed, although not all of the fields will have been transported.
If a warning or error message occurs in a module that is not linked with a FIELD or CHAIN statement, none of the fields on the screen will be ready for input. In this case, the user can only exit the program, but only if a corresponding unconditional module call is provided.
Input Checks in Dialog Modules
DATA: ok_code TYPE sy-ucomm,
input1 TYPE i, input2 TYPE i, input3 TYPE i,
input4 TYPE i, input5 TYPE i, input6 TYPE i,
sum TYPE i.
CALL SCREEN 100.
MODULE init_screen_100 OUTPUT.
CLEAR: input1, input2, input3, input4, input5, input6.
SET PF-STATUS 'STATUS_100'.
MODULE cancel INPUT.
MODULE module_1 INPUT.
IF input1 < 50.
MESSAGE e888(sabapdocu) WITH text-001 '50' text-002.
MODULE module_2 INPUT.
IF input2 < 100.
MESSAGE e888(sabapdocu) WITH text-001 '100' text-002.
MODULE module_3 INPUT.
IF input3 < 150.
MESSAGE e888(sabapdocu) WITH text-001 '150' text-002.
MODULE chain_module_1 INPUT.
IF input4 < 10.
MESSAGE e888(sabapdocu) WITH text-003 '10' text-002.
MODULE chain_module_2 INPUT.
sum = sum + : input4, input5, input6.
IF sum <= 100.
MESSAGE e888(sabapdocu) WITH text-004 '100' text-002.
MODULE execution INPUT.
MESSAGE i888(sabapdocu) WITH text-005.
The next screen (statically defined) for screen 100 is 100. It has the following layout:
The screen fields input1 through input6 are assigned to the input fields. The function code of the pushbutton is EXECUTE.
In the GUI status STATUS_100, the icon (F12) is active with function code CANCEL and function type E. Furthermore, the function key F8 is assigned to the function code EXECUTE with the function type <blank>.
The screen flow logic is as follows:
PROCESS BEFORE OUTPUT.
PROCESS AFTER INPUT.
MODULE cancel AT EXIT-COMMAND.
FIELD input1 MODULE module_1.
FIELD input2 MODULE module_2.
FIELD input3 MODULE module_3.
FIELD input6 MODULE chain_module_2.
This program demonstrates how you can check input fields in dialog modules.
The fields input1 through input3 are checked independently of each other in the modules module_1 through module_3. As long as the user does not enter a corresponding value, the screen is repeatedly displayed with the appropriate field ready for input.
The fields input4 through input6 are checked together in a processing chain. If input4 does not satisfy the condition in chain_module_1, all three fields are again ready for input. The same applies if the three fields do not satisfy the condition in chain_module_2.
The EXECUTION module, from which an information message is displayed, is not executed until all six fields satisfy the appropriate conditions.
plz reward if helpful,
thanks and regards,