Chapter-07 UserDefinedChecks
Chapter-07 UserDefinedChecks
Dec-2008
Objectives
The participants will be able to:
Code the three methods of user defined checks.
Leave one or many fields open for input.
Understand data transport in the PAI event.
Dec-2008
Overview
Academy Awards
Year
1932
Category
PIC
User-defined check
User-defined check
Academy Awards
Academy Awards
Year
1932
Year
1932
Category
PIC
Category
PIC
E: No record exists
Enter
E: No record exists
Dec-2008
User-Defined Checks
Method #1
Method #2
Method #3
Dec-2008
SELECT statement
Flow
Logic
Command
Dec-2008
FIELD YMOVIE-AAYEAR
MODULE SELECT_LISTING.
IF SY-SUBRC <> 0.
the YMOVIE-AAYEAR
screen field open for input if
an error or warning message
is issued in the
SELECT_LISTING module.
ENDIF.
MESSAGE E001.
ENDMODULE.
Academy Awards
Academy Awards
Year
Category
1932
PIC
Year
1932
Category
PIC
Enter
E: No record exists
Dec-2008
Flow
Logic
Command
This Flow Logic SELECT statement will retrieve one record. If no record
matches, an error message is issued. The Flow Logic FIELD statement will
leave the YMOVIE-AAYEAR screen field open for input if this error message
is issued
Academy Awards
Academy Awards
Year
1932
Category PIC
Year
1932
Category
PIC
Enter
E: No record exists
Dec-2008
Flow
Logic
Command
Academy Awards
Year
1910
Category PIC
Enter
Year
1910
Category
PIC
Dec-2008
Flow
Logic
Command
CHAIN.
FIELD: YMOVIE-AAYEAR,
YMOVIE-CATEGORY.
MODULE SELECT_LISTING.
ENDCHAIN.
This Flow Logic CHAIN and ENDCHAIN groups the FIELD statements
and the MODULE statement together. The Flow Logic FIELD statements will leave both
the YMOVIE-AAYEAR and YMOVIE-CATEGORY screen fields open for input if an
error or warning message is issued in the SELECT_LISTING module.
Academy Awards
Academy Awards
Year
1932
Category
PIC
Enter
Year
1932
Category
PIC
E: No record exists
Dec-2008
Flow
Logic
Command
CHAIN.
FIELD: YMOVIE-AAYEAR,
YMOVIE-CATEGORY.
MODULE SELECT_LISTING.
ENDCHAIN.
This Flow Logic CHAIN and ENDCHAIN groups the FIELD statements and the
MODULE statement together. The Flow Logic FIELD statements will leave both
the YMOVIE-AAYEAR and YMOVIE-CATEGORY screen fields open for input if an
error or warning message is issued in the SELECT_LISTING module.
Academy Awards
Academy Awards
Year
1932
Category
PIC
Enter
Year
1932
Category
PIC
E: No record exists
10
Dec-2008
Enter
CHAIN.
FIELD: B, C.
MODULE CHECK2.
ENDCHAIN.
MODULE NEXT_SCREEN.
11
Dec-2008
Enter
A
B
C
NO
D
E
PROCESS AFTER INPUT.
MODULE ONE.
FIELD A MODULE TWO.
CHAIN:
FIELD: B, C.
MODULE THREE.
ENDCHAIN.
FIELD A MODULE FOUR.
12
YES
Dec-2008
Demonstration
Usage of the FIELD and CHAIN-ENDCHAIN statements in a simple online
program.
13
Dec-2008
Practice
Usage of the FIELD and CHAIN-ENDCHAIN statements in a simple online
program.
14
Dec-2008
Summary
There are three methods to perform user-defined field checks:
Issue an error or warning message in a PAI module.
Issue an error or warning message with the Flow Logic SELECT statement.
Define valid values for a screen field with the Flow Logic VALUES statement .
Flow Logic FIELD statement keeps a single screen field open for input on an error
or warning message.
This Flow Logic SELECT statement will retrieve one record. If no record
matches, an error message is issued.
This Flow Logic VALUES statement defines a set of valid values for the screen
field specified in the FIELD statement. If the value entered in this field is not in
the valid set, an error message will be issued by the system.
15
Dec-2008
Summary (Contd.)
To keep multiple screen fields open for input after an error or warning message is
displayed, you need to use the CHAIN and ENDCHAIN Flow Logic commands.
The purpose of the FIELD statement is to keep a single screen field open for
input after an error or warning message is issued.
16
Dec-2008
Questions
17
Dec-2008
Questions (Contd.)
FIELD B
SELECT * FROM TABLE
WHERE FIELD1 = A
AND FIELD2 = B
INTO TABLE
WHENEVER NOT FOUND
SEND ERRORMESSAGE 001.
event?
18
Dec-2008