Upload
rajesh-kumar
View
214
Download
0
Embed Size (px)
Citation preview
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 1/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
ABAP/4 Program Types
Report Programs
Conventional Report
Interactive Report
Online Programs
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 2/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Developing Online Programs
Object Browser
Screen Painter ABAP/4 Editor
ABAP/4 Dictionary
Menu Painter
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 3/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Screen Components
Screen PainterScreen
Attributes
Screen
Layout
Field
Attributes
Flow Logic
PBO & PAI
Generated
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 4/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Screen Layout
1 2
34
5
6
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 5/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
ABAP/4 Program Components
Top Include
MZ…TOP
PBO Modules
MZ…O01
PAI Modules
MZ..I01
ABAP/4
SAPM...
Subroutines
MZ…F01
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 6/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Online Program Processing Control
DYNPRO PROCESSOR ABAP/4 PROCESSOR
** SCREEN 9000 **
PROCESS BEFORE OUTPUT.
MODULE CLEAR.
PROCESS AFTER INPUT.MODULE CHECK.
MODULE SELECT.
** SCREEN 9001 **
PROCESS BEFORE OUTPUT.
PROCESS AFTER INPUT.
MODULE UPDATE.
** INCLUDE MZAVGO01
MODULE CLEAR OUTPUT.
. . .
ENDMODULE.
** INCLUDE MZAVGI01
MODULE CHECK INPUT.
. . .
ENDMODULE.
MODULE SELECT INPUT.
. . .ENDMODULE.
MODULE UPDATE INPUT.
. . .
ENDMODULE.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 7/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Online Program Work Areas
Screen Work Area Program Work Area
PBO
PAI
Identical
Names
name
Aaron
phone
215-387-3232
city
Philadelphia
DATA name(10).
Aaron
DATA num(12).
DATA city(20).Philadelphia
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 8/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Overview
Player Average
Total Points
Total Games
165
6
Player Average
Total Points
Total Games
165
6
27.50Points/Game
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 9/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Creating an Online Program
Program Attributes
Title
Type “M”
Application
Online program name
must begin with
“SAPM” and then
either a “Y” or “Z”.
Go back to
Object Browser,
not source code.
“With TOP INCL.”
should be checked.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 10/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Object Browser
Main Program Top Include** SAPMZAVG **
INCLUDE MZAVGTOP.
** MZAVGTOP - Include Program **
PROGRAM SAPMZAVG.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 11/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Online Program Components
Enter a screen
number and click
on the „Create‟
pushbutton.
Above 9000
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 12/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Screen Attributes
Screen Attributes
Screen Painter
ShortDescription
Screen Type Next Screen
required required optional
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 13/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Screen Layout
Fullscreen Editor
Player_Average
Total_Points ______
Total_Games ______ Input/output
templates are
created with
underscores.
Use an
underscore to
link words into
one text field.
Screen Painter
Text fields are
created with
character
strings.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 14/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Field Attributes
Field List
Screen Painter
Field name,
not text
“Field Types” View
Field format
Input and
output
turned “on”
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 15/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Flow Logic
Flow LogicScreen Painter
PROCESS BEFORE OUTPUT.
MODULE INITIALIZE.
PROCESS AFTER INPUT.
MODULE CALCULATE.
Flow
Logic
Command
ABAP/4 module to
clear all fields
before screen is
displayed.
ABAP/4 module to
calculate average
after user has
entered values and
pressed „Enter‟.
Screen 9000
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 16/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
ABAP/4 Modules
Main Program** SAPMZAVG **
INCLUDE MZAVGTOP.
INCLUDE MZAVGO01.
INCLUDE MZAVGI01.
PBO Module** MZAVGO01 - Include Program **
MODULE INITIALIZE OUTPUT.
CLEAR: POINTS, GAMES, AVERAGE.
ENDMODULE.
PAI Module** MZAVGI01 - Include Program **
MODULE CALCULATE INPUT.
CHECK GAMES <> 0.
AVERAGE = POINTS / GAMES.
ENDMODULE.
The fields POINTS,
GAMES, and
AVERAGE need
to be defined as
global data.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 17/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Global Data
Top Include
** MZAVGTOP - Include Program **
PROGRAM SAPMZAVG.
DATA: POINTS TYPE I,
GAMES TYPE I,
AVERAGE TYPE P
DECIMALS 2.
Main Program
** SAPMZAVG **
INCLUDE MZAVGTOP.
INCLUDE MZAVGO01.
INCLUDE MZAVGI01.
It is important that these
program fields are named
the same as the screen
fields so AUTOMATIC
DATA TRANSPORT will
occur between the screen
work area and program
work area.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 18/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Executing an Online Program
Transaction Code
Transaction
Text
F8
Program
NameInitial Screen
required required required
SAPMZAVG 9000
S f S
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 19/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Question???
PROCESS BEFORE OUTPUT.
MODULE CALCULATE.
PROCESS AFTER INPUT.
Screen 9001
PROCESS BEFORE OUTPUT.
MODULE INITIALIZE.
PROCESS AFTER INPUT.
MODULE CALCULATE.
Screen 9000
We could have calculated the player‟s average in the PBO of
screen 9001. Why is it better to do the calculation in the PAI
of screen 9000 instead of the PBO of screen 9001?
Si I f ti S t Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 20/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Overview
Screen Painter
Screen
Attributes
Screen
Layout
FieldAttributes
Flow Logic
Always
remember to
generate
Si I f ti S t Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 21/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Field List versus Field Attributes
Attributes
Si I f ti S t Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 22/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Fullscreen Editor Editing Functions
Player_Average
Total_Points ______
Total_Games ______
Select
Move
Si I f ti S t Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 23/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Graphical Elements
1 2
34
5
6
Si I f ti S t Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 24/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Radio Buttons
Which_Area?
_ ABAP/4
_ MM
_ SD _ PP
_ FI/CO
_ HR
Radio buttons are created
as single character
input/output templates.
Radio buttons
must be defined as
a graphical group
to make them
mutually exclusive.
The “label” for the radio
button should have the
same field name as the
radio button itself.
Graphical element
Radio buttons
Si I f ti S t Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 25/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Check Boxes
Which_Courses?
_ Course_1
_ Course_2
_ Course_3 _ Course_4
Check boxes are created
as single character
input/output templates.
The “label” for the checkbox should have the
same field name as the
check box itself.
Graphical element
Checkboxes
Siemens Information S stems Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 26/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Frames
Which_Courses?
_ Course_1
_ Course_2 _ Course_3
_ Course_4
Frames are created with a“title” at the top of the
box. This “title” must be a
single text field.
Graphical element
Box
Sel. box end
Siemens Information Systems Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 27/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Pushbuttons
Enroll_for_Courses
Pushbuttons arecreated from text fields.
Graphical element
Pushbuttons
Pushbuttons must be
assigned a function code.
You can also define afunction type for a
pushbutton.
They can also contain an
icon.
Siemens Information Systems Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 28/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Scrollable Fields
ABAP/4 Course #3
Description
Instructor
This course covers online programming techniques.
Anthon, Dionne
ABAP/4 Course #3
Description
Instructor
course covers online prog
Anthon, Dionne
scrollable field
Scrollable fields have a VISIBLE LENGTH
that is smaller than the DEFINED LENGTH.
Only Char Fields
These lengths
are “attributes”
of a field.
Siemens Information Systems Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 29/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Using Matchcodes
ABAP/4 Course #3
Description
Instructor
This course covers online
Anthon, Dionne
Anthon, Dionne
Bacon, Patricia
Banning, Mark
Cooper, Angela
Shepski, Lee
Matchcode is an
“attribute” of a field.It can only be used
on input/output
templates.
If you assign a matchcode to anINPUT/OUTPUT TEMPLATE, you
will see a drop-down arrow to
get a list of possible values (F4).
Siemens Information Systems Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 30/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Academy Awards Table
YMOVIEDatabase Table
AAYear
Category
Winner Notes
Critic
Siemens Information Systems Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 31/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Academy Awards Online Program
Academy Awards
Year
Category
1994
PIC
Academy Awards
Year
Category
1994
PIC
Winner Forrest Gump
Notes The Shawshank Redemption should have won.
All of these screenfields, except for the
Academy Awards title,
will be “painted” from
ABAP/4 Dictionary
fields.
Siemens Information Systems Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 32/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
“Paint” Dictionary Fields
Screen Painter
By selecting a“Key word”
size, you will
get a text field.
By selecting
“Yes” for
“Template”,
you will get an
input/output
template.
Select the desired fields.
Siemens Information Systems Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 33/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Field List for Dictionary Fields
“Field Types” View
The fields “painted” from the
ABAP/4 Dictionary are
automatically named
“<table name>-<field name>”.
Screen Painter
These fields are
marked as referring
to ABAP/4
Dictionary fields.
Siemens Information Systems Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 34/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Use Dictionary Fields
** MZA01O01 - PBO Modules **
MODULE INITIALIZE OUTPUT.
CLEAR YMOVIE.
ENDMODULE.
** MZA01TOP - Top Include **
PROGRAM SAPMZA01.
TABLES YMOVIE.
PROCESS BEFORE OUTPUT.
MODULE INITIALIZE.
PROCESS AFTER INPUT.
MODULE
SELECT_LISTING.
Screen 9000
** MZA01I01 - PAI Modules **
MODULE SELECT_LISTING INPUT.
* code to select record from YMOVIE
ENDMODULE.
When you“paint” screen fields from
the ABAP/4 Dictionary, you define
the program fields with the
“TABLES” statement.
Siemens Information Systems Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 35/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Online Help for Dictionary Fields
Academy Awards
Year
Category
1994
PIC
Data element
short text
Data element
documentationData element
supplemental
documentation
• system-wide
• automatic
• system-wide
• only if maintained
• screen-specific
• only if maintained
If a screen field is“painted” from the
ABAP/4 Dictionary,
it points to a data
element and the
data element‟s
online help.
F1
Siemens Information Systems Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 36/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
ABAP/4 Dictionary Integration
Academy Awards
Year
Category
Academy Awards
Year
Category
If a change is made to an ABAP/4 Dictionary field (e.g., category
length is changed from 3 to 6 characters) and the appropriate
Dictionary objects are reactivated, the change will take effect
throughout the system where this field is used.
Execute
transaction
Notice
change in
“Category”
field length
Execute
transaction
Siemens Information Systems Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 37/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Automatic Checks
Required Field Entered ?
Proper Format ?
Foreign Key Value ?
Valid Value ?
Values in all
input/output
templates are
checked for …
Values in
input/output
templates “painted”from the ABAP/4
Dictionary are
checked for …
Siemens Information Systems Ltd
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 38/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Timing of Automatic Checks
SCREEN PROCESS BEFORE OUTPUT.
PROCESS AFTER INPUT.
MODULE ONE.
MODULE TWO.
YESNO
Module “ONE”
executed.
Module “TWO”
executed.
Go to PBO of
next screen
Data transport from
screen fields to
program fields with the
same names.
Automatic
Screen Field
Checks OK?
Enter
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 39/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Required Field Check
Academy Awards
Year
Category
?
PIC
Fields can be marked asrequired two ways: (1) use
a question mark “?” as the
first character of an
input/output template or
(2) check “on” the field
attribute for required entry.
E: Required entry not made
Academy Awards
Year
Category
?
PICIf a required field is not entered,
the system will display the
error message: “Required
entry not made”.
Enter
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 40/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Academy Awards
Year
Category
19a4
PIC
Field Format Check
E: Enter a numeric value
E: Invalid date
Academy Awards
Year
Category
19a4
PIC
The AAYEAR field in the YMOVIE table has the
NUMC (numeric character)
data type. The system will
automatically check that
the user has entered all
numbers in this field.
If a field format is incorrect, the
system will display an
appropriate error message.
Enter
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 41/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Foreign Key Check
Address Information
Customer # C32
E: Entry C32 does not exist (please check your entry)
Address Information
Customer # C32
This customer number field“painted” from the ABAP/4
Dictionary has a foreign key
relationship maintained. Because
of this relationship, you will see a
drop-down arrow to get a list of
possible values (F4).
If the value entered does not exist in the foreign key (check)
table, the system will display the error message: “Entry <x>
does not exist (please check your entry)”.
Enter
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 42/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Valid Value Check
Academy Awards
Year
Category
1994
PI
E: Please enter a valid value
Academy Awards
Year
Category
1994
PI
The CATEGORY field in the YMOVIE table points to a
domain with a set of valid
values. Because of this set of
valid values, you will see a
drop-down arrow to get a list
of possible values (F4).
If a valid value is not
entered, the system will
display the error message:
“Please enter a valid value”.
Enter
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 43/118
Global network
of innovation
Siemens Information Systems Ltd.
SIEMENS
Overview
Academy Awards
Year
Category
1910
PIC
Academy Awards
Year
Category
1910
PIC
Winner No record exists
Notes
Enter Academy Awards
Year
Category
1910
PIC
E: No record exists
XInstead of informing the user
on the second screen that a
record does not exist, wewant to issue a message on
the first screen.
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 44/118
Global network
of innovation
S Sy
SIEMENS
MESSAGE Statement
** MZA02TOP - Top Include **
PROGRAM SAPMZA02 MESSAGE-ID ZA.
TABLES YMOVIE.
** MZA02I01 - PAI Modules **
MODULE SELECT_LISTING INPUT.
* code to select record from YMOVIE
IF SY-SUBRC <> 0.
YMOVIE-WINNER = „No record exists‟.
MESSAGE E001.
ENDIF.
ENDMODULE.
t = message type
nnn = message number
--------------------------------------
var1 = message variable 1
var2 = message variable 2var3 = message variable 3
var4 = message variable 4
MESSAGE <tnnn> [WITH <var1> <var2> <var3> <var4>].
Message class (ID)
must be specified on
PROGRAM statement
in Top Include.
MESSAGE statement in PAI
module of first screen.
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 45/118
Global network
of innovation
y
SIEMENS
User Messages Table
T100User Messages
Language (key)Message ID (key)
Message # (key)
Message Text
Actual message displayed to
the user with the MESSAGE
statement.
Logon language
Message ID specified on
PROGRAM statement
Message # (nnn) specified
in MESSAGE statement
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 46/118
Global network
of innovation
y
SIEMENS
Message Types
The message
type determines
where the
message is
displayed and
what action the
user can or
must take onthe current
screen.
S: success
I: information
A: abend
X: exit
W: warning
E: error
i
X
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 47/118
Global network
of innovation
y
SIEMENS
Success Message
Academy Awards
Year
Category
1910
PIC
Winner
Notes
No record exists
Academy Awards
Year
Category
1910
PIC
MESSAGE S001.PAI Module of 1st Screen
The SUCCESSmessage is displayed
at the bottom of the
next screen; therefore,
the user cannot
make any changes to
the values on thecurrent screen.
Enter
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 48/118
Global network
of innovation
y
SIEMENS
Information Message
MESSAGE I001.PAI Module of 1st ScreenAcademy Awards
Year
Category
1910
PIC
Academy Awards
Year
Category
1910
PIC
The INFORMATIONmessage is displayed on
the current screen in a
dialog box. The user
cannot make any changes
to the values on the
current screen. After pressing the „Enter‟ key on
the dialog box, the user
will be taken to the
next screen.
i
i No record exists
Enter
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 49/118
Global network
of innovation
y
SIEMENS
Abend Message
MESSAGE A001.PAI Module of 1st Screen
Academy Awards
Year
Category
1910
PIC
Academy Awards
Year
Category
1910
PIC
The ABEND message isdisplayed on the current
screen in a dialog box.
The user cannot make any
changes to the values on
the current screen.
After pressing the „Enter‟key on the dialog box,
the transaction will
be terminated.
No record exists
Enter
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 50/118
Global network
of innovation
y
SIEMENS
Academy Awards
Year
Category
1910
PIC
W: No record exists
Warning Message
PAI Module of 1st ScreenAcademy Awards
Year
Category
1910
PIC
The WARNING message is
displayed at the bottom of
the current screen. The
user can make changes to
the values on the current
screen, but does not haveto make any changes.
After pressing the „Enter‟
key on the current screen,
the user will be taken to
the next screen.
MESSAGE W001.Enter
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 51/118
Global network
of innovation
SIEMENS
Error Message
MESSAGE E001.
PAI Module of 1st ScreenAcademy Awards
Year
Category
1910
PIC
Academy Awards
Year
Category
1910
PIC
E: No record exists
The ERROR message is
displayed at the bottom of
the current screen. The
user must make changes to
the values on the current
screen. After pressing the„Enter‟ key on the current
screen, the user will be
taken to the next screen
only if the appropriate
corrections were made.
XEnter
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 52/118
Global network
of innovation
SIEMENS
Problem !!!
When we issue a WARNING or ERROR message, the system
stops on the current screen to allow the user to make
corrections; however, these fields are not open for input.
Academy Awards
Year
Category
1910
PIC
W: No record exists
Academy Awards
Year
Category
1910
PIC
E: No record exists
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 53/118
Global network
of innovation
SIEMENS
Overview
Academy Awards
Year
Category
1932
PIC
Academy Awards
Year
Category
1932
PIC
E: No record exists
Academy Awards
Year
Category
1932
PIC
E: No record exists
User-defined check
without flagging fields
as open for input
User-defined check
with flagging fields as
open for input
Enter
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 54/118
Global network
of innovation
SIEMENS
User-Defined Checks
Issue error or warning message
in PAI ModuleMethod #1
Issue error or warning
message with Flow Logic
SELECT statementMethod #2
Define valid values with Flow
Logic VALUES statementMethod #3
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 55/118
Global network
of innovation
SIEMENS
Flow Logic FIELD Statement
Issue error or warning
message in PAI Module
Issue error or warning
message with Flow Logic
SELECT statement
Define valid values
with Flow Logic
VALUES statement
Flow Logic FIELD statement
keeps a single screen field
open for input on an error or
warning message.
PROCESS AFTER INPUT.
FIELD <screen field>
MODULE <module name>.
PROCESS AFTER INPUT.
FIELD <screen field>SELECT * FROM <table> . . . .
PROCESS AFTER INPUT.
FIELD <screen field>
VALUES (<value1>, <value2>).
Flow
Logic
Command
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 56/118
Global network
of innovation
SIEMENS
PAI Module Check
Academy Awards
Year
Category
1932
PIC
Academy Awards
Year
Category
1932
PIC
E: No record exists
PROCESS AFTER INPUT.
FIELD YMOVIE-AAYEAR
MODULE SELECT_LISTING.
** MZA03I01 - PAI Modules **
MODULE SELECT_LISTING INPUT.
* code to select record from YMOVIE
IF SY-SUBRC <> 0.
MESSAGE E001.
ENDIF.
ENDMODULE.
This Flow Logic FIELD
statement will leave the YMOVIE-AAYEAR screen field
open for input if an error or
warning message is issued in
the SELECT_LISTING module.
Enter
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 57/118
Global network
of innovation
SIEMENS
Flow Logic SELECT Check
Academy Awards
Year
Category
1932
PIC
Academy Awards
Year
Category
1932
PIC
E: No record exists
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.
PROCESS AFTER INPUT.
FIELD YMOVIE-AAYEARSELECT * FROM YMOVIE
WHERE AAYEAR = YMOVIE-AAYEAR
AND CATEGORY = YMOVIE-CATEGORY
INTO YMOVIE
WHENEVER NOT FOUND
SEND ERRORMESSAGE 001.
Flow
Logic
Command
Enter
. SY-SUBRC WILL
NOT WORK
SEND WARNING001.
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 58/118
Global network
of innovation
SIEMENS
Flow Logic VALUES Check
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. The Flow Logic FIELD
statement will leave the YMOVIE-AAYEAR screen field open
for input if this error message is issued.
PROCESS AFTER INPUT.FIELD YMOVIE-AAYEAR
VALUES (BETWEEN „1927‟ AND „1996‟). Flow
Logic
Command
Academy Awards
Year
Category
1910
PIC
Academy Awards
Year
Category
1910
PIC
E: Please enter a valid value
Enter
NOT
NOT BETWEENany combination
of above
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 59/118
Global network
of innovation
SIEMENS
Multiple Fields Open for Input
Academy Awards
Year
Category
1932
PIC
Academy Awards
Year
Category
1932
PIC
E: No record exists
This Flow Logic CHAIN and ENDCHAIN group 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.
PROCESS AFTER INPUT.
CHAIN.FIELD: YMOVIE-AAYEAR,
YMOVIE-CATEGORY.
MODULE SELECT_LISTING.
ENDCHAIN.
Flow
Logic
Command
Enter
Not one
statement
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 60/118
Global network
of innovation
SIEMENS
Enter
Restarting PAI Processing
PROCESS AFTER INPUT.
FIELD A MODULE CHECK1.
CHAIN.
FIELD: B, C.
MODULE CHECK2.
ENDCHAIN.
FIELD A MODULE CHECK3.
MODULE NEXT_SCREEN.If an error or warning message is
issued in the CHECK3 module, the
screen will be “repainted” when
the message is displayed.
Field “A” will be open for input
on the redisplayed screen.
PAI processing will berestarted at the first
“FIELD A” statement.
Siemens Information Systems Ltd.
D T i PAI E
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 61/118
Global network
of innovation
SIEMENS
Enter
Data Transport in PAI Event
PROCESS AFTER INPUT.
MODULE ONE.
FIELD A MODULE TWO.
CHAIN:
FIELD: B, C.
MODULE THREE.
ENDCHAIN.
FIELD A MODULE FOUR.
Data transported from screen fields
D and E to program fields D and E.
Fields A, B, and C are not
transported yet because these fields
are in a FIELD statement.
Data transport for field A.
Module “ONE” executed.
Module “TWO” executed.
Data transport for fields B and C.
Module “THREE” executed.
Module “FOUR” executed.
Go to PBO of next screen
YES
A
BC
D
E
NO
AutomaticScreen Field
Checks
OK?
Siemens Information Systems Ltd.
Q ti ???
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 62/118
Global network
of innovation
SIEMENS
Questions???
PROCESS AFTER INPUT.
FIELD A .
FIELD BSELECT * FROM TABLE
WHERE FIELD1 = A
AND FIELD2 = B
INTO TABLE
WHENEVER NOT FOUNDSEND ERRORMESSAGE 001.
FIELD A VALUES (BETWEEN „1‟ AND „32‟).
This FIELD statement is not
associated with a PAI module, a
Flow Logic SELECT statement, or a
Flow Logic VALUES statement;
however, it is essential for the
execution of this PAI event.WHY???
If this error message is
issued, will screen field
“A” be open for input?
Siemens Information Systems Ltd.
O i
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 63/118
Global network
of innovation
SIEMENS
Overview
Academy Awards
Year
Category
1994
PIC
Execute
transactionDefault
Values
Academy Awards
Year
Category
1994
PIC
Winner Forrest Gump
Notes The Shawshank Redemption should have won.
Cursor
Positioning
Siemens Information Systems Ltd.
D f lti Fi ld V l
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 64/118
Global network
of innovation
SIEMENS
Defaulting Field Values
PBO ModuleMethod #1
Parameter IDsMethod #2
Hold DataMethod #3
Siemens Information Systems Ltd.
PBO M d l
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 65/118
Global network
of innovation
SIEMENS
PBO Module
** MZA04O01 - PBO Modules **
MODULE INITIALIZE OUTPUT.
CLEAR YMOVIE.
YMOVIE-AAYEAR = „1994‟.
YMOVIE-CATEGORY = „PIC‟.
ENDMODULE.
PROCESS BEFORE OUTPUT.
MODULE INITIALIZE.
Screen 9000
PBO Module
Executetransaction
Academy Awards
Year
Category
1994
PIC
Siemens Information Systems Ltd.
P t ID
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 66/118
Global network
of innovation
SIEMENS
Parameter IDs
Parameter ID Memory
YYR = <value> YCT = <value>
„AAYEAR‟ Data Element
Parameter
ID „YYR‟
„CATEGORY‟ Data Element
Parameter
ID „YCT‟
This memory isuser and logon
specific
Siemens Information Systems Ltd.
U i P t ID
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 67/118
Global network
of innovation
SIEMENS
Using Parameter IDs
“SET/GETPARAMETER ID”
ABAP/4
Statement
“SPA/GPA”
Field Attributes
OR
Need to store
values in the
global memoryarea and then to
retrieve values
from it.
Siemens Information Systems Ltd.
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 68/118
Global network
of innovation
SIEMENS
SET/GET PARAMETER ID Statement
** MZA04O01 - PBO Modules **MODULE INITIALIZE OUTPUT.
YMOVIE-AAYEAR = „1994‟.
YMOVIE-CATEGORY = „PIC‟.
GET PARAMETER ID „YYR‟ FIELD YMOVIE-AAYEAR.
GET PARAMETER ID „YCT‟ FIELD YMOVIE-CATEGORY.
ENDMODULE.
** MZA04I01 - PAI Modules **
MODULE SELECT_LISTING INPUT.
* code to select record from YMOVIE
SET PARAMETER ID „YYR‟ FIELD YMOVIE-AAYEAR.
SET PARAMETER ID „YCT‟ FIELD YMOVIE-CATEGORY.
ENDMODULE.
Academy Awards
Year
Category
1994
PIC
Parameter ID Memory
YYR = 1994
YCT = PIC
G E T
S E T
Siemens Information Systems Ltd.
SPA/GPA Fi ld Att ib t
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 69/118
Global network
of innovation
SIEMENS
SPA/GPA Field Attributes
Notice the
parameter
ID name
“General Attributes” View
You can check the
“GPA” field attribute
instead of coding the
“GET PARAMETER ID”
statement in a
PBO module.
You can check the “SPA”
field attribute instead of
coding the “SET
PARAMETER ID”
statement in a PAI module.
Timing?
Invalid?
Conditional?
Siemens Information Systems Ltd.
Hold Data
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 70/118
Global network
of innovation
SIEMENS
Hold Data
Academy Awards
Year
Category
1994
PIC
“System > User profile > Hold data”
menu path
If the user selects the “System > User profile > Hold data” menu path
on a screen and the screen has been set up for “Hold data” in the
screen attributes, the values on the screen will be saved by the system
for the next time the user comes to the screen during the current logon.
Screen Attributes
Short Description
Screen Type
Hold DataX
Siemens Information Systems Ltd.
Cursor Position
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 71/118
Global network
of innovation
SIEMENS
Cursor Position
Academy Awards
Year
Category
1994
PIC
Winner Forrest Gump
Notes The Shawshank Redemption should have won.
Upon entering a screen, the cursor will
automatically be positioned in the first
input/output template open for input unlessyou position the cursor in a different field
using the screen attributes or a PBO module.
Siemens Information Systems Ltd.
Positioning the Cursor
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 72/118
Global network
of innovation
SIEMENS
Positioning the Cursor
Academy Awards
Year
Category
1994
PIC
Winner Forrest Gump
Notes The Shawshank Redemption should have won.
Screen AttributesShort Description
Screen Type
Cursor position YMOVIE-NOTES
** PBO Module **
MODULE INITIALIZE OUTPUT.
SET CURSOR FIELD
„YMOVIE-NOTES‟.
ENDMODULE.
OR
New Cursor
Position
Siemens Information Systems Ltd.
Overview
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 73/118
Global network
of innovation
SIEMENS
Overview
Academy Awards
Year
Category
1994
PIC
Exit Edit Loop
Academy Awards
Year
Category
1994
PIC
Winner Forrest Gump
Notes The Shawshank Redemption should have won.
Exit Update
Menu Painter
Using the Menu Painter, we can
add pushbuttons to the application
toolbar on both screens.
***Important Questions***
Where do you set the GUI status/title?
What type of GUI status is used?
How do you check the function code triggered?
What are the different function types?
Siemens Information Systems Ltd.
Menu Painter
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 74/118
Global network
of innovation
SIEMENS
Menu Painter
Menu Painter Create function codes
with a four-character
(maximum) identifier.
Function Key
AssignmentsStandard
Toolbar
Application
Toolbar Menubar
Siemens Information Systems Ltd.
Set GUI Status/Title in PBO Module
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 75/118
Global network
of innovation
SIEMENS
Set GUI Status/Title in PBO Module
** MZA05O01 - PBO Modules **
MODULE INITIALIZE OUTPUT.
IF SY-DYNNR = 9000.
SET PF-STATUS „FIRST‟.
SET TITLEBAR „ONE‟.
ELSE.
SET PF-STATUS „SECOND‟.
SET TITLEBAR „TWO‟.
ENDIF.
ENDMODULE.
PROCESS BEFORE OUTPUT.
MODULE INITIALIZE.
Screen 9000
PROCESS BEFORE OUTPUT.
MODULE INITIALIZE.
Screen 9001
SY-DYNNR =
current
screen
number
Notice that the call to module
“INITIALIZE” in the PBO of
each screen refers to the
same ABAP/4 module.
Siemens Information Systems Ltd.
GUI Status Type
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 76/118
Global network
of innovation
SIEMENS
GUI Status Type
Screen Type
Normal
Screen Type
Modal Dialog Box
GUI Status Type
Screen
GUI Status Type
Dialog Box
Screen type defined in
the Screen Attributes of
the Screen Painter.
GUI status type defined
in the Menu Painter.
Siemens Information Systems Ltd.
Checking Function Code Triggered
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 77/118
Global network
of innovation
SIEMENS
Checking Function Code Triggered
** MZA05TOP - Top Include **
PROGRAM SAPMZA05 MESSAGE-IDZA.
TABLES YMOVIE.
DATA OKCODE(4).
To check the OK Code of an
online program, you must define
this field in both the screen(Field List) and the program work
area (Top Include). Remember
that these fields must be given
the same name.
Siemens Information Systems Ltd.
Using the OKCODE
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 78/118
Global network
of innovation
SIEMENS
Using the OKCODE
** MZA05I01 - PAI Modules **
MODULE SELECT_LISTING INPUT.
IF OKCODE = „EDIT‟.
* code to select record from YMOVIE
ENDIF.
ENDMODULE.
** MZA05O01 - PBO Modules **
MODULE INITIALIZE OUTPUT.
* code to set GUI status/title
CLEAR OKCODE.
ENDMODULE.
Academy Awards
Year
Category
1994
PIC
Exit Edit Loop
We only want to select a
record from YMOVIE if the
user has invoked the „EDIT‟
function code (e.g., clicked
on the „Edit‟ pushbutton).
You should “clear out” the
OKCODE before a screen is
displayed so an old value
does not remain if the user
presses „Enter‟.
Function Code will always be capital
Siemens Information Systems Ltd.
Function Types
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 79/118
Global network
of innovation
SIEMENS
Function Types
Function Code
Type „ ‟ Type „E‟ Type „S‟ Type „T‟
EXITAT
CURSOR-
SELECTION
LEAVE TOTRANSACTION
Siemens Information Systems Ltd.
Overview
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 80/118
Global network
of innovation
SIEMENS
Overview
Academy Awards
Year
Category
1994
PIC
Exit Edit Loop
Academy Awards
Year
Category
1994
PIC
Winner Forrest Gump
Notes The Shawshank Redemption should have won.
Critic Dean Enter Name
Exit Update
Currently, the screen
sequence of our online
program is determined by
static “ Next Screen”
attributes on each screen.
We will learn how to
dynamical ly set the screen
sequence and add a pop-up
dialog box to enter a critic‟s
name.
Siemens Information Systems Ltd.
LEAVE SCREEN Statement
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 81/118
Global network
of innovation
SIEMENS
LEAVE SCREEN Statement
PROCESS BEFORE OUTPUT.
MODULE INITIALIZE.
PROCESS AFTER INPUT.
MODULE ONE.
MODULE TWO.
Screen 9000
“Next Screen”
attribute is 9001. ** PAI Modules **MODULE ONE INPUT.
. . .
LEAVE SCREEN.
. . .
ENDMODULE.
MODULE TWO INPUT.
. . .
ENDMODULE.
When LEAVE SCREEN is encountered, the system
immediately terminates the current screen‟s PAI
event and goes to the PBO event of the screen
specified in the “Next Screen” attribute.
Siemens Information Systems Ltd.
SET SCREEN Statement
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 82/118
Global network
of innovation
SIEMENS
SET SCREEN Statement
PROCESS AFTER INPUT.
FIELD YMOVIE-AAYEAR
VALUES (BETWEEN „1927‟ AND „1996‟).
CHAIN.
FIELD: YMOVIE-AAYEAR,
YMOVIE-CATEGORY.
MODULE SELECT_LISTING.
ENDCHAIN.
Screen 9000
“Next Screen”
attribute is 9000.
** MZA06I01 - PAI Modules **MODULE SELECT_LISTING INPUT.
IF OKCODE = „EDIT‟.
SET SCREEN 9001.
* code to select record from
YMOVIE
ENDIF.
ENDMODULE.
When SET SCREEN is encountered,the system temporarily ignores the
value in the “Next Screen” attribute
and uses the value specified
instead. The current screen‟s PAI
processing is not terminated.
Siemens Information Systems Ltd.
LEAVE TO SCREEN Statement
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 83/118
Global network
of innovation
SIEMENS
LEAVE TO SCREEN Statement
PROCESS AFTER INPUT.
FIELD YMOVIE-AAYEAR
VALUES (BETWEEN „1927‟ AND „1996‟).
CHAIN.
FIELD: YMOVIE-AAYEAR,
YMOVIE-CATEGORY.
MODULE SELECT_LISTING.
ENDCHAIN.
Screen 9000
“Next Screen”
attribute is 9000.
** MZA06I01 - PAI Modules **
MODULE SELECT_LISTING INPUT.
IF OKCODE = „EDIT‟.
* code to select record from YMOVIE
LEAVE TO SCREEN 9001.
ENDIF.
ENDMODULE.
When LEAVE TO SCREEN is
encountered, the systemterminates the current screen‟s
PAI event and immediately goes
to the PBO event of the screen
specified in the statement.
Siemens Information Systems Ltd.
CALL SCREEN Statement
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 84/118
Global network
of innovation
SIEMENS
CALL SCREEN Statement
Academy Awards
Year
Category
Winner
Notes should have won.
Critic Enter Name
Exit Update
Enter critic‟s name
Dean
Titlebar
Exit
CALL SCREEN 9002 STARTING AT 30 5 ENDING AT 60 10.
This ABAP/4 code would be in a
PAI module for screen 9001.
Screen 9002 is a
“Modal dialog box”
type screen with a
“Dialog box” type
GUI status.
Gl b l t k
Siemens Information Systems Ltd.
Leaving a “Called” Screen
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 85/118
Global network
of innovation
SIEMENS
Leaving a Called Screen
PROCESS BEFORE OUTPUT.
MODULE INITIALIZE.
PROCESS AFTER INPUT.
MODULE END.
Screen 9002** MZA06O01 - PBO Modules **
MODULE INITIALIZE OUTPUT.
* set GUI status and titlebar
* depending on screen number
* and clear okcode
ENDMODULE.
** MZA06I01 - PAI Modules **
MODULE END INPUT.
LEAVE TO SCREEN 0.ENDMODULE.Because screen 9002 was
“called”, SCREEN 0 refers to
the “calling” screen (9001).
“Next Screen”
attribute is 9002.
Gl b l t k
Siemens Information Systems Ltd.
Question ???
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 86/118
Global network
of innovation
SIEMENS
Question ???
Screen Attributes
Short Description
Screen Type
Next screen 9100
Screen 9100
Screen Attributes
Short Description
Screen Type
Next screen
Screen 9100
What happens after all PAI
modules are processed and
the “next screen” is itself?
What happens after all PAI
modules are processed and
the “next screen” is blank?
Gl b l t k
Siemens Information Systems Ltd.
Overview
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 87/118
Global network
of innovation
SIEMENS
Overview
ON INPUT
ON REQUEST
AT EXIT-
COMMAND
Conditional
Execution
Flow Logic
Additions
AT CURSOR-
SELECTION
ALWAYS IN
PAI
Gl b l t k
Siemens Information Systems Ltd.
ON INPUT
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 88/118
Global network
of innovation
SIEMENS
ON INPUT
PROCESS AFTER INPUT.
FIELD A MODULE CHECK ON INPUT.
Module “CHECK” will be executed only if the
value in field A is not equal to the initial valueappropriate to its data type (e.g., blanks for
character fields and zeroes for numeric fields).
ON CHAIN-INPUT.
Global network
Siemens Information Systems Ltd.
ON REQUEST
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 89/118
Global network
of innovation
SIEMENS
ON REQUEST
PROCESS AFTER INPUT.
FIELD A MODULE CHECK ON REQUEST.
Module “CHECK” will be executed on ly
if a value has been entered in field Asince the screen was displayed.
ON CHAIN- REQUEST.
Global network
Siemens Information Systems Ltd.
AT EXIT-COMMAND
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 90/118
Global network
of innovation
SIEMENS
AT EXIT COMMAND
PROCESS AFTER INPUT.
MODULE END AT EXIT-COMMAND.
Module “END” will be executed only if
the user invoked a function code withthe „E‟ function type.
Global network
Siemens Information Systems Ltd.
Timing of AT EXIT-COMMAND
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 91/118
Global network
of innovation
SIEMENS
Timing of AT EXIT COMMAND
Automatic
Screen Field
Checks
OK?
YES
NO
Go to PBO of
next screen
SCREEN
Type „E‟
Function CodePROCESS AFTER INPUT.
MODULE CHECK.
MODULE END AT EXIT-COMMAND.
Module “END”
executed.
Module “CHECK”
executed.
Data transport from screen
fields to program fields with
the same names.
NO DATA TRANSPORT
IF NO TERMINATION IN
EXIT_COMMAND THEN PROCESSING
FROM TOP TO BOTTOM OF PAI
Global network
Siemens Information Systems Ltd.
AT EXIT-COMMAND Example
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 92/118
Global network
of innovation
SIEMENS
AT EXIT COMMAND Example
Academy Awards
Year
Category
1910
PI
Exit Edit LoopPROCESS AFTER INPUT.
FIELD YMOVIE-AAYEAR
VALUES (BETWEEN „1927‟ AND „1996‟).
CHAIN.
FIELD: YMOVIE-AAYEAR, YMOVIE-CATEGORY.
MODULE SELECT_LISTING.ENDCHAIN.
MODULE END AT EXIT-COMMAND.
If the user invokes the „EXIT‟ function code (e.g., clicking
on „Exit‟), we will terminate the transaction. Because thisfunction code is type „E‟, we can use AT EXIT-COMMAND
to have the module “END” executed immediately (even
before the automatic field checks).
Global network
Siemens Information Systems Ltd.
AT CURSOR-SELECTION (1)
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 93/118
Global network
of innovation
SIEMENS
AT CURSOR SELECTION (1)
PROCESS AFTER INPUT.
FIELD A MODULE SEL1
AT CURSOR-SELECTION.MODULE SEL2 AT CURSOR-SELECTION.
Module “SEL1” will be executed on ly if the user
invoked the function code „CS‟ with the „S‟ function
type and the cursor was positioned in field A.
Global network
Siemens Information Systems Ltd.
AT CURSOR-SELECTION (2)
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 94/118
Global network
of innovation
SIEMENS
AT CURSOR SELECTION (2)
PROCESS AFTER INPUT.
FIELD A MODULE SEL1
AT CURSOR-SELECTION.
MODULE SEL2 AT CURSOR-SELECTION.
Module “SEL2” will be executed only if the user
invoked the function code „CS‟ with the „S‟ function
type and the cursor was no t positioned in field A.
Global network
Siemens Information Systems Ltd.
Overview
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 95/118
Global network
of innovation
SIEMENS
INSERT
UPDATE
DELETE
MODIFY
Database
Global network
Siemens Information Systems Ltd.
INSERT I: SAP Short Form
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 96/118
Global network
of innovation
SIEMENS
TABLES: SPLAN.
...
MOVE 'BC' TO SPLAN-AREA.
MOVE 'BC220' TO SPLAN-COURSE.
MOVE '23' TO SPLAN-WEEK.
MOVE ....
..
.
.
.
INSERT SPLAN.
ABAP/4
AREA COURSE WEEK TID1 TID2 TID3
BC BC220 23 . . .
Table work area SPLAN
SPLAN
DB
Global network
Siemens Information Systems Ltd.
INSERT II: SAP Long Form
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 97/118
Global network
of innovation
SIEMENS
TABLES: SPLAN.
...
DATA : REC LIKE SPLAN.
.
..MOVE 'BC' TO REC-AREA.MOVE 'BC220' TO REC-COURSE.MOVE '23' TO REC-WEEK.
MOVE … ...
...
IF SY-SUBRC NE 0.
g
ABAP/4
AREA COURSE WEEK TID1 TID2 TID3
BC BC220 23 . . .Table work area SPLAN
INSERT INTO SPLAN
VALUES REC.
SPLANDB
Global network
Siemens Information Systems Ltd.
UPDATE I: SAP Short Form
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 98/118
Global network
of innovation
SIEMENS
TABLES: SPLAN....
SELECT SINGLE * FROM SPLANWHERE AREA = 'BC'
AND COURSE = 'BC220'AND WEEK = '23'.
...
SPLAN-TID1 = '007'.
IF SY-SUBRC NE 0....
ENDIF.
UPDATE SPLAN
ABAP/4
AREA COURSE WEEK TID1 TID2 TID3
BC BC220 23 007
Table work area SPLAN
AREA COURSE WEEK TID1 TID2 TID3
BC BC220 23 . . .
SPLANDB
Global network
Siemens Information Systems Ltd.
UPDATE II: SAP Long Form
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 99/118
Global network
of innovation
SIEMENS
TABLES: SPLAN.
TID1 = '007'
TID2 = '003'
AREA = 'BC
AND COURSE = 'BC220'
AND WEEK = '23'
g
ABAP/4
AREA COURSE WEEK TID1
UPDATE SPLAN
SET
WHERE
TID2
BC BC220 23 007 003
..
.
:
.
.
.
.
.
.
Fields to change
Criteria for keywhere update is
to occur.
Global network
Siemens Information Systems Ltd.
UPDATE III: SAP Long Form
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 100/118
of innovation
SIEMENS
g
TABLES: SPLAN.
TID1 = '007'
COURSE = 'BC220'
AND WEEK >= '23'.
ABAP/4
BC BC220 23 007
AREA COURSE WEEK TID1 TID2
BC BC220 24 007
BC BC220 25 007
BC BC220 26 007
TID3
..
.
UPDATE SPLAN
SET
WHERE
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Global network
Siemens Information Systems Ltd.
Delete I: SAP Short Form
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 101/118
of innovation
SIEMENS
TABLES: SPLAN.
SPLAN-AREA = 'BC'.SPLAN-COURSE = 'BC220'.SPLAN-WEEK = '23'.
IF SY-SUBRC NE 0.
ENDIF.
DELETE SPLAN.
ABAP/4
AREA COURSE WEEK TID1 TID2 TID3
BC BC220 23
Table work area SPLAN
..
.
.
.
.
.
.
.
SPLAN
DB
Global network
Siemens Information Systems Ltd.
DELETE II: SAP Long Form
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 102/118
of innovation
SIEMENS
g
TABLES: SPLAN.
AREA = 'BC'AND COURSE = 'BC220'
AND WEEK = '23'.
IF SY-SUBRC NE 0.
ENDIF
ABAP/4
AREA COURSEWEEK
BC BC220 22BC BC220 23
BC BC220 24
..
.
.
.
.
.
.
.
DELETE FROM SPLANWHERE
Global network
Siemens Information Systems Ltd.
DELETE III: SAP Long Form
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 103/118
of innovation
SIEMENS
g
TABLES: SPLAN.
WEEK = '23'.
ABAP/4
DELETE FROM SPLAN
AREA COURSE WEEK
BC BC010 23
BC BC020 23
BC BC170 23
WHERE
..
.
.
.
.
.
..
.
.
.
.
.
.
.
.
.
Global network
Siemens Information Systems Ltd.
Array Operations
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 104/118
of innovation
SIEMENS
y
INSERT <table> FROM <itab>.
UPDATE <table> FROM <itab>.DELETE <table> FROM <itab>.MODIFY <table> FROM <itab>.
ABAP/4TABLES: SPLAN
DATA: BEGIN OF TAB OCCURS 10.
INCLUDE STRUCTURE SPLAN.DATA: END OF TAB.
MOVE …
APPEND TAB....
INSERT SPLAN FROM TAB.
.
.
.
TAB. . .
SPLANDB
Global network
Siemens Information Systems Ltd.
LUW (Logical Unit of Work)
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 105/118
of innovation
SIEMENS
and Data Consistency
Update
Object 1
Update
Object 2
COMMIT COMMIT
BeforeImage
After Image
Object 1
New
Object 2
New
Object 1
Old
Object 2
Old
Object 1
New
Object 2
New
LUW Program
SPLANDB
Global network
Siemens Information Systems Ltd.
COMMIT WORK - ROLLBACK
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 106/118
of innovation
SIEMENS
WORK
ABAP/4
( Implic i t )
(Expl ic i t )
DB-COMMIT
UPDATE 1 UPDATE 2
DB-COMMIT
SAP-COMMIT
Dialog 1 Dialog 2 Dialog 3
MODULE UPDATE INPUT.
UPDATE <table1>.
IF SY-SUBRC EQ 0.
COMMIT WORK.
ELSE.
ROLLBACK WORK.
MESSAGE E ... .
ENDIF.
UPDATE <table2>.
ENDMODULE.
Global network
Siemens Information Systems Ltd.
Overview
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 107/118
of innovation
SIEMENS
Academy Awards
Year
Category
1994
PIC
Winner Forrest Gump
Notes What about Pulp Fiction?!?
Critic Mark Enter Name
Exit Update
Academy Awards
Year
Category
1994
PIC
Winner Forrest Gump
Notes Great movie!!!
Critic Ellen Enter Name
Exit Update
Currently, multiple users can
edit the same record at the
same t ime . We will learn how
to prevent this occurrence.
Global network
Siemens Information Systems Ltd.
Locking Database Records
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 108/118
of innovation
SIEMENS
Database Lock
Database
Table
ABAP/4
Program
Logical Lock
In an ABAP/4 program, logical locking ensures that
only one user can edit a record at any one time.
Global network
f
Siemens Information Systems Ltd.
Lock Objects
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 109/118
of innovation
SIEMENS
ABAP/4 Dictionary
Primary
Table
Lock
Argues
YMOVIE AAYEAR
CATEGORY
LockObject
Sec
Table
Lock
Mode
Activate
EY_
EZ_dbname
Global network
f i ti
Siemens Information Systems Ltd.
Function Modules
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 110/118
of innovation
SIEMENS
CALL FUNCTION
„ENQUEUE _EZ_YMOVIE‟
EXPORTING
AAYEAR = YMOVIE-AAYEAR
CATEGORY = YMOVIE-CATEGORY
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHER = 3.
IF SY-SUBRC = 1.
MESSAGE E004.
ENDIF.
CALL FUNCTION
„DEQUEUE _EZ_YMOVIE‟ EXPORTING
AAYEAR = YMOVIE-AAYEAR
CATEGORY = YMOVIE-CATEGORY
EXCEPTIONS
OTHER = 1.
If a “lock” already exists for the record, the
“ENQUEUE” function module will raise the
“foreign lock” exception. If a “lock” does not
exist, this function module will “lock” the record.
If a “lock” exists for the
record, the “DEQUEUE”
function module will remove
the “lock” on the record.
Global network
f i ti
Siemens Information Systems Ltd.
Locking and Unlocking
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 111/118
of innovation
SIEMENS
MODULE SELECT_LISTING INPUT.
IF OKCODE = „EDIT‟.
PERFORM LOCK.
* code to select record from YMOVIE
ENDIF.
ENDMODULE.
MODULE UPDATE INPUT.
IF OKCODE = „UPDA‟.
UPDATE YMOVIE.
* code to commit or rollback
PERFORM UNLOCK.
ENDIF.
ENDMODULE.
This subroutine will “call”
the function module
“ENQUEUE_EZ_YMOVIE” to
check if the record is
already “locked” or to
“lock” the record.
This subroutine will “call”
the function module
“DEQUEUE_EZ_YMOVIE”
to “unlock” the record.
Global network
f i ti
Siemens Information Systems Ltd.
Overview
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 112/118
of innovation
SIEMENS
Dynamic Screen Modification
“Mirror Image” Table Work Area
PROCESS ON HELP-REQUEST
PROCESS ON VALUE-REQUEST
Global network
of inno ation
Siemens Information Systems Ltd.
Dynamic Screen Modification (1)
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 113/118
of innovation
SIEMENS
Academy Awards
Year
Category
1994
PIC
Winner Forrest Gump
Notes Great movie!!!
Critic Ellen Enter Name
Exit Update
Change / Display
Academy Awards
Year
Category
1994
PIC
Winner Forrest Gump
Notes Great movie!!!
Critic Ellen Enter Name
Exit Update
Change / Display
Field attributes can be
dynamically &
temporarily modified.Avtive, required, input,
output, intensified,
invisible, length,
display 3d, value help
Global network
of innovation
Siemens Information Systems Ltd.
Dynamic Screen Modification (2)
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 114/118
of innovation
SIEMENS
PROCESS BEFORE OUTPUT.
MODULE INITIALIZE.
MODULE MODIFY_SCREEN.
Screen 9001
** MZA11O01 - PBO Modules **
MODULE MODIFY_SCREEN OUTPUT.
* to change to display mode
LOOP AT SCREEN.
IF SCREEN-NAME = „YMOVIE-WINNER‟ OR
SCREEN-NAME = „YMOVIE-NOTES‟.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE.
You must use a PBO module to
dynamically modify a screen.
Turn the input attribute “off”
for display mode.
Don‟t forget to update the
changes to the “SCREEN”
internal table.
Use the system‟s “SCREEN”
internal table.
Global network
of innovation
Siemens Information Systems Ltd.
Mirror Image
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 115/118
of innovation
SIEMENS
Academy Awards
Year
Category
1994
PIC
Winner Forrest Gump
Notes Great movie!!!
Critic Ellen Enter Name
Exit Update
Change / Display
Currently, if the user clicks
on the „Update‟ pushbutton,our program will update the
record even if the user did
no t make any changes to it.
To avoid updating a
record that did not
change, we can use
a “mirror image” of the YMOVIE table
work area.
** MZA12TOP - Top Include **
PROGRAM SAPMZA12 MESSAGE-ID ZA.
TABLES: YMOVIE, *YMOVIE .
Global network
of innovation
Siemens Information Systems Ltd.
Mirror Image Example
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 116/118
of innovation
SIEMENS
** MZA12O01 - PBO Modules **
MODULE SELECT_LISTING OUTPUT.
IF OKCODE = „EDIT‟.
* code to select YMOVIE record
IF SY-SUBRC = 0.
MOVE YMOVIE TO *YMOVIE.ENDIF.
ENDIF.
ENDMODULE.
** MZA12I01 - PAI Modules **
MODULE UPDATE INPUT.
IF OKCODE = „UPDA‟.
IF YMOVIE = *YMOVIE.
MESSAGE S005.
ELSE.* code to update YMOVIE
ENDIF.
ENDIF.
ENDMODULE.
If a record is selected, it will
be placed in the “mirror
image” table work area.
If the record has not
changed, a message will be
issued and the record will
not be updated.
Global network
of innovation
Siemens Information Systems Ltd.
Process on Help-Request
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 117/118
of innovation
SIEMENS
PROCESS BEFORE OUTPUT.
. . .
PROCESS AFTER INPUT.
. . .
PROCESS ON HELP-REQUEST.
FIELD YMOVIE-AAYEAR WITH „0001‟.
Screen 9000Academy Awards
Year
Category
1994
PIC
Trigger “PROCESS ON HELP-REQUEST” Flow Logic event
for the particular field. This event will display the specified
supplemental documentation (e.g., „0001‟).
F1
Global network
of innovation
Siemens Information Systems Ltd.
Process on Value-Request
8/22/2019 PN06_PROGTYPE_118
http://slidepdf.com/reader/full/pn06progtype118 118/118
of innovation
F4
PROCESS BEFORE OUTPUT.
. . .
PROCESS AFTER INPUT.
. . .
PROCESS ON VALUE-REQUEST.
FIELD YMOVIE-AAYEAR
MODULE VALUE_LIST.
Screen 9000Academy Awards
Year
Category
1994
PIC
Trigger “PROCESS ON VALUE-REQUEST” Flow Logic
event for the particular field. This event will execute the