Escolar Documentos
Profissional Documentos
Cultura Documentos
Course Content
Table of Contents
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Course Content
Topic
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Course Content
Topic
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Course Content
Topic
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Course Content
Topic
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Course Content
Topic
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Overview of ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Overview of ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Overview of ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
1. INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
2. ABAP WORKBENCH BASICS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Types
The
e following
o o g list
st is
s an
a overview
o e e o of the
t e main
a features
eatu es oof data types aand
d
objects:
•Data types: A data type describes the technical attributes of all the
objects with that type. There is no memory associated with data types.
Data types Predefined User-defined
Elementary C,D,F,I,N,P,T,X ABAP/4 Contains User defined
eight predefined elementary data elementary data
yp
types yp
typesare based on the
predefined
Elementary data types
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Elementary Data Types- Predefined:
•Predefined:
Predefined elementary types are the smallest indivisible unit of
types. They can be grouped as those with fixed length and those with
variable length.
g
•Fixed-Length Elementary Types:
There are eight predefined types in ABAP with fixed length:
A)Four character types: Character (C), Numeric character
(N), Date (D), and Time (T).
B)One hexadecimal type: Byte field (X)
(X).
C)Three numeric types: Integer (I), Floating-point number (F)
and Packed number (P).
•Variable-Length Elementary Types:
There are two predefined types in ABAP with variable length:
STRING for character strings XSTRING for byte strings
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Elementary Data Types - User Defined
User-defined:
elementary data types are based entirely on predefined
elementary data types. To define your own elementary data types, you use
the TYPES statement
Example:
TYPES: NUMBER TYPE II.
TYPES
DATA: NO_FLIGHTS TYPE NUMBER
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Structured Data Types:
Structured Data types are made up of other types and generally are user
defined. There are two kind of structured data types.
•Field Strings:
A field string is a collection of other data types
types.You
You Define Field
string with the TYPES statement or with the DATA statement. structures
as components.
Internal Tables:
Internal tables consists of a several lines that all have the same
data type. Unlike field strings, which extends only horizontally, Internal
Table also extends vertically.You define Internal Table with occurs
parameter of the types
p yp or Data statement
Internal tables are characterized by:
The line type
The key and
The access method.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ABAP/4 Program Layout
To
o write
te a high
g quality
qua ty program
p og a you should
s ou d keep
eep certain
ce ta Layout
ayout
standards for ABAP/4 Programs. You should observe these
standards as soon as you start defining your data. Follow when
structuring your program flow, and use as many as informative
comments as possible. If you follow these suggestions your
program will be
• more readable
• easier to test and change
• more reliable
• To improve the quality of your programs, use the following
Techniques:
Indenting statement blocks
Using Modularization Tools
Inserting Program comments
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ABAP/4 Program Layout
Indenting statement blocks
You should combine statements that belong together into a single block .
Indent each block by at least two columns.
Using Modularization Tools
To produce good programs you should use modularization tools. If you
write larger processing blocks as subroutines, the logical structure of
your program becomes
b easier
i to
t identify.It
id tif It also
l allows
ll you to
t sortt the
th
subroutines according to the tasks they perform.
Inserting
g Program
g comments Correctly
y
You should avoid placing comments on statement line. Placing them on
separate comment lines improves the readability of the program.To insert
subroutine headings and comments in your program use the ready-made
ready made
structures available in ABAP/4 Editor.
Pretty Printer:
The ABAP/4 Editor includes a tool which helps you to design the Layout
of your program more easily. It follows ABAP/4 Layout guidelines
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Inserting ready-made structures
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Inserting ready-made Comment Lines
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Objects
Data objects contain the data with which ABAP programs work at runtime.
A) Literal
They are not created by declarative statements
statements. Instead
Instead, they exist
in the program code. They have fixed technical attributes but no name.
Hence they are also referred to as unnamed data objects.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Objects
Text symbols are pointers to texts in the text pool of the ABAP
program.
Variables are data objects whose contents can be changed using
ABAP statements.
t t t
Constants are data objects whose contents cannot be changed.
Interface work areas are special variables that serve as interfaces
between programs, screens, and logical databases.
Predefined Data Objects
They do not have to be declared explicitly - they are always
available at runtime.
Dynamic Data Objects
You create them dynamically using data references. They do
not have a name.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Internal Data objects
•Internal data objects are created for use in one particular program. They
have no validity outside that program.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Objects
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Objects : Contd..
System-defined data objects
Besides user-defined data objects, some data objects are defined
automatically by the system. When you start an ABAP/4 program, some
data objects are available automatically and do not need to be declared.
These are called System-defined data objects. They include:
Space:
The data Object SPACE is a constant of type C. It is one character
long and contains a space.
System fields:
All System fields have names with the format SY-<name>, where
<name> specifies an individual field. To display a list of available system
fields in the ABAP/4 Editor
Editor, type SHOW SY in the command line.line
Example:
SY-UNAME : login name of the user
SY-DATUM : current date
SY-UZEIT : current time
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Special data objects
- Parameters
Parameters are variables which are linked to a selection screen. They can
accept values after a program is started.
- Selection criteria
Selection criteria are special internal tables used to specify value ranges.
They are linked to a selection screen.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Creating Data Objects and Types
Apart
pa t from
o literals,
te a s, you must
ust declare
dec a e each
eac data object with
t a dec
declarative
a at e
statement . In declarative statements, you must specify the data type of all
data objects
You define the data type of an object in the declarative statement
statement, either
directly, using <declaration>…………TYPE<datatype>…………..
Indirectly, using <declaration>like<dataobject>…………..
•Type
yp and like are optional
p additions to most of the data declaration
statements listed below.
•With the TYPE option, you assign the data type<datatype>directly to the
declared data object
object.
•With the like option,you assign the data type of another data object<data
object> to the declared data object.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Creating Data Objects and Data Types:
ABAP/4 includes the keywords for creating Data objects and Data types
statically:
The Data statement for creating variables
Th Constants
The C t t statement
t t t f creating
for ti constants
t t
The Statics statement for creating variables which exist as long
as the program runs
runs, but are
only visible in a procedure
The Tables system for creating table work areas
The Type statement for creating user-defined data types
In the context of Internal Tables,, you
y use the operational
p statements
APPEND,COLLECT and INSERT to create lines of an Internal Tables
dynamically.
In case of selection screens
screens,you
you use the additional statements
PARAMETERS SELECT-OPTIONS to create Data objects with special
function
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Basic Form of the DATA Statement
•Data Statement
•Syntax
S t
In its basic form, the keyword DATA has the following parameters:
<f>
f Naming a Variable
<length> <type> Specifying the Data Type and the Length of
the Variable
<value> Specifying
p y g a Start Value
<decimals> Specifying the Number of Digits after the
Decimal Point
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Constants,Static and Tables
Syntax: Constants<c>[<length>]<type><value>[<decimals>]
Statics Statement
If you want to retain the value of variable beyond the runtime of a
procedure,
d you define
d fi the
th variable
i bl with
ith STATICS St
Statement
t t iin th
thatt
procedure.
Syntax: Statics<s>[<Length>]<type>[<Value>][<decimals>]
Tables statement
With the TABLES statement
statement, you can create a data object called a
table work area. A Table work area is a field string which refers to
ABAP/4 dictionary objects.
Syntax: Tables<dbtab>
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
The Types Statement
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
TYPE GROUPS
S t
Syntax: Type-Pools<name>
T P l
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Determining the Decimal Places
To determine the number of decimals for a Type P field, you use the
DECIMALS parameter with the DESCRIBE FIELD statement as follows:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Determine the conversion routine
To determine whether a conversion routine exists for a field in ABAP/4
Dictionary use the EDIT MASK parameter with the Describe Field
statement as follows:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
2. ABAP WORKBENCH BASICS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Internal Tables
Objective:
The following section explains :
• Defining Internal Tables
• Processing Internal Tables
• Accessing
A i Internal
I t l Tables
T bl
• Initializing Internal Tables
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Internal Tables
IInternal
t l tables
t bl are structured
t t d data
d t types
t provided
id d by
b ABAP/4.
ABAP/4
Internal tables cannot be accessed outside the program environment.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Accessing Internal Tables
•You access internal tables line by line. You must use a work area as an
interface for transferring data to and from the table.
•When you read data from an internal table, the contents of the addressed
t bl line
table li overwrite
it the
th contents
t t off the
th work k area..
• When you write data to an internal table, you must first enter the data in
the work area from which the system can transfer the data to the internal
table.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Types of internal tables
Note : Work area has the same name as the internal table.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Creating Internal Tables
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Creating Internal Tables
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Creating Internal Tables
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Filling Internal Tables
Appending Lines:
To append a line to an internal table, use the APPEND statement as
follows:
Syntax
APPEND [<wa> TO] <itab>.
LINE-COL1 = ‘A’.
LINE-COL2 = ‘1’.
APPEND LINE TO TAB1.
TAB1
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Filling Internal Tables
To fill an internal table with lines which have unique standard keys.
Syntax
S t
COLLECT [<wa> INTO] <itab>
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Filling Internal Tables
ITAB1-COL1
ITAB1 COL1 = ‘A’
A . ITAB1-COL2
ITAB1 COL2 = ‘1’
1.
COLLECT TAB1.
ITAB1-COL1 = ‘B’. ITAB1-COL2 = ‘2’.
COLLECT TAB1.
ITAB1-COL1 = ‘A’. ITAB1-COL2 = ‘1’.
COLLECT TAB1.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Filling Internal Tables
Inserting
se t g lines
es :
To insert a new line before a line in an internal table, you use the INSERT
statement as follows:
Syntax
INSERT [<wa>
[ INTO] <itab>
it b [INDEX <idx>].
id ]
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Filling Internal Tables
COPYING
CO G INTERNAL TABLES
S:
To copy the entire contents of one internal table into another, use the
MOVE statement.
Syntax:
MOVE <itab1> to <itab2>
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Filling Internal Tables
Filli IInternal
Filling t lTTable
bl from
f Database
D t b Table:
T bl
Example
LOOP AT ITAB.
WRITE: / ITAB-CONNID, ITAB-CARRID.
ENDLOOP.
In this example, all lines from the database table SPFLI in which CARRID
field contains "LH" are read into the internal table ITAB, where they can
be processed further.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Filling Internal Tables
T read
To d data
d t componentt by
b componentt into
i t the
th internal
i t l table.
t bl
In this example, all lines from the database table SPFLI in which CARRID
field contains "LH" are read into the internal table ITAB1 one by one,
where they can be processed further.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Reading Internal Tables
To read the contents of internal tables for further processing, you can use
either the LOOP or the READ statement.
You use the the LOOP statement to read internal tables line by line.
Eg: DO 3 TIMES.
LINE-COL1 = SY-INDEX. LINE-COL2 = SY-INDEX * SY-INDEX.
APPEND LINE TO TAB1.
ENDDO.
LOOP AT TAB1 WHERE COL1 > 2.
WRITE : / TAB1-COL1.
ENDLOOP.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Reading Internal Tables
You
ou can
ca select
se ect a single
s g e line
e by the
t e READ statement:
state e t
Syntax:
Eg:
TYPES : BEGIN OF LINE
LINE,
COL1 TYPE C,
COL2 TYPE N,
END OF LINE.
LINE
DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE.
DO 3 TIMES.
LINE-COL1
LINE COL1 = SY
SY-INDEX
INDEX. LINE
LINE-COL2
COL2 = SY
SY-INDEX
INDEX ** 2.
2
APPEND LINE TO TAB1.
ENDDO.
READ TABLE TAB1 INTO LINE WITH KEY COL2 = 4.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Reading Internal Tables
Thee CO
COMPARING G addition,
add t o , the
t e specified
spec ed table
tab e fields
e ds <f i > o
of the
t e structured
st uctu ed
line type are compared with the corresponding fields of the work area
before being transported. If the contents of the compared fields are the
same, SY-SUBRC is set to 0. If the contents of the compared fields are not
the same, it returns the value 2.
Syntax:
READ TABLE <itab> [INTO <wa>] INDEX <idx> COMPARING <fields>.
Eg:
TYPES : BEGIN OF LINE,
COL1 TYPE C,
COL2 TYPE N, N
END OF LINE.
DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE.
DO 3 TIMES.
TIMES
LINE-COL1 = SY-INDEX. LINE-COL2 = SY-INDEX ** 2.
APPEND LINE TO TAB1.
ENDDO.
READ TABLE TAB1 INTO LINE INDEX 2 COMPARING COL1 COL2.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Modifying Internal tables
You can modify single line using MODIFY statement:
Syntax :
MODIFY itab [FROM wa] [INDEX idx].
Eg:
TYPES : BEGIN OF LINE,
COL1 TYPE C,C
COL2 TYPE N,
END OF LINE.
DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE
LINE.
DO 3 TIMES.
LINE-COL1 = SY-INDEX. LINE-COL2 = SY-INDEX ** 2.
APPEND LINE TO TAB1.
TAB1
ENDDO.
LINE-COL1 = ‘A’.
MODIFY TAB1 FROM LINE INDEX 2.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Modifying Internal tables
Syntax :
MODIFY itab [FROM wa] [TRANSPORTING f1 ... fn [WHERE cond]].
Eg:
TYPES : BEGIN OF LINE,
LINE
COL1 TYPE C,
COL2 TYPE N,
END OF LINE.
DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE.
DO 3 TIMES.
LINE-COL1 = SY-INDEX. LINE-COL2 = SY-INDEX ** 2.
APPEND LINE TO TAB1.
ENDDO.
LINE-COL1 = ‘A’.
MODIFY
O TAB1 FROMO LINE TRANSPORTING
S O G COL1
CO WHERE COL2
CO = 4.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Deleting Internal tables
T delete
To d l t lines
li from
f an internal
i t l table
t bl in
i a loop:
l
Syntax:
DELETE <itab>.
<itab>
Note: The System can process this statement only within an
LOOP..ENDLOOP block.
Eg: DO 3 TIMES.
LINE-COL1 = SY-INDEX. LINE-COL2 = SY-INDEX * SY-INDEX.
APPEND LINE TO TAB1.
TAB1
ENDDO.
LOOP AT TAB1.
IF TAB1-COL1
TAB1 COL1 > 2
2.
DELETE TAB1.
ENDIF.
ENDLOOP.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Deleting Internal tables
TO delete
d l t the
th lines
li using
i Index.
I d
Syntax:
DELETE <itab> INDEX <idx>.
<idx>
Eg:
TYPES : BEGIN OF LINE,
COL1 TYPE C,
COL2 TYPE N,
END OF LINE.
DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE.
DO 3 TIMES.
LINE-COL1 = SY-INDEX. LINE-COL2 = SY-INDEX * SY-INDEX.
APPEND LINE TO TAB1.
ENDDO.
DELETE TAB1 INDEX 2.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Deleting Internal tables
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Deleting Internal tables
TO delete
d l t the
th Adjacent
Adj t Duplicates
D li t fromf the
th Internal
I t l Table.
T bl
Syntax:
DELETE ADJACENT DUPLICATE ENTRIES FROM <itab> [ COMPARING
<comp>]
Eg:
TYPES : BEGIN OF LINE,
COL1 TYPE C,
COL2 TYPE N,
END OF LINE.
DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE.
LINE-COL1 = ‘A’. LINE-COL2 = ‘2’.
APPEND LINE TO TAB1.
LINE-COL1 = ‘A’. LINE-COL2 = ‘2’.
APPEND LINE TO TAB1.
DELETE ADJACENT DUPLICATE ENTRIES FROM TAB1
COMPARING ALL FIELDS
FIELDS.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Deleting Internal tables
Eg:
TYPES : BEGIN OF LINE,
COL1 TYPE C,
COL2 TYPE N,
END OF LINE.
DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE.
LINE-COL1 = ‘A’. LINE-COL2 = ‘1’.
APPEND LINE TO TAB1.
TAB1
LINE-COL1 = ‘A’. LINE-COL2 = ‘2’.
APPEND LINE TO TAB1.
DELETE TAB1 WHERE COL2 = 2. 2
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Sorting Internal Table
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Loop Processing
Calculating
Ca cu at g the
t e totals
tota s within
t loop…endloop.
oop e d oop
Syntax: SUM
Eg.
TYPES : BEGIN OF LINE,
COL1 TYPE C,
COL2 TYPE I,
END OF LINE.
LINE
DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE.
DO 3 TIMES.
LINE COL1 = SY
LINE-COL1 SY-INDEX.
INDEX LINE
LINE-COL2
COL2 = SY-INDEX
SY INDEX ** 2
2.
APPEND LINE TO TAB1.
ENDDO.
LOOP AT TAB1
TAB1.
SUM.
ENDLOOP.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Using Control Levels
This
s top
topic
c describes
desc bes how
o to use control
co t o level
e e statement
state e t b
blocks
oc s which
c
process only specific values within loop…endloop.
Syntax:
AT <line>
<statement block>
ENDAT.
The line condition <line>, at which the statement block within AT-
ENDAT. <Line> Meaning
FIRST First line of the internal table
LAST Last line of the internal table
NEW <f> Beginning of a group of line with same contents
in the fields <f> & in the fields of <f>.
END OF <f> E d off a group off line
End li with
ith same contents
t t in
i
the fields <f> & in the fields of <f>.
Note: Before working with control breaks, You should sort the internal
table in the same order as its columns are defined.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Using Control Levels
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Using Control Levels
Example:
TYPES : BEGIN OF LINE,
COL1 TYPE C,
COL2 TYPE I,
I
END OF LINE.
DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE.
LINE-COL1 = ‘A’
A . LINE-COL2 = ‘2’
2.
APPEND LINE TO TAB1.
LINE-COL1 = ‘B’. LINE-COL2 = ‘1’.
APPEND LINE TO TAB1.
LINE-COL1 = ‘A’. LINE-COL2 = ‘3’.
APPEND LINE TO TAB1.
LINE-COL1 = ‘C’. LINE-COL2 = ‘4’.
APPEND LINE TO TAB1.
SORT TAB1 BY COL1.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Using Control Levels
Cont..
Cont
LOOP AT TAB1.
AT FIRST.
WRITE:/ ‘HEADING’.
ENDAT. AT
NEW COL1.
WRITE:/ TAB1-COL1.
ENDAT.
AT END OF COL1.
SUM.
WRITE:/ TAB1-COL1,, TAB1-COL2.
ENDAT. AT
LAST. SUM.
WRITE:/ TAB1
TAB1-COL1,
COL1, TAB1
TAB1-COL2.
COL2. ENDAT.
ENDLOOP.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Initializing Internal Tables
T initialize
To i iti li an internal
i t l table
t bl with
ith or without
ith t header
h d line.
li
Syntax :
REFRESH <itab>.
This statement resets an internal table.
CLEAR <itab>.
If you are working with an internal table with a header line , the clear
statement clears only the table work area resetting to initial values.
CLEAR <itab>[ ].
The square bracket after the name of the internal table refer to the body of
the internal table.This statement also resets an internal table.
FREE <itab>.
You can release the memory with the FREE statement once initialized.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Initializing Internal Tables
Example:
TYPES : BEGIN OF LINE,
COL1 TYPE C,
COL2 TYPE I,
END OF LINE.
DATA TAB1 .
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
2. ABAP WORKBENCH BASICS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Modularizing ABAP/4 Programs
Objective:
The following section explains :
• Include Programs
• Macros
• Subroutines
• Passing Data
• Terminating Subroutines
• Field Symbols
• Clusters
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Modularizing ABAP/4 Programs
Each
ac ABAP/4
/ pprogram
og a has
as a modular
odu a structure.
st uctu e
· Modules that are controlled by the screen flow logic when the program is
an dialog program (module pool of type M).
M) You can modularize either
your source code or tasks which are to be performed repeatedly.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Source Code Modularization
a. Include programs
b Macros
b.
a. Subroutine
b. Functional modules
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Include Programs
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Defining and Calling Macros
You can create callable modules of program code within your ABAP/4
program by defining macros.
macros
To define a macro which contains part of the source code, you use the
DEFINE statement as follows:
Syntax:
DEFINE <macro>.
<statements>
END-OF-DEFINITION.
This defines
f the macro <macro>. You must specify
f complete statements
between DEFINE and END-OF-DEFINITION.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Subroutines
· I t
Internall subroutines:
b ti
The source code of internal subroutines is in the same ABAP/4 program
as the calling procedure (internal call).
· External subroutines:
The source code of external subroutines is in an ABAP/4 program other
than the calling procedure (external call).
call)
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Defining Subroutines
Syntax:
FORM <subr> [<pass>]
[<pass>].
<statement block>
ENDFORM.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Calling Subroutines
1
1. Calling Internal Subroutines:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Calling Subroutines
Note:
· In the case of internal subroutines, you do not have to use the <pass>
option, because the subroutine can access all data objects declared in
the main ABAP/4 program.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Passing Data
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Declaring Data As Common Part
Syntax:
You can use several common parts in one program. In this case, you must
assign a name <name> to each common part. If you use only one
common part per program, the name <name> is optional.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Passing Data By Parameters
You can pass data between calling programs and subroutines by using
parameters.
· Parameters which are defined during
g the definition of a subroutine with
the FORM statement are called formal parameters.
· Parameters which are specified during the call of a subroutine with the
PERFORM statement are called actual parameters.
Syntax:
PERFORM <subr>[(<prog>)] [TABLES <actual table list>]
[USING <actual
t l input
i t list>]
li t ]
[CHANGING <actual output list>]
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Different Methods Of Passing Data
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Passing By Reference
Syntax:
PERFORM... [USING <ai1> ... <ain>] [CHANGING <ao1> ... <aon>] …
FORM ..... [USING <fi1> ... <fin>] [CHANGING <fo1> ... <fon>] ...
You specify the formal and actual parameters in the list behind USING and
CHANGING without any addition.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Passing By Value
Syntax:
PERFORM... USING .......<aii> ..
FORM ..... USING ...VALUE(<fii>) ..
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Passing By Value And Result
If y
you want to return a changed
g output
p parameter
p from a subroutine to the
calling program only after the subroutine has run successfully, use
CHANGING for the <pass> option of the FORM and PERFORM statements
as follows:
Syntax:
FORM ..... CHANGING ...VALUE(<fii>) ..
PERFORM CHANGING .......<aii>
PERFORM... < ii> ..
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example
REPORT FORMTEST.
DATA:
DATE1 TYPE D, DATE2 TYPE T,
STRING1(6) TYPE C,
C STRING2(8) TYPE C,
C
NUMBER1 TYPE P DECIMALS 2, NUMBER2 TYPE P,
COUNT1 TYPE I, COUNT2 TYPE I.
PERFORM TYPETEST USING DATE1 STRING1 NUMBER1 COUNT1.
COUNT1
PERFORM TYPETEST USING DATE2 STRING2 NUMBER2 COUNT2.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example
Cont..
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example
PROGRAM FORM_TEST.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example
Cont..
Co t
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Terminating Subroutines
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Field Symbols
Field symbols are placeholders or symbolic names for other fields. They
d nott physically
do h i ll reserve space forf a field,
fi ld but
b t point
i t to
t its
it contents.
t t A
field symbol can point to any data object. The data object to which a field
symbol points is assigned to it after it has been declared in the program.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Field Symbols
E
Example:
l
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Field Symbols
Cont..
012 34 56789
01 2345/67/89
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Field Symbols
Static Assign:
The name of the data object you want to assign to a field symbol before
run time.
S t
Syntax:
ASSIGN <f> TO <FS>.
Eg:
FIELD-SYMBOLS: <F1> , <F2> TYPE I.
DATA : NUM TYPE I VALUE 5,
TEXT(10) TYPE C VALUE ‘HELLO’.
ASSIGN TEXT TO <F1>.
ASSIGN NUM TO <F2>.
WRITE: / <F1> , <F2>.
<F2>
OUTPUT:
HELLO 5
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Field Symbols
Dynamic
y a c Assign:
ss g
The name of the data object you want to assign to a field symbol only at
run time.
Syntax:
ASSIGN (<f>) TO <FS>.
Eg:
PROGRAM SAPMZTST.
PERFORM FORM1(SAPMZTST1). * Calling Subroutine
PROGRAM SAPMZTST1.
FORM FORM1.
FIELD-SYMBOLS <F1>.
DATA : NUM TYPE N VALUE 5.
ASSIGN (NUM) TO <F1>.
WRITE: / <F1>.
ENDFORM
ENDFORM.
OUTPUT: 5
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Clusters
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Clusters
Note :
The memory is released again when you leave the transaction.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Storing Data Objects In ABAP/4 Memory
Syntax:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Reading Data Objects From Memory
To read data objects from ABAP/4 memory into an ABAP/4 program, you
use the following statement:
Syntax:
IMPORT <f1> [TO <g1>] <f2> [TO <g2>] ... FROM MEMORY ID <key>.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
2. ABAP WORKBENCH BASICS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
OBJECTIVES
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Displaying Internal tables
•Displaying ABAP/4 lists
•Replacing field values at runtime
•Changing internal tables at runtime
•Switching
S it hi tot the
th ABAP/4 Editor
Edit
•Releasing the database during debugging
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Online debugging tools : A review
The ABAP/4 Debugger lets you stop a program during runtime and
examine the flow and results of each statement during execution.
St
Stepping
i th
throughh a program withith the
th debugger
d b h l
helps you to
t detect
d t t and
d
correct errors in your code.This documentation is designed for
developers new to the Workbench’s debugging facilities or for those who
want to learn the tool to use the tool more effectively.
effectively
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
After working through this slides , you should be able to debug both
familiar and unfamiliar programs effectively. With this slides, you will
learn how to
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Starting the Debugger
•Debugger’s views
A debugger
gg selects different views , by
y selecting
g appropriate
pp p view name
in debugger’s menu.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
Th
These buttons
b tt has
h following
f ll i specific
ifi meaning.
i
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Structure of the Debugging view.
Each debugging view has the same structure. The top half of the screen
displays a portion of the programs source code. The lower half shows
i f
information
ti specific
ifi to
t that
th t particular
ti l view
i .At
At the
th Line
Li ‘S
‘Source C d of’
Code f’
appears two push buttons to scroll through the program code.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
ABAP Debugging Screen
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Static
Th
These are user independent
i d d t , sett directly
di tl into
i t a program’s
’ code
d with
ith the
th
editor. User dependent breakpoints also is possible.
•Dynamic
Set within the ABAP/4 debugger or editor. This type is visible when the
program is displayed in the editor.
•Watch points
Set within the ABAP/4 debugger .Watch points are field-specific. This is
used to observe changes
g to a particular
p field .The debugger
gg interruptsp
the program when fields content change.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Key word (statement) or event breakpoints
Set within the ABAP/4 debugger. The debugger interrupts the program
when the ABAP/4 processor comes in contact with a specific key word
(statement) or event in program’s code.
We can set watchpoints only from within the debugger.They are useful if
we want to interrupt a program only when there is a change in a particular
field or a field string. We can set and remove watch points as
Needed .This , as dynamic breakpoint , does not disturb the other users
of the same program.
g Static Breakpoints.
•Setting p
To set a static break point use ‘BREAK-POINT’ keyword.
Place the break point on the line where to interrupt the program:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
REPORT RSDEBUG1
……………
CHECK ACCOUNT
IF SY
SY-SUBRC
SUBRC NE 0 0.
BREAK-POINT.
ENDIF.
…….
When we start the report , ABAP/4 interrupts the processing at the break
point.
We can number breakpoints like BREAK
BREAK-POINT1
POINT1 ,BREAK
,BREAK-POINT2..for
POINT2..for
easier identification.
•Removing g Breakpoints.
p
It is necessary to remove the breakpoints after debugging .Use function
Utilities Æ Global search to help in locating break-points in larger
programs. It is necessary to remove breakpoints since it may cause
serious disruptions in productive process.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Setting Dynamic Breakpoints
UtilitiesÆBreakpointÆDisplay .
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Setting Watchpoints.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Setting Breakpoints at (statements) keywords or subroutines.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Deleting a dynamic Break-point.
To delete a dynamic breakpoint , place the cursor in a line and choose
BreakpointÆSet/Delete or Delete.
Deleting this breakpoint is also possible by double clicking the
appropriate
i t line.
li
From within the editor, deleting the dynamic breakpoint is done by the
following steps.
steps
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Deleting Watchpoints.
Watch points are special break points set for specific fields. To remove a
watch point , the following steps will do.
Choose Goto
Ch G t --> Control
C t l debugging-->Watchpoint.
d b i W t h i t
A display of the watch point occurs , and can be deleted by pressing
‘delete’ checkbox at the end of each Watchpoint .
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Stepping through program code.
From within the debugger several options for stepping through the
program.
•Displaying
Di l i the th field
fi ld contents.
t t
While debugging display of the critical of the critical contents of the fields
are possible.
possible
Display of the contents up to eight fields or field strings possible can be
done. We can enter the field names directly in the spaces provided or
double click the field in the code display and the system lists it as a
variable automatically.
We can use the variable screen to display the contents of any system field
or all field that a p
program
g references. Also the debugger
gg to display
p y fields
defined in the ABAP/4 Dictionary can be used.
To display the contents of dictionary fields, we must define relevant table
in the TABLES statement of the current program.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
Additionally the contents of the fields from external programs can be
displayed.
For this we need to place the name of the external program in brackets in
front of the field name.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Displaying Internal tables.
Usingg the column header line,, we can also change g the sequence
q of the
fields we want to see. If we remove a field name from the column header
line, then the system deletes the field from the display. If we specify an
incorrect field name, the system displays a string of question marks.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
A View
e oof internal
te a tab
table
eddisplay
sp ay
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
If the space you leave to display a field is too small , the system truncates
the display and indicates this by a “<” character.
As with the field display , we can customize the display format for internal
t bl
tables. Th standard
The t d d entry t ini the
th Format
F t field
fi ld is
i an E (for
(f edited)
dit d) . You
Y can
change this to an X for hexadecimal or a C for character display.
If we are debugging
gg g an online report
p that g
generates a list,, we can display
p y
this list in the debugger. As soon as this list is started, the display list
pushbutton appears. Choose Display list to switch to the list display. The
system displays all the lines generated so far in their respective formats.
Note : The current list line is formatted only after completion (NEW-LINE).
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Replacing fields at Runtime.
We can change the values of all fields , database tables (with offset) and
internal tables referenced in a report . If we alter the values of database
fields , we do not change them in the database itself , but only in the work
area ABAP/4 provides for one run of the report .The system displays an
appropriate message if any format errors occur.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
To replace the value , we can do the following steps.
ABAP/4 writes the new value back to the program field or fields and the
system notes the change in the system log. If we forget to click on the
‘Change
Change field content
content’ push
push-button
button , the system ignores the values we
entered.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Changing Internal Tables at Runtime
•Deleting a row
The line disappears from the table and the system adjusts the line
numbering accordingly.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Editing a row
The functions Change , Insert and append are field-specific in the
Debugger and can be carried out only one field at a time by pressing the
respective pushbuttons.
For example ,If we want to edit the following line:
LH001 FRANKFURT NEWYORK 145400 400 X,
we first need to decide which field to change.
Then the following steps must be done.
1.Place the cursor on the row and field we want to edit.
2.Choose Change.
3.Enter a new value for the field.
4.Choose Enter.
The system updates the line and displays the new contents in the table.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Adding
. a Row
We can add a new row to an internal table by using either Append or the
Insert function. Append places the new line at the end of the table.
Insert lets us to position the line anywhere.
anywhere
To add a new row to the end of the table , the following steps will do.
1.Choose append.
2.Enter a value for the first field in the line.
3.Choose Enter.
The system adds a line to the table and fills in the first field.
4.Enter the remaining fields of the line by following the procedure for
editing a row as described above.
To insert a new line anywhere in the internal table ,position the cursor on
y following
the line directly g the line where we want the new row to appear.
pp
Then ,Choose Insert button and proceed as we want to append the line.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
.•Switching to the ABAP/4 Editor
We can switch from the Debugger to ABAP/4 Editor at any time. If we
discover a program error during the debugging process , for example,we
can enter the ABAP/4 Editor to immediately correct the error in the
program’s code. We can also switch back to the editor in order to set new
static break-points.
After we set static breakpoints in the editor,they
editor they are not active in the
debugger when we switch back.We must re-generate the program.Then
the breakpoints appear in the debugger.
To return to the Editor for the program currently being debugged ,
Select Development-->ABAP/4 Editor.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
SYNOPSIS
A representation of Debugging Process -Branching to Debugging Mode
ABAP/4
Debugger
ABAP/4 Editor Object List
Debugging
gg g ...
Test/execute
/
Program B170D051 ...
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
Debugging Mode
PROGRAM B170D051. O S V F T P
DATA: DIFF TYPE P,
. View pushbuttons
.
.
COMPUTE DATE_1 = SY-DATUM.
.
.
.
V i bl
Variables
DATE_1 00000000 R
SY-DATUM 19940223 R
R
X R
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
The
e Most
ost Important
po ta t Debugging
ebugg g Functions
u ct o s
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
Setting Breakpoints
1
ABAP/4 Editor Menu Utilities
-> Breakpoints
Keyword BREAK-POINT
BREAK POINT
2
Debugging mode Line selection (double-click)
Menu: Breakpoint
-> Set/delete
Goto
-> Breakpoints
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
General
Ge e a Que
Queries
es
Question
•Static Break-point are user independent (YES/NO)
YES
•Dynamic Breakpoints are not user-specific(YES/NO)
NO
•Dynamic breakpoints are visible in the program(YES/NO)
YES
•Dynamic Breakpoints are more flexible than Static Breakpoints(YES/NO)
YES
•Static Breakpoints are hard-coded in the program(YES/NO)
YES
•Temporary deletion of dynamic breakpoints are not possible(YES/NO)
NO
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Watchpoints can be set only from within the debugger (YES/NO).
YES
•How can a temporary deletion of dynamic Breakpoints are done?
Temporary deletion of Breakpoints are done by option
ACTIVATE/DEACTIVATE in the debugging editor.
•What are the different options to step through the program in the
debugger?
Single Step
Execute
Continue
Return
•While debugging ,it is impossible to correct wrong values in a table’s
field dynamically during runtime (YES/NO)
NO
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
•Addition and deletion of fields in a table is possible in
Debugger(YES/NO).
YES
•From
F th ABAB Debugger
the D b , switching
it hi tot ABAP/4 Editor
Edit isi nott allowed.
ll d
(YES/NO)
NO
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Debugging
Summary
The above slides have given an idea of debugging , the debugging tools
for various operations like usage of breakpoints , watch points ,internal
t bl display,stepping
tables di l t i through
th h a program code,
d switching
it hi tot ABAP
editor and associated utilities.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
2. ABAP WORKBENCH BASICS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Function Modules
Object e
Objective
The following section is intended to explain:
• What function modules are
• Components of function modules
• Testing and releasing of function modules
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Function Modules
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Function Modules vs Subroutines
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Function Groups
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Creating Function Groups
New function groups can be created from the menu Goto - Function
Group - Create
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Programming Function Modules
To
o program
p og a a function
u ct o module,
odu e, we
e must
ust include
c ude our
ou statements
state e ts
between the FUNCTION and ENDFUNCTION statements as follows:
Syntax : FUNCTION <module>
<statements>
ENDFUNCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Components of Functional Modules
Import:
po t Values
a ues transferred
t a s e ed from
o the
t e calling
ca g p program
og a to tthe
e function
u ct o module.You
odu e ou
cannot overwrite the contents of import parameters at runtime.
Export: Values transferred from the function module back to the calling
program.
Tables: Internal tables that can be imported and exported. The internal table's
contents are transferred from the calling program to the function module. The
function module can alter the contents of the internal table and then send it
back to the calling program. Tables are always passed by reference.
p
Exceptions:Error situations that can occur within the function module.
The calling program uses exceptions to find out if an error has occurred in the
function module. It can then react accordingly.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Import Parameters
Import parameters : These must be supplied with data when we call the
function module, unless they are flagged as optional. We cannot change
them in the function module.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Export Parameters
Export parameters: These pass data from the function module back to the
calling program. Export parameters are always optional. We do not have
to receive them in our program.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Changing Parameters
C a g g parameters
Changing pa a ete s : CChanging
a g g paparameters
a ete s a
are
e passed by reference
e e e ce o
or
by value and result. Changing parameters act simultaneously as import
and export parameters. They change the value passed to the function
module and return it to the calling program.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Tables Parameters
Tables parameters :We use these to pass internal tables. They are treated like CHANGING
parameters. However, we can also pass internal tables with other parameters if you specify
the parameter type appropriately. The use of these exists in earlier FM definitions, as they
are considered obsolete now .
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Exceptions
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Source Code Tab
This tab shows the source of the function module in the ABAP/4 editor.
We can work with the source code in the same way as is done for normal
ABAP/4 programs opened via forward navigation.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Creating Function Modules
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Runtime Considerations
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Function Builder
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Function Builder
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Function Module Attributes
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Function Module Attributes - Processing Types
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Finding Function Modules
• U
Using
i th
the Repository
R it Information
I f ti System
S t
To search for a module, choose Find from the initial screen of the
Function Builder. The system displays the standard Function
Module search screen.
screen
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Finding Function Modules
• U
Using
i th
the Application
A li ti Hierarchy
Hi h
The Application Hierarchy provides an overview of all the applications
in your R/3 system. You can use this hierarchy to display function
modules associated with particular applications
applications.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Calling Function Modules
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
CALL FUNCTION - Example
PROGRAM CALL_FUNCTION.
CALL FUNCTION CASE SY-SUBRC
SY-SUBRC.
DATA: TEXT(10) TYPE C VALUE WHEN 0.
'0123456789', WRITE: / TEXT, / TEXT1, / TEXT2.
TEXT1(6) TYPE C, WHEN 1.
TEXT2(6) TYPE C. WRITE 'Target field 1 too short!'.
PARAMETERS POSITION TYPE I. WHEN 2.
WRITE 'Target field 2 too short!'.
CALL FUNCTION
WHEN 3.
'STRING_SPLIT_AT_POSITION'
EXPORTING WRITE 'Invalid split position!'.
STRING = TEXT WHEN 4.
POS = POSITION WRITE 'Other errors!'.
IMPORTING ENDCASE.
STRING1 = TEXT1
STRING2 = TEXT2
EXCEPTIONS
STRING1_TOO_SMALL = 1
STRING2_TOO_SMALL = 2
POS_NOT_VALID = 3
OTHERS = 4.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Documenting function modules
The documentation
Th d t ti for
f the
th function
f ti module
d l is
i done
d in
i the
th Function
F ti
Builder. There are two kinds of documentation - parameter
documentation, and full function module documentation.
• The parameter documentation must provide users with information
f
about the different parameters and exceptions.
• Function module documentation contains important
p detailed
information about the task of the function module. A detailed
documentation will help us to understand the function module
without having to examine its source code.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Activating Function Module
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Activating Function Group
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Testing Function Modules - Initial Screen
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Testing Function Module - Result Screen
The
e function
u ct o BAPI_CCOCCODE_G GET_FIRSTDAY
S _PERIODO whene eexecuted
ecuted with
t
values given in the previous screen gives the following output. It also
shows the time required for executing the function module.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Releasing function modules
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Function Modules
Summary
This section explained :
• The creation of function modules
• Components of function modules
• Releasing and activation of function modules
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
3. ABAP DATA DICTIONARY
Introduction
Database tables
Domains
Views
Search Helps
p
Locking Concept
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary
The ABAP Dictionary centrally describes and manages all the data
definitions used in the system. The ABAP Dictionary is completely
integrated in the ABAP Development Workbench. All the other
components of the Workbench can actively access the definitions
stored in the ABAP Dictionary
Dictionary.
The most important object types in the ABAP Dictionary are :-
1> Tables
2> Views
3> Types (data elements, structures, table types)
4> Domains
5> Search helps
6 L
6> Lock
k objects
bj t
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary
The documentation about the field is created for a data element that
describes the meaning of the contents of a table field.
The list of possible input values that appears for the input help is
created by a foreign key or a search help.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary
Introduction
Database tables
Domains
Views
Search Helps
p
Locking Concept
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Technical Settings
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Data Class
If you choose the data class correctly, your table is automatically
assigned
i d to
t the
th correctt area (tablespace
(t bl or DBspace)
DB ) off the
th database
d t b
when it is created. Each data class corresponds to a physical area in
which all the tables assigned to this data class are stored.
stored
APPL1 (transaction
(t ti data):
d t ) Data
D t th
thatt is
i frequently
f tl changed.
h d
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Two further data classes, USR and USR1, are provided for the
p
customer. These are for user developments. The tables assigned
g to
these data classes are stored in a tablespace for user developments.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Size Category
The size category defines the expected space required for the table in
th database.
the d t b You
Y can choose
h a size
i category
t from
f 0 to
t 4 for
f your
table.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Buffering
You must define whether and how a table is buffered in the technical
settings
tti ffor th
the ttable.
bl There
Th are three
th possibilities
ibiliti h here:
1> Buffering not permitted: Table buffering is not permitted, for
example because application programs always need the most
recent data from the table or the table is changed too frequently.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Buffering types:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Full buffering is usually more suitable for smaller tables that are
accessed frequently. This is because only one database access is
necessary to load such a table with full buffering, whereas several
database accesses are necessary for single-record buffering.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Logging
The logging flag defines whether changes to the data records of a
table should be logged.
logged If logging is activated,
activated every change
(with UPDATE, DELETE) to an existing data record by a user
or an application program is recorded in a log table in the
database.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Dependencies
Logging only takes place if parameter rec/client in the system profile
is set correctly
correctly. Setting the flag on its own does not cause the table
changes to be logged.
The existing
g logs
g can be displayed
p y with Transaction Table history
y
(SCU3).
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
Delivery class
The delivery class controls the transport of table data for installation
,upgrade,
d client
li t copy and
d when
h transporting
t ti between
b t customer
t
systems. The delivery class is also used in the extended table
maintenance.
maintenance
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Table
G: Customer table, SAP may insert new data records but may not
overwrite or delete existing ones.
E: System table with its own namespace for customer entries.
The customer namespace must be defined in table TRESC.
S: System table
table, data changes have the status of program changes
changes.
W: System table (e.g. table of the development environment) whose
data is transported with its own transport objects
(e.g. R3TR PROG, R3TR TABL, etc.).
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
3. ABAP DATA DICTIONARY
Introduction
Database tables
Domains
Views
Search Helps
p
Locking Concept
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Domain
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Domain
You can define fixed value intervals either by entering upper and
lower limits or by specifying single values. Value ranges and single
values can be combined as required. You can enter an explanatory
text for every single value or interval; it is displayed in the input
help.
help
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Domain
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Domain
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Domain
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Creating Domain
3> On the Data type tab page, choose the data type, number of
places (valid positions without editing characters such as comma
or period) and number of decimal places (only needed for data
types DEC, FLTP, QUAN and CURR).
Note that some data types have a fixed length
length. For example
example, the
data type CLNT (client) always has 3 places. If you enter an
invalid number of p
places for such a data type,
yp , the system
y corrects
this automatically after issuing a warning.
4> If only certain input values are valid for the domain, you can
enter them in the Value range tab page as fixed values.
Y can also
You l define
d fi a value
l table
t bl as proposed
d value
l for
f foreign
f i
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Creating Domain
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Creating Foreign Key
Procedure
1> In the field maintenance screen of the table, select the check field
and choose If the domain of the check field has a value table, you
can have the system create a proposal with the value table as check
table In this case a proposal will be made for the field assignment
table.
in the foreign key.
If the domain does not have a value table or if y
you reject
j the
proposal, the screen for foreign key maintenance appears without
proposals. In this case, enter the check table and save your entries.
The check table must have a key field to which the domain of the
check field is assigned.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Creating Foreign Key
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
3. ABAP DATA DICTIONARY
Introduction
Database tables
Domains
Views
Search Helps
p
Locking Concept
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Views
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Views
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Views
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Views
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Views
Four different view types are supported. These differ in the way in
which the view is implemented and in the methods permitted for
accessing the view data.
Database views are implemented with an equivalent view on the
database.
database
Projection
j views are used to hide fields of a table ((only
ypprojection).
j )
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Views- Database Views
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Views- Database Views
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Views- Creating Database Views
Procedure
1> Enter an explanatory short text in the field Short text.
You can for example find the view at a later time using this short
text.
2> Define the tables to be included in the view in the Tables field of
the Tables/Join conditions tab page.
Keep
p in mind that you
y can only
y include transparent
p tables in a
database view.
3> Link the tables with join conditions.
Place the cursor on a table name and choose Relationships.
All foreign keys to other tables defined for this table are
di l
displayed.
d Select
S l t the
th foreign
f i keys
k and
d choose
h Copy.
C
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Views- Creating Database Views
The join condition is now derived from the definitions in the foreign
key.
4> On the View fields tab page, select the fields that you want to copy
to the view.
Choose Table fields
fields. All the tables contained in the view are
displayed in a dialog box. Select a table. All the fields contained
in this table are displayed.
p y You can copy
py fields by
y selecting
g them
in the first column and choosing Copy.
5> On the Selection conditions tab page, you can (optionally)
formulate restrictions for the data records to be displayed with
the view .
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Views- Creating Database Views
The selection conditions define the data records that can be selected
with the view.
6> With Goto - Technical settings , you can (optionally) maintain the
technical settings of the database view.
You can define whether and how the database view should be
b ff
buffered
d here.
h Proceed
P d as for
f the
h technical
h i l settings
i off a table
bl
7> On the Maintenance status tab page, select the maintenance status
of the database view.
view
If the view contains more than one table, the maintenance status
read only
y cannot be altered.
8> Save your entries. You are asked to assign the view a
development class.
9> Choose Activate .
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Views- Projection View
Projection views are used to hide fields of a table. This can minimize
interfaces; for example when you access the database, you only read
and write the field contents actually needed.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Views- Projection View
Projection View
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Views- Creating Projection View
Procedure
1> Enter an explanatory short text in the field Short text.
You can for example find the view at a later time using this short
text.
2> Enter a table name in the field Base table
table.
A projection view always contains exactly one table.
3> Select the fields of the base table that y
you want to include in the
view. Choose Table fields. The fields of the table are now
displayed in a dialog box. You can copy fields by selecting them
in the first column and choosing Copy.
4> Save your entries.You are asked to assign the view a development
class.
l
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Views- Creating Projection View
Result
The help view is activated. At activation, a log is written; it can be
displayed with Utilities ® Activation log. If errors or warnings
occurring when the view was activated, they are displayed directly
in the activation log.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Views-Help View
You have to create a help view if a view with outer join is needed as
selection method of a search help.
p
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Views-Help View
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
3. ABAP DATA DICTIONARY
Introduction
Database tables
Domains
Views
Search Helps
p
Locking Concept
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Search Help
The input help (F4 help) is a standard function of the R/3 System.
The user can display the list of all possible input values for a screen
field with the input help.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Search Help
(interface of the search help) and how the online input help should
be defined (online behavior of the search help).
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Search Help- Examples
2>The user should be able to search for the customer number using
g
existing customer bookings.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Search Help- Examples
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Search Help- Examples
In the dialog box for restricting values, the user should be able to
restrict values with the customer’s name and address, i.e. the fields
for the street, city and country. These fields as well as the customer’s
number (the information to be found must always be in the hit list)
should appear in the hit list.
list The fields ID,
ID NAME,
NAME STREET,
STREET CITY
and COUNTRY of table SCUSTOM must be included in the search
help as parameters.
The parameter ID is declared to be an import parameter. A pattern
entered in the corresponding field of a screen template can therefore
be used directly for the value selection. Restrictions for the other
parameters of the search help must be entered in the dialog box for
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Search Help- Examples
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Search Help- Examples
Procedure
1> In the initial screen of the ABAP Dictionary, select object class
Search help, enter the name of the search help and choose Create.
A dialog box appears in which you must select the type of search
help.
help
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Creating Search Help
4> In the Definition tab page enter the selection method of the search
help. You can enter the name of a table or a view (database view
, projection view or help view) here. If you enter a table that has
a text table, the name of the text table is automatically entered
in the corresponding field.
field
5> Using
g the input
p help
p (F4
( help),
p), select fields of the selection
method as parameter in the Search help parameter area. Select
the fields that should be used in the dialog box for value selection
or in the hit list.
If the selection method is a table that has a text table, both the
fi ld off the
fields th table
t bl and
d the
th fields
fi ld off the
th text
t t table
t bl are offered
ff d in
i the
th
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Creating Search Help
input help.
The data element of the parameter is automatically copied from the
selection method. The data element defines the output attributes
and the F1 help of the parameter in the hit list and in the dialog box
for value selection.
selection
You can assign the parameter another data element. To do so, select
the Mod flag.
g The Data element field is now ready
y for input.
p Then
select a data element with the input help (F4 help). Only data
elements whose data type, length and number of decimal places is
the same as those of the previous data element can be assigned.
This removes the link between the data element of the search help
parameter
t and
d the
th data
d t element
l t off the
th selection
l ti method
th d field
fi ld having
h i
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Creating Search Help
the same name. If you cancel the Mod flag, the data element of the
assigned table field is used again.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Creating Search Help
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Creating Search Help
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Creating Search Help
2> Complex dialog with value restriction: The dialog window for
restricting values is offered immediately. Choose this option if
the list of possible entries is usually very large. If the user limits
th amountt off data
the d t to
t be
b processed,
d the
th hit list
li t will
ill become
b more
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Creating Search Help
3> Dialog depending on number of values: If the hit list contains less
than 100 entries,
entries it is displayed immediately.
immediately If the hit list
contains more than 100 entries, the dialog box for restricting
values is displayed.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Collective Search Help
Procedure
1> In the initial screen of the ABAP Dictionary, select object class
Search help, enter the name of the search help and choose Create.
A dialog box appears in which you must select the type of search
help.
help
3> Enter an explanatory text in the field Short text.You can for
example find the search help at a later time using this short text.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/Creating Collective Search Help
4> In the Definition tab page enter the parameters of the collective
search help. Select the Imp flag if it is an import parameter. Select
the Exp flag if it is an export parameter
parameter.
Define the types for the parameters of a collective search help by
assigning a data element. Enter the name of the data element that
describes the contents of the search help parameter in the Data
element field.
You can assign the parameter a default value in the Default value
field.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/Creating Collective Search Help
6> On the Included search helps tab page, define the search helps
that you want to include in the collective search help.You can
i l d elementary
include l t searchh helps
h l and d collective
ll ti search
h helps.
h l Use
U
the Hide flag to control whether an included search help should
appear in the dialog box for selecting the elementary search help.
If the flag is set
set, the search help is not offered.
offered
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
3. ABAP DATA DICTIONARY
Introduction
Database tables
Domains
Views
Search Helps
p
Locking Concept
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Lock Objects
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Lock Objects
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Lock Objects
Lock Arguments
The lock argument
g of a table in the lock object
j consists of the key
y
fields of the table.
The lock argument fields of a lock object are used as input
parameters in the function modules for setting and removing locks
generated from the lock object definition. When these function
modules
d l are called,
ll d the
th table
t bl rows to
t be
b locked
l k d or unlocked
l k d are
specified by defining certain values in these fields. These values can
also be generic
generic. The lock argument fields therefore define which
subset of the table rows should be locked.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Lock Objects
The simplest case of a lock object consists of exactly one table and
th llock
the k argumentt off th
the ttable
bl iis th
the primary
i k
key off thi
this table.
t bl
Several tables can also be included in a lock object. A lock request
therefore can lock an entire logical object
object, and not only a record of
a table. Such a logical object can be for example a document
comprising an entry in a header table and N entries in a position
table.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Lock Objects
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Lock Objects
Lock Mode
The lock mode controls whether several users can access data
records at the same time
time. The lock mode can be assigned separately
for each table in the lock object. When the lock is set, the
corresponding lock entry is stored in the lock table of the system
for each table.
Access by more than one user can be synchronized in the following
ways:
Exclusive lock: The locked data can only be displayed or edited by
a single user. A request for another exclusive lock or for a
shared
h d lock
l k is
i rejected.
j t d
Shared lock: More than one user can access the locked data at the
same time in display mode
mode. A request for another shared lock is
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Lock Objects
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Creating Lock Object
1> Select object type Lock object in the initial screen of the ABAP
Dictionary, enter an object name and choose Create.
The name of a lock object should begin with an E (Enqueue).
The maintenance screen for lock objects is displayed.
3> Enter the name of the primary table of the lock object.
All other tables in the lock object must be linked with the primary
t bl using
table i foreign
f i keys.
k
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Creating Lock Object
4> Select the lock mode of the primary table in the field below it.
The lock mode is used as the default value for the corresponding
parameters of the function modules generated from the lock
object.
5> Choose Add if you want to lock records in more than one table
with the lock object.
j
A list of all the tables linked with the primary table using valid
foreign keys is displayed. Select the appropriate table. The lock
mode of the primary table is copied as lock mode. You can change
this setting as required, for example you can assign the lock mode
separately
t l for
f each
h table.
t bl
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Creating Lock Object
Similarly, you can add a table linked with the secondary table just
added with foreign keys. To do this, place the cursor on the name
of the secondary table and choose Add.
If no lock mode is assigned to a table, no lock is set for the entries
in this table when the generated function modules are called.
called You
should not assign a lock mode if a secondary table was only used
to define a p
path between the primary
p y table and another secondary
y
table with foreign keys.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Creating Lock Object
7> You can define whether the function modules generated from the
lock object should be RFC-enabled on the Attributes tab page.
If you set the Allow RFC flag, the generated function modules
can be called from within another system with Remote Function
Call.
Call
If you permit Remote Function Calls for an existing lock object,
you must ensure that the g
y generated function modules are called
from within an ABAP program with parameters appropriate for
the type. You should therefore check all programs that use the
associated function modules before activating the lock object with
the new option.
8 Ch
8> Choose A
Activate.
ti t
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Creating Lock Object
Result
When you activate the lock object, the two function modules
ENQUEUE_<lockobjectname> and DEQUEUE_<lockobjectname>
are generated from its definition to set and release locks.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Function Modules for Lock Requests
The flights are recorded in table SFLIGHT and the bookings for the
flights in table SBOOK. The two tables are linked with a foreign key.
Lock object E_BOOKING must therefore contain table SFLIGHT
as primary table and table SBOOK as further table.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Function Modules for Lock Requests
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Function Modules for Lock Requests
Select exclusive lock mode, that is the locked data can only be
displayed and edited by one user.
When the lock object is activated, the following function modules
are generated from its definition:
ENQUEUE_ E_BOOKING (set locks)
DEQUEUE_ E_BOOKING (release locks)
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Function Modules for Lock Requests
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Function Modules for Lock Requests
The existing exclusive lock entries for flight LH 400 are deleted in
table SFLIGHT and the bookings for this flight are deleted in table
SBOOK. The request to delete the lock entries is passed on to the
update program (_SCOPE = ‘3’).
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Parameters of Function modules
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Parameters of Function modules
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Parameters of Function modules
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Parameters of Function modules
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Parameters of Function modules
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/ Parameters of Function modules
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/Summary
SUMMARY
( The ABAP Dictionary centrally describes and manages all the data
definitions used in the system. The ABAP Dictionary is completely
integrated in the ABAP Development Workbench.
( Tables are defined in the ABAP Dictionary independently of the
database.
( Views
Vi are logical
l i l views
i on more than
h one table.
bl
( A domain defines the value range of all table fields and
structure components that refer to this domain
domain.
( Lock Objects are used to synchronize access to the same data by
more than one user.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Data Dictionary/Exercise
EXERCISE
Using SE11 create an user defined table with the following fields,
Employee No.
No (Primary Key)
Name
Designation
Salary
Try to add few records into that table.
N t Follow
Note: F ll the
th steps
t explained
l i d in
i the
th presentation
t ti for
f the
th creation
ti off
the table.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
4. ADVANCED ABAP
Open SQL
Dynamic Programming
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADVANCED ABAP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
5. ABAP OBJECTS
I h it
Inheritance
Polymorphism (casting)
Interfaces
Events
Gl b l classes
Global l and
d interfaces
i t f
Exception handling
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Course Contents
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects About ABAP Objects
ABAP Objects
Obj t isi fairly
f i l a new conceptt in
i R/3.
R/3 Th
The tterm h
has ttwo meanings.
i
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects ABAP Runtime Environment
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects The Object-oriented Language Extension
• This object-oriented
j extension of ABAP builds on the existing
g
language, and is fully compatible with it.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects The Object-oriented Language Extension
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Object-Orientation
Object o
orientation
e tat o (OO), oro to be more
oep precise,
ec se, object
object-oriented
o e ted
programming, is a problem-solving method in which the software solution
reflects objects in the real world .
•Objects
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Advantages of OO
•The main difference between real objectj orientation and function g
groups
p is that
although a program can work with the instances of several function groups
at the same time, it cannot work with several instances of a single function
group.
• This
Thi requirement
i t iis mett b
by object
bj t orientation.
i t ti ABAP Obj
Objects
t allows
ll you tto d
define
fi
data and functions in classes instead of function groups. Using classes, an ABAP
program can work with any number of instances (objects) based on the same
te p ate
template.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Objects
•Each object
j has a unique
q identity
y and its own attributes.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Overview Graphic - Classes
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Structure of a Class
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Class Components
• All components
t are declared
d l d in
i the
th declaration
d l ti partt off the
th class.
l
p
• The components define the attributes of the objects
j in a class.
• All of the components of a class are visible within the class. All
components are in the same namespace.
• This means that all components of the class must have names that
are unique within the class.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Attributes
•Attributes are internal data fields within a class that can have any
ABAP data type.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Methods
•They can access all of the attributes of a class. This allows them to
change the data content of an object.
•They also have a parameter interface, with which users can supply
them with values when calling them, and receive values back from
them
•The p
private attributes of a class can only
y be changed
g byy methods in
the same class.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Methods - syntax
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Methods - types
• Instance Methods
You declare instance methods using the METHODS statement. They can
access all of the attributes of a class, and can trigger all of the events of the
class
• Static Methods
You declare static methods using the CLASS-METHODS statement.
They can only access static attributes and trigger static events.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Types of classes
• Local classes
- are defined
d fi d iin your program.
- cannot be accessed outside your program.
• Global classes
- Are defined in the repository using either transaction SE80 or SE24
- Can be accessed by all programs
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Encapsulation - Classes Visibility
•Encapsulation:
capsu at o
•Objects restrict the visibility of their resources (attributes and methods) to
other users. Every object has an interface, which determines how other
objects can interact with it. The implementation of the object is
encapsulated, i.e. invisible outside the object itself.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Public Section
Public Section
•All of the components declared in the public section are accessible to
all users of the class, and to the methods of the class and any classes
that inherit from it.
•The public components of the class form the interface between the
class and its users
users.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Private Section
•Private Section
•Components that you declare in the private section are only visible in
the methods of the same class.
class
•The private components are not part of the external interface of the
class.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Protected Section
• Protected Section
All components in the protected section can be accessed by all
methods of the same class as well as all methods of its sub-classes
sub-classes.
All of the components in the protected section can access the
components from the public section. In turn, they can be accessed by
the components of the private section
section.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Introductory Example
CLASS C
C_COUNTER
COUNTER DEFINITION
DEFINITION.
PUBLIC SECTION.
METHODS: SET_COUNTER IMPORTING VALUE(SET_VALUE) TYPE I,
INCREMENT_COUNTER,
GET_COUNTER EXPORTING VALUE(GET_VALUE) TYPE I.
PRIVATE SECTION.
DATA COUNT TYPE I.
ENDCLASS.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Object references
•To access an object from an ABAP program, you use object references.
•Object
Object references are pointers to objects. In ABAP, they are always
contained in reference variables.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Data Types for References
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Creating Objects
•Before you can create an object for a class, you need to declare a
reference variable with reference to that class.
•Once you have declared a class reference variable <obj> for a class
<class>, you can create an object using the statement
CREATE OBJECT <obj>.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Addressing the Components of Objects
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Addressing the Components of Objects
•You can access static components using the class name as well as the
reference variable.
•It is also p
possible to address the static components
p of a class before an
object has been created.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Self references
•Within a class, you can use the self-reference ME to access the individual
components:
•You can also access attributes in methods from within an object even if they are
obscured
b dbby llocall attributes
tt ib t off th
the method.
th d
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Self references- Example
REPORT zharesh .
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Overview Graphic - Objects
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Example - Step 1
The DATA statement creates a class reference variable CREF1 with type
C_COUNTER. This variable can contain references to all instances of the class
C_COUNTER. The class C_COUNTER must be known to the program when
the DATA statement occurs. You can either declare it locally before the data
statement in the same program, or globally using the Class Builder. The
contents of CREF1 are initial. The reference does not point to an instance.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Example - Step 2
The ABAP program can access the public components of the object using the
reference variable CREF1, that is in this case, it can call the public methods of
the class C_COUNTER. After the program on the left-hand side has been
executed, the program variables NUMBER and the private object attribute
COUNT both have the value 8.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Example - Step 4
This declares three different class reference variables for the class
C_COUNTER. All of the references are initial.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Example - Step 5
The system creates three objects of the class from the three class reference
variables. The references in the three reference variables each point to one of
these objects.
In the internal program management, the individual instances are called
C_COUNTER<1>, C_COUNTER<2>, and C_COUNTER<3>. They are named
in the order in which they were created.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Example - Step 6
The ABAP program can use the reference variables to access individual objects
objects,
that is in this case, to call the public methods of the class C_COUNTER.
Each object has its own state, since the private instance attribute COUNT has a
separate value for each object. The program on the left-hand side administers
several independent counters.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Example - Step 7
Here, three class reference variables are declared for the class C
Here C_COUNTER,
COUNTER
and two objects are created for the class. The references in the reference
variables CREF1 and CREF2 each point to one of these objects. The reference
in CREF3 is initial.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Example - Step 8
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Example - Step 9
The CLEAR statement resets the reference in CREF2 to its initial value
value. The
reference variable CREF2 then contains the same value as it did immediately
after its declaration, and does not point to an object any more.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Example - Step 10
The effect of the assignment statement is to copy the reference from CREF1 to
CREF2. As a result, the reference in CREF3 also points to the object
C_COUNTER<1>. No more references point to the object C_COUNTER<2>,
and it is automatically deleted by the Garbage Collection. The internal name
C_COUNTER<2> is now free again.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Declaring Methods
To pass a parameter by value, you must do so explicitly using the VALUE addition.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Implementing Methods
You must implement all of the methods in a class in the implementation part of the
class in a
METHOD <meth>
<meth>.
...
ENDMETHOD.
block.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Calling Methods
To call a method
method, use the following statement:
CALL METHOD <meth> EXPORTING... <ii> =.<f i>...
IMPORTING... <ei> =.<g i>...
CHANGING ... <ci> =.<f i>...
RECEIVING r=h
EXCEPTIONS... <ei> = rc i...
Within
t the
t e implementation
p e e tat o part
pa t of
o a cclass,
ass, you ca
can ca
call tthe
e methods
et ods o
of tthe
e sa
same
e
class directly using their name <meth>.
CALL METHOD <meth>...
where <ref> is a reference variable whose value points to an instance of the class.
Visible instance methods can be called from outside the class using
CALL METHOD <class>=><meth>...
where <class> is the name of the relevant class
class.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Constructors
C
Constructors
•Constructors are special methods that cannot be called using CALL METHOD.
•Instead, they are called automatically by the system to set the starting state of a
new object or class.
•Executed
E t d only
l once per iinstance
t att th
the titime off creating
ti an object
bj t
•To use them, you must declare them explicitly in the class.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Static Constructors
Static Constructors
S C
•CLASS-METHODS: CLASS_CONSTRUCTOR
•Only
Only accessed once per program
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Functional Methods
Functional Methods
Format:
Eg:
g a = b + function_name().
()
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
5. ABAP OBJECTS
I h it
Inheritance
Polymorphism (casting)
Interfaces
Events
Gl b l classes
Global l and
d interfaces
i t f
Exception handling
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ABAP Objects
Inheritance - 1
Inheritance allows yyou to derive a new class from an existing
g class.
statement.
The new class <subclass> inherits all of the components of the existing
class <superclass>.
The new class is called the subclass of the class from which it is derived
derived.
Only the public and protected components of the superclass are visible in the
subclass.
You can declare private components in a subclass that have the same names as
private components of the superclass. Each class works with its own private
components.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Inheritance - 2
A class can have more than one direct subclass, but it may only have one
direct superclass. This is called single inheritance.
The root node of all inheritance trees in ABAP Objects is the predefined
empty class OBJECT.
This is the most generalized class possible, since it contains neither
attributes nor methods.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Inheritance - Example
Inheritance
Example
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Inheritance – Redifining Methods - 1
All subclasses contain the components off all classes between themselves and the
root node in an inheritance tree. The visibility of a component cannot be changed.
However, you can use the REDEFINITION addition in the METHODS statement to
redefine an inherited public or protected instance method in a subclass and make its
function more specialized.
Any reference that points to an object of the subclass uses the redefined method,
even if the reference was defined with reference to the superclass
superclass.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Inheritance – Redifining Methods - 2
Within a redefined
f method, you can use the pseudoreference
f SUPER->
S to access
the obscured method. This enables you to use the existing function of the method in
the superclass without having to recode it in the subclass.
The method declaration and implementation in the superclass is not affected when
you redefine the method in a subclass.
Any reference that points to an object of the subclass uses the redefined method,
even if the reference was defined with reference to the superclass.
p
If, for example, a superclass method M1 contains a call CALL METHOD ME->[M2],
and M2 is redefined in a subclass
subclass, calling M1 from an instance of the superclass will
cause the original method M2 to be called, and calling M1 from an instance of the
subclass will cause the redefined method M2 to be called.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Inheritance – Constructors
• If you define
d fi a constructor
t t in i the
th sub-class,
b l th
then iirrespective
ti off whether
h th you h have
defined a constructor in the super-class or not, you need to explicitly call the
constructor of the super-class using the statement
CALL METHOD SUPER->CONSTRUCTOR.
Incase the super-class does not have a constructor, the default constructor will
be called by the system. (which will do nothing)
• If you don
don’tt have a constructor in the sub
sub-class
class but if you have a constructor in the
super-class, and if you create an object of the sub-class, then the default
constructor of the sub-class will call the constructor of the super-class.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Redefining Methods - Example
Method Redefinition
Example
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Abstract, Final and Singleton
The ABSTRACT
S C and FINAL additions to the METHODS O S and CLASS
C SS statements
allow you to define abstract and final methods or classes.
Abstract –
•Abstract classes cannot be instantiated.
•An abstract method is defined in an abstract class and cannot be implemented in
that class. Instead, it HAS to be implemented in the subclass.
Final –
•Final classes cannot have subclasses.
•Theyy conclude an inheritance tree.
•A final method cannot be redefined in a subclass.
•All methods in final classes are automatically final.
Singleton Classes –
•Classes that are both abstract and final are known as Singleton classes
•Only static components can be used.
•Only 1 instance (“single”) of such a class may be defined
•This instance needs to be defined within the class itself
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
5. ABAP OBJECTS
I h it
Inheritance
Polymorphism (casting)
Interfaces
Events
Gl b l classes
Global l and
d interfaces
i t f
Exception handling
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ABAP Objects
Polymorphism
When you address the superclass, the method has the original implementation, but
when you address the subclass, the method has the new implementation.
Using
U i a single
i l reference
f variable
i bl to
t call
ll identically-named
id ti ll d methods
th d that
th t
behave differently is called polymorphism.
e.g.
g
Polymorphism
Example
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Narrowing Cast
• Getting
g a super
p class variable to refer to a subclass variable is called Narrowing
g
Cast
• E.g. Obj_super = obj_sub.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Widening Cast
Getting
g a sub class variable to refer to a superclass
p variable is called Widening
g Cast
Widening Cast
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
5. ABAP OBJECTS
I h it
Inheritance
Polymorphism (casting)
Interfaces
Events
Gl b l classes
Global l and
d interfaces
i t f
Exception handling
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ABAP Objects
Interfaces
•It is often necessary for similar classes to provide similar functions that are coded
differently in each class but which should provide a uniform point of contact for the
user.
•For example, you might have two similar classes, savings account and check
account, both of which have a method for calculating end of year charges. The
interfaces and names of the methods are the same, but the actual implementation is
different The user of the classes and their instances must also be able to run the
different.
end of year method for all accounts, without having to worry about the actual type of
each individual account.
•ABAP
ABAP Objects
Obj t makesk this
thi possible
ibl bby using
i iinterfaces.
t f IInterfaces
t f are iindependent
d d t
structures that you can implement in a class to extend the scope of that class.
•Interfaces extend the scope of a class by adding their own components to its public
section.
•This allows users to address different classes via a universal point of contact.
Interfaces, along with inheritance, provide one of the pillars of polymorphism,
since they allow a single method within an interface to behave differently in different
classes.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Interfaces - Defining Interfaces
•Like
Lik classes,
l you can d
define
fi iinterfaces
t f either
ith globally
l b ll iin th
the R/3 R
Repository
it or
locally in an ABAP program.
•The definition contains the declaration for all components (attributes, methods,
events) of the interface.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Interfaces - Implementing Interfaces
•Unlike
Unlike classes
classes, interfaces do not have instances
instances. Instead
Instead, interfaces are
implemented by classes.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Interfaces - Interface References
•Instead of creating reference variables with reference to a class, you can also
define them with reference to an interface.
•To
To define an interface reference, use the addition TYPE REF TO <intf>
intf in the
TYPES or DATA statement.
•A reference variable with the type interface reference is called a interface reference
variable,
i bl or iinterface
t f reference
f ffor short.
h t
•An interface reference <iref> allows a user to use the form <iref>-><icomp> to
address all visible interface components
p <icomp>
p of the object
j to which the object
j
reference is pointing.
•It allows the user to access all of the components of the object that were added to
its definition by the implementation of the interface
interface.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Addressing Objects Using Interface References
If the
th class
l <class>
< l > implements
i l t an iinterface
t f <intf>,
<i tf> you can use th
the following
f ll i
assignment between the class reference variable <cref> and an interface reference
<iref> to make the interface reference in <iref> point to the same object as the class
reference in <cref>:
<iref> = <cref>
If the interface <intf> contains an instance attribute <attr> and an instance method
<meth>, you can address the interface components as follows:
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Addressing Objects Using Interface References
As far as the static components of interfaces are concerned, you can only use the
interface name to access constants:
For all other static components of an interface, you can only use object references
or the class <class> that implements the interface:
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Interfaces – Overview Graphics - 1
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Interfaces – Overview Graphics - 2
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Interfaces – Introductory Example – Part 1
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Interfaces – Introductory Example–Part 2
The classes C
C_COUNTER1
COUNTER1 and C
C_COUNTER2
COUNTER2 implement the interface in the public
section.
Both classes must implement the three interface methods in their implementation part.
C_COUNTER1 is a class for counters that can have any starting value and are then
increased by one. C_COUNTER2 is a class for counters that can only be increased in
steps
p of 10. Both classes have an identical outward face. It is fully
y defined by
y the
interface in both cases.
The following sections explain how a user can use an interface reference to address
the objects of both classes:
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Interfaces – Introductory Example–Part 3
First, two class reference variables CREF1 and CREF2 are declared for the classes
C_COUNTER1 and C_COUNTER2. An interface reference IREF is also declared
for the interface I_COUNTER. All of the reference variables are initial.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Interfaces – Introductory Example–Part 4
The CREATE OBJECT statement creates an object for each class to which the
references in CREF1 and CREF2 point.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Interfaces – Introductory Example–Part 5
When the reference of CREF1 is assigned to IREF, the reference in IREF also
points to the object with the internal name C_COUNTER<1>.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
5. ABAP OBJECTS
I h it
Inheritance
Polymorphism (casting)
Interfaces
Events
Gl b l classes
Global l and
d interfaces
i t f
Exception handling
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ABAP Objects Events
An “event”
“ ” is the occurrence off a special condition during the execution off an ABAP
program.
This occurrence must be of sufficient importance for the ABAP program to take a
special action.
The following steps are required in an ABAP program in order to handle events:
•Triggering
Ti i E Events
t
•Handling Events
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Triggering Events
Triggering Events
To trigger an event, a class must
· Declare the event in its declaration part
· Trigger the event in one of its methods
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Declaring Events
EVENTS <evt>
evt EXPORTING... VALUE(
VALUE(<ei>)
ei ) TYPE type [OPTIONAL]..
Instance events always contain the implicit parameter SENDER, which has the
type of a reference to the class or the interface in which the event is declared.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Triggering Events
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Handling Events
Events are handled using special methods. To handle an event, a method must
· be defined as an event handler method for that event
· be registered at runtime for the event.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Declaring Event Handler Methods
Anyy class can contain event handler methods for events from other classes. You
can, of course, also define event handler methods in the same class as the event
itself. To declare an event handler method, use the following statement:
•The interface of an event handler method may only contain formal parameters
defined in the declaration of the event <evt>. The attributes of the parameter are
also adopted by the event.
•The event handler method does not have to use all of the parameters passed in the
RAISE EVENT statement. If you want the implicit parameter SENDER to be used as
well, you must list it in the interface. This parameter allows an instance event handler
to access the trigger, for example, to allow it to return results.
If you declare an event handler method in a class, it means that the instances of the
•If
class or the class itself are, in principle, able to handle an event <evt> triggered in a
method.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Registering Event Handler Methods
To allow an event handler method to react to an event,, you
y must determine at
runtime the trigger to which it is to react. You can do this with the following
statement:
SET HANDLER... <hi>... [FOR]...
It links a list of handler methods with corresponding trigger methods
methods.
For an instance event, you must use the FOR addition to specify the instance for
which you want to register the handler. You can either specify a single instance as
the trigger, using a reference variable <ref>:
SET HANDLER... <hi>...FOR <ref>.
or you can register the handler for all instances that can trigger the event:
SET HANDLER...
HANDLER <hi> <hi>...FOR
FOR ALL INSTANCES
INSTANCES.
The registration then applies even to triggering instances that have not yet been
created when you register the handler.
You cannot use the FOR addition for static events:
SET HANDLER... <hi>...
The registration applies automatically to the whole class, or to all of the classes that
implement the interface containing the static event. In the case of interfaces, the
registration also applies to classes that are not loaded until after the handler has
been registered.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Overview Graphic - Events
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Example – Events
Events Example
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Class Practice - Events
lcl vehicle
lcl_vehicle
Class-data: count
Class-methods: class_constructor,
increment
lcl-car lcl-truck
Class-data: count Class-data: count
Class-methods:
Class methods: class
class_constructor,
constructor Class-methods: class
class_constructor,
constructor
increment increment
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Friends
•A
A class can offer friendship to other classes or interfaces
interfaces.
•Friends have access to all components of a class and can always instantiate a
class.
•A class offering friendship is not automatically a friend of its friends.
•Sub-classes of friends automatically become friends of the class offering friendship
•Advantages:
Advantages:
•Unrestricted access
•Fast access
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Persistent Classes
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Persistent Classes
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Persistent Classes
Persistent Classes
•To use the Persistence Service for objects, the classes of these objects must be
created as persistent classes in the Class Builder.
•The term persistent class does not imply that a class is persistent. (As a template
for objects, every class is persistent).
•Rather, it means that the objects of that class and their state are managed by the
Persistence Service.
•For example, the objects of these classes are instantiated in the ABAP program
with a method of the Persistence Service, which ensures that the initialization is
correct (not with the usual CREATE OBJECT statement).
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
5. ABAP OBJECTS
I h it
Inheritance
Polymorphism (casting)
Interfaces
Events
Gl b l classes
Global l and
d interfaces
i t f
Exception handling
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ABAP Objects
Global Classes - 1
• To Create a Class
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Global Classes - 2
• To Create a Class…
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Global Classes - 3
• To Create a Method.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Global Classes - 4
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Global Classes - 5
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Global Classes - 6
•Public
Public Section
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Global Classes - 7
Public Section
S off the Class,
C which is visible & accessible to all users off the class.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects ALV Grids - 1
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects ALV Grids - 2
Step 1:
S 1
In Screen Painter: Create a screen with a custom control object on it and give
the custom control a name (e.g. CC_ALV)
Step 2:
In Screen logic: Create TYPE REF’s to cl_gui_custom_container and
cl_gui_alv_grid
Step 3:
In PBO of screen: create objects for the above 2 reference variables
IF container IS INITIAL
INITIAL.
CREATE OBJECT container
EXPORTING container_name = ' CC_ALV '.
ELSE .
CALL METHOD grid->refresh_table_display
ENDIF.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects ALV Grids - 3
CREATE O
C OBJECT
C grid
EXPORTING i_parent = container.
Step 4:
In PBO of screen or start-of-selection:
-Create an internal table having structure same as what you want to display
-Populate internal table with data to be displayed
Step 5:
In PBO of screen: Transfer data to the grid
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects ALV Grids – 4
Step 6
S 6:
Before LEAVE PROGRAM: Free the container
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects ALV Grids – 5
*POPULATE ITAB
WA FCAT-FIELDNAME
WA_FCAT FIELDNAME = ‘CTYPE'.
CTYPE .
WA_FCAT-REF_FIELD = 'CUSTTYPE' . “Database field name
WA_FCAT-REF_TABLE = 'SBOOK'. “Database table name
WA_FCAT-COL_POS = 27.
APPEND WA_FCAT
WA FCAT TO ITAB_FCAT.
ITAB FCAT
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects Class Practice – ALV Grids
Using a selection screen, read the value off material type. (MARA-MTART)
( )
Create an ALV on another screen in the same module pool program and display 100
records.
Display only the following fields:
Material number (MARA-MATNR)
Material Group (MARA-MATKL)
Material Description (MAKT-MAKTX)
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Class-Based Exceptions - Overview
The occurrence of an exception
p is normally
y used to display
p y an error situation.
Class-based exceptions can, therefore, be raised and handled in all ABAP contexts
(programs, processing blocks).
If a class-based exception occurs, the system interrupts the normal program flow
and tries to find a suitable handler. If it does not find a handler, a runtime error occurs.
Exceptions that are raised in procedures but are not handled in the procedure
itself are forwarded to the caller.
The handler off an exception must try to correct the error that has occurred, find f an
alternative solution, or (if this is not possible) at least bring the affected context into a
consistent state and then forward the error.
If a call hierarchy does not contain a handler for an exception, the program is ended
with a runtime error.
Class-based
Cl b d exceptions
ti are h
handled
dl d iin th
the ffollowing
ll i control
t l structure:
t t
TRY.
... " TRY block (application coding)
CATCH cx_... cx_... ...
... " CATCH block (exception handler)
CATCH cx_... cx_... ...
... " CATCH block (exception handler)
...
CLEANUP.
... " CLEANUP block (cleanup context)
ENDTRY.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Class-Based Exceptions–Handling Exceptions
Case 1
C 1: An exception occurs and there is no handler defined
f ffor it either in the current
TRY-ENDTRY block or in the caller blocks
⇒Runtime error occurs
Case 2: An exception occurs and there is a handler for it in the same TRY-ENDTRY
block
⇒Program flow is interrupted
⇒Corresponding
C di CATCH bl block
k gets
t executed
t d
⇒CLEANUP is not executed
⇒Program flow continues after the TRY-ENDTRY block
Case 3: An exception occurs, there is no handler for it in the same TRY-ENDTRY block,
but there is a handler for it either in the enclosing TRY-ENDTRY block or the calling
procedure
⇒Program flow is interrupted
⇒CATCH is not executed for the current TRY-ENDTRY block
⇒CLEANUP is executed in the current TRY-ENDTRY block if it exists
⇒CATCH gets executed in the enclosing/calling block
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Class-Based Exceptions – Handling Exceptions
The TRY statement opens a control structure to be ended with ENDTRY, in which
three statement blocks can be listed in a specified order.
2
2. O or more CATCH bl
One blocks
k ffor catching
t hi exceptions.
ti
These exception blocks are initiated with CATCH and ended with a further
CATCH, CLEANUP, or ENDTRY.
3. A CLEANUP block for cleanup work after the exceptions have been caught.
This statement block is initiated by CLEANUP and ended with ENDTRY.
A TRY-ENDTRY structure must not contain more than one CLEANUP
block in precisely this position
position.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Class-Based Exceptions – Try Block
Exceptions cannot be propagated in any processing blocks without a local data area
(event blocks, dialog modules).
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
5. ABAP OBJECTS
I h it
Inheritance
Polymorphism (casting)
Interfaces
Events
Gl b l classes
Global l and
d interfaces
i t f
Exception handling
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ABAP Objects
Class-Based Exceptions – Catch Block
• A TRY-ENDTRY
TRY ENDTRY structure can contain several exception handlers.
handlers The syntax
for introducing an exception handler is:
CATCH cx_... cx_... INTO ref.
• This defines an exception handler for all the specified exception classes and
their subordinate classes.
• With the INTO addition, a reference to the exception object can be placed
into a reference variable. This enables the attributes of the exception object
to be accessed in the handler.
• The reference variable must be suitable for the exception. Its static type must be
the exception class itself or one of its superclasses.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Class-Based Exceptions – CleanUp Block
• If the system
y has not found a handler for an exception,
p , but the exception
p is
handled in an enclosing TRY-ENDTRY structure or is propagated to a caller, the
CLEANUP block is executed before the TRY-ENDTRY structure is exited.
• All the statements that change the control flow, which cause the CLEANUP
block to be exited and would initiate a processing block of the same program
program,
are forbidden.
• This applies to statements such as RETURN, STOP, for example. All the
exceptions that occur within a CLEANUP block must also be handled here.
• It is, however, permissible to leave the overall program (LEAVE PROGRAM) or
call up procedures, programs, and screen sequences if the system returns to
the CLEANUP block.
• The runtime environment always recognizes that a CLEANUP block is being
exited illegally and then reacts with a runtime error.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Class-Based Exceptions – Example
Class based
exceptions Example
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Sub-Classes of CX_ROOT
CX NO CHECK
CX_NO_CHECK CX DYNAMIC CHECK
CX_DYNAMIC_CHECK CX STATIC CHECK
CX_STATIC_CHECK
You CAN handle these You MUST handle these exceptions or pass them
exceptions. along explicitly using the RAISING addition.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Class-Based Exceptions – Propagating Exceptions
• Class-based exceptions
p that occur in p
procedures ((methods,, function modules,,
subroutines) do not necessarily have to be handled here. They can be
propagated to the caller of the procedure. If the caller is a procedure and the call
takes place in a TRY block, the caller can handle the exception or propagate it to
its caller.
caller
Propagating
Exceptions
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Class-Based Exceptions – Exception Texts
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Exception Texts - Example
Exception Texts
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
ABAP Objects
Class Practice
Create a super class and its sub class. Create objects of both classes. Try to assign
the object of the superclass to the object of the subclass
subclass. If successful
successful, write
“Bingo” else handle the exception.
Satyam
Satyam
SAP PMGSAP
SAP
PMG
PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
Extract datasets
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
LIST PROCESSING
Refining Data
.you can read the data to be refined from database tables or from
sequential files or u can create generic report.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
LIST PROCESSING
Internal tables
.
Extract datasets
Internal tables :
If you want the datasets to map the underlying data structures as
closely as possible and if you want to access individual data
directly.
Extract datasets :
An extract is a sequential dataset you can create with a report.Use
e tracts if you
extracts o want
ant to process large amo
amount
nt of data as a whole
hole
several times
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
LIST PROCESSING
.During the report’s run time,the system can create exactly one extract
dataset.
dataset
As for internal tables the size of the extract data set is principally
unlimited,since the system rolls it out if necessary.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
LIST PROCESSING
Syntax
FIELD-GROUPS <fg>.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
LIST PROCESSING
Filli an Extract
Filling E t t with
ith Data
D t
Once you have declared the possible record types as field groups and
defined their structure, you can fill the extract dataset using the following
.statements:
Syntax
g
EXTRACT <fg>.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
LIST PROCESSING
R di
Reading an Extract
E t t
Like internal tables, you can read the data in an extract dataset using a
loop
loop.
syntax
.
LOOP.
…
[AT FIRST | AT <fgi> [WITH <fg j>] | AT LAST.
...
ENDAT.]
...
ENDLOOP.
ENDLOOP
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
LIST PROCESSING
Sorting an Extract
You can sort an extract dataset in much the same way as an internal table
by using the following statement:
.
syntax
SORT [ASCENDING|DESCENDING] [AS TEXT] [STABLE]
BY <f1> [ASCENDING|DESCENDING] [AS TEXT]
...
<fn> [ASCENDING|DESCENDING] [AS TEXT].
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
LIST PROCESSING
When you sort an extract dataset, control levels are defined in it. For
general information about control levels, The control level hierarchy of an
extract dataset corresponds to the sequence of the fields in the HEADER
.
field group. After sorting, you can use the AT statement within a loop to
program statement blocks that the system processes only at a control
break, that is, when the control level changes.
Syntax
AT NEW <f> | AT END OF <f>.
...
ENDAT.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
Extract datasets
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Lists
Lists are the output medium for data from ABAP/4 report programs. Each
program can produce up to 21 lists: one basic list and 20 secondary lists.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
If an ABAP/4 report makes use only of the WRITE, SKIP, and ULINE
output
t t statements
t t t .This
Thi list
li t is
i called
ll d standard
t d d list.
li t
Standard Page
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Page Header
List Width
Page Length
Page Footer
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Page Header
Syntax
TOP-OF-PAGE.
WRITE: ....
Note :
The self-defined
self defined page header appears beneath the standard page header
header.
If you want to suppress the standard page header, use the NO STANDARD
PAGE HEADING option of the REPORT statement.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
REPORT demo_list_page_heading
d li t h di NO STANDARD PAGE HEADING.
HEADING
TOP-OF-PAGE.
START-OF-SELECTION.
DO 5 TIMES.
WRITE / sy-index.
ENDDO.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
List Width
To determine the width of the output list, use the LINE-SIZE option of
the REPORT statement.
Syntax
Note :
•If
If you set <width> to 0,
0 the system uses the width of the
standardlist .
•The system field SY-LINSZ contains the current line width
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Page Length
Syntax
<n> ---->The
>The system reserves <n> lines of the page length for the
page footer.
Note :
•If you set <length> to zero, the system uses the standard page
length .
•The system field SY-LINCT contains the current number of lines per page
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
DO 6 TIMES.
WRITE / sy-index.
ENDDO.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Page Footer
Syntax
END-OF-PAGE.
END OF PAGE
WRITE: ....
This event occurs when the system reaches the lines reserved for the
page footer, or if the RESERVE statement triggers a page break.
Note :
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
TOP OF PAGE
TOP-OF-PAGE.
END-OF-PAGE.
ULINE.
WRITE: /30 'Page', sy-pagno.
START-OF-SELECTION.
DO 6 TIMES.
WRITE / sy-index.
ENDDO.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Lists with Several Pages
If in your report has more number of lines than defined in the LINE-
COUNT option of the REPORT statement, the system automatically
creates
t a new page .
Apart from automatic page breaks, you can use the NEW-PAGE and
RESERVE statements to code page breaks explicitly.
explicitly
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Page Break- Conditional
To execute a page break under the condition that less than a certain
number of lines is left on a page, use the RESERVE statement:
Syntax
This statement triggers a page break if less than <n> free lines are left
on the current list page between the last output and the page footer.
Before starting a new page, the system processes the END-OF-PAGE
event.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
END-OF-PAGE.
ULINE.
START-OF-SELECTION.
DO 4 TIMES.
WRITE / sy-index.
ENDDO.
DO 2 TIMES.
WRITE / sy-index.
ENDDO.
RESERVE 3 LINES.
WRITE: / 'LINE 1',
/ 'LINE 2',
/ 'LINE 3'.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Syntax
NEW-PAGE.
* Ends the current page. All other output appears on a new page.
* The system then increases the SY-PAGNO system field by one.
* Does not trigger the END-OF-PAGE
END OF PAGE event.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
TOP-OF-PAGE.
START-OF-SELECTION.
DO 2 TIMES.
WRITE / 'Loop:'.
DO 3 TIMES.
WRITE / sy-index.
ENDDO.
NEW-PAGE.
ENDDO.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
From within the program, you can scroll through lists vertically and
h i
horizontally.
t ll
Vertical Scrolling
Horizontal Scrolling
g
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
To scroll through a list vertically by the size of the current window use
this statement:
Syntax
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
REPORT demo
demo_list_scroll_1
list scroll 1 NO STANDARD PAGE HEADING LINE
LINE-SIZE
SIZE 40.
TOP-OF-PAGE.
START-OF-SELECTION.
DO 100 TIMES.
WRITE / sy-index.
ENDDO.
DO 3 TIMES.
SCROLL LIST FORWARD.
ENDDO.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Scrolling by Pages
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Syntax
This statement scrolls the current list to the first, to the last, or to the
page numbered <page> .
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Syntax
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Syntax
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
TOP-OF-PAGE.
'SY
SY-SCOLS:
SCOLS:', sy-scols.
sy scols
ULINE.
START OF SELECTION
START-OF-SELECTION.
DO 200 TIMES.
WRITE sy-index.
sy index
ENDDO.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Scrolling by Columns
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Syntax
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
S
Scrolling
lli byb a Certain
C t i Number
N b off Columns
C l
Syntax
This system scrolls the current list to the left or right by <n> columns.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
TOP OF PAGE
TOP-OF-PAGE.
START OF SELECTION.
START-OF-SELECTION.
DO 200 TIMES.
WRITE sy-index.
y
ENDDO.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Syntax
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
BASIC LISTS
Excluding
c ud g Lines
es from
o Horizontal
o o ta Scrolling
Sc o g
Syntax
NEW LINE NO
NEW-LINE NO-SCROLLING.
SCROLLING
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
Extract datasets
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LIST
A list is an interactive list if the user interface allows actions that
trigger events and if the corresponding interactive event keywords
occur in the report.
All lists
li t created
t d during
d i an interactive
i t ti list
li t eventt are secondary
d lists.
li t
Interactive lists enhance the classical type of output list with dialog
functionality,thus coming close to dialog programming. Interactive
lists provide the user with so
so-called
called “interactive
interactive reporting”
reporting facility.
facility
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Interactive Reporting
Secondary List
Interactive List
REPORT
TRANSACTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
E
Events
t for
f Interactive
I t ti Lists
Li t
•AT LINE-SELECTION
•AT
AT PF<nn>
PF
•AT USER-COMMAND
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
All i Li
Allowing Line Selection
S l ti
To allow the user to select a line from the list, define and write a
processing block for the AT LINE
LINE-SELECTION
SELECTION event in your program:
Syntax
AT LINE-SELECTION.
<statements>.
In the predefined interface, Edit --> Choose and F2 are assigned to PICK.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Page
age Headers
eade s for
o Secondary
Seco da y Lists
sts
On secondary lists, the system does not trigger the event TOP-OF-PAGE.
To create page headers for secondary list:
Syntax
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Program which shows At LINE-SELECTION & TOP-OF-PAGE DURING LINE-SELECTION.
REPORT demo_list_interactive_3 .
START-OF-SELECTION.
AT LINE-SELECTION.
CASE sy-lsind.
WHEN 1.
WRITE 'First Secondary List'.
WHEN 22.
WRITE 'Second Secondary List'.
WHEN OTHERS.
WRITE: 'Secondary List, Level:', sy-lsind.
ENDCASE
ENDCASE.
ULINE.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Allowing
o g Function
u ct o Key
ey Selection
Se ect o
Syntax
AT PF<nn>.
<statements>.
t t t
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
START-OF-SELECTION.
AT pf5.
PERFORM out.
t
AT pf6.
PERFORM out.
AT pf7.
PERFORM out.
AT pf8.
pf8
PERFORM out.
FORM out.
WRITE: 'Secondary List by PF-Key
PF Key Selection'
Selection',
/ 'SY-LSIND =', sy-lsind,
/ 'SY-UCOMM =', sy-ucomm.
ENDFORM.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
S tti a St
Setting Status
t
Syntax
Note:
For the Status type of interactive lists, choose List or List in dialog box.
The system then automatically loads function codes predefined for list
processing into the Menu Painter.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Th AT USER-COMMAND
The USER COMMAND Event
E t
Syntax
AT USER-COMMAND.
<statements>.
The event does not occur if the user selects function codes predefined for
system functions or the function code PICK, which always triggers the AT
LINE SELECTION e
LINE-SELECTION event.
ent
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
REPORT demo
demo_list_at_user_command
list at user command NO STANDARD PAGE HEADING
HEADING.
START-OF-SELECTION.
WRITE: 'Basic List',
/ 'SY-LSIND:',
'SY LSIND:' sy
sy-lsind.
lsind
TOP-OF-PAGE.
WRITE 'Top-of-Page'.
ULINE.
ULINE
AT LINE-SELECTION.
SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
PERFORM out.
sy lsind = sy
sy-lsind sy-lsind
lsind - 1.
1
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
I
Important
t t System
S t Fields
Fi ld for
f Secondary
S d Lists
Li t
SY LSIND
SY-LSIND Index of the list created during the current event (basic list
= 0)
SY-LISTI
SY LISTI Index of the list level from which the event was triggered
SY-LILLI Absolute number of the line from which the event was
triggered
gg
SY-LISEL Contents of the line from which the event was triggered
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
M
Messages in
i Lists:
Li t
You must specify the MESSAGE-ID behind the REPORT statement of your
program
program.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
REPORT demo_list_interactive_4
d li t i t ti 4 NO STANDARD PAGE HEADING
HEADING.
START-OF-SELECTION.
AT LINE-SELECTION.
IF sy-lsind = 1.
MESSAGE i888(sabapdocu)
( p ) WITH text-002.
ENDIF.
IF sy-lsind = 2.
MESSAGE e888(sabapdocu) WITH text-003 sy-lsind text-004.
ENDIF.
WRITE: 'Secondary List, SY-LSIND:', sy-lsind.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Defining
e g Titles
t es for
o Interactive
te act e Lists
sts
By default, the system uses the program title as the title of the
output screen of a report. To choose another title for the output
screens, use this statement:
Syntax
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Displaying
sp ay g Lists
sts in Dialog
a og Windows
do s
Syntax
The WINDOW statement takes effect only within the processing block
of an interactive event
event, that is
is, only for secondary lists
lists.
Note:
Dialog windows have no menu bar and no standard toolbar
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
REPORT demo_list_window NO STANDARD PAGE HEADING.
START-OF-SELECTION.
SET PF-STATUS 'BASIC'.
WRITE 'Select line for a demonstration of windows'.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'SELE'.
IF sy-lsind
l i d = 1.
1
SET PF-STATUS 'DIALOG'.
SET TITLEBAR 'WI1'.
WINDOW STARTING AT 5 3 ENDING AT 40 10.
WRITE 'Select line for a second window'.
indo '
ELSEIF sy-lsind = 2.
SET PF-STATUS 'DIALOG' EXCLUDING 'SELE'.
SET TITLEBAR 'WI2'.
WINDOW STARTING AT 45 10 ENDING AT 60 12 12.
WRITE 'Last window'.
ENDIF.
ENDCASE.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Syntax
This statement takes effect after the current list is completed. Before the
system displays the list, it triggers the event that corresponds to the
function code stored in <fc>,independent of the applied user interface.
Note:
Function code PICK triggers an event only if the cursor is located on a list
line .
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Passing
ass g data from
o list
st to report
epo t
F ll i options
Following ti are available:
il bl
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Using
Us gSSY-LISEL
S
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
REPORT demo_list_sy_lisel
demo list sy lisel NO STANDARD PAGE HEADING
HEADING.
SKIP.
WRITE 'List of Quadratic Numbers between One and Hundred'.
SKIP.
WRITE 'List of Cubic Numbers between One and Hundred'.
TOP-OF-PAGE.
WRITE sy-lisel.
sy-lisel
ULINE.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
AT LINE-SELECTION.
LINE-SELECTION
IF sy-lisel(4) = 'List'.
CASE sy-lilli.
sy lilli.
WHEN 4.
DO 100 TIMES.
num = sy-index ** 2.
WRITE: / sy-index, num.
ENDDO.
WHEN 6.
DO 100 TIMES.
num = sy-index ** 3.
WRITE: / sy-index, num.
ENDDO.
ENDDO
ENDCASE.
ENDIF.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
HIDE
The moment you create a list level you can define which information to
pass to the subsequent secondary lists.
READ LINE
Use the statements READ LINE and READ CURRENT LINE to explicitly
read data from the lines of existing list levels.
GET CURSOR
Use the statements GET CURSOR FIELD and GET CURSOR LINE to pass
the output field or output line on which the cursor was positioned during
the interactive event to the processing block.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
The
e HIDE Technique
ec que
You use the HIDE technique while creating a list level to store line-
specific information for later use.
Syntax
HIDE <f>.
As soon as the user selects a line for which you stored HIDE fields
fields, the
system fills the variables in the program with the values stored.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
REPORT Z_HIDE1 .
TABLES : SPFLI, SFLIGHT.
SELECT-OPTIONS
SELECT OPTIONS : CARR FOR SPFLI-CARRID.
SPFLI CARRID.
SELECT * FROM SPFLI WHERE CARRID IN CARR.
WRITE :/ SPFLI-CARRID , SPFLI-CONNID.
HIDE SPFLI-CARRID.
ENDSELECT.
AT LINE-SELECTION.
CASE SY-LSIND.
WHEN '1'.
SELECT * FROM SFLIGHT WHERE CARRID = SPFLI-CARRID.
WRITE :/ SFLIGHT-FLDATE, SFLIGHT-SEATSOCC.
ENDSELECT.
ENDSELECT
ENDCASE.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Value is stored
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
To read a line from a list after an interactive list event occurred,, use the
READ LINE statement:
Syntax
The statement without any options stores the contents of line <lin> from
the list on which the event was triggered (index SY
SY-LILLI)
LILLI) in the SY-LISEL
SY LISEL
system field and fills all HIDE information stored for this line back into the
corresponding fields .
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Reading
ead g Lists
sts at tthe
e Cu
Cursor
so Position
os t o
Syntax
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
f(10) TYPE c, off TYPE i, lin TYPE i, val(40) TYPE c, len TYPE i.
SKIP TO LINE 4.
POSITION 20.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
AT LINE-SELECTION.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
C lli Reports
Calling R t
To call a report from with in other report,use the SUBMIT statement.
To set the name of the called program statically in the programcoding.
programcoding
Syntax :
SUBMIT <rep> [AND RETURN] [<options>].
The first statement starts the report<rep>,the
p p second statement starts the
report whose name is stored in field<rep>.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
IIn this
thi program we r calling
lli a program zsapmztst1
t t1 nextt slide
lid shows
h the
th
zsapmztst1.
REPORT ZSAPMZTST .
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
REPORT ZSAPMZTST1 .
DATA : NUMBER TYPE I,
ITAB TYPE I OCCURS 10.
SET PF-STATUS
PF STATUS 'MYBACK'
MYBACK .
DO 5 TIMES.
NUMBER = SY-INDEX.
APPEND NUMBER TO ITAB.
WRITE : 'NUMBER'.
ENDDO.
TOP-OF-PAGE.
WRITE 'REPORT 2'.
ULINE.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'MYBACK'.
EXPORT ITAB TO MEMORY ID 'HK'.
LEAVE
LEAVE.
ENDCASE.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Called Report
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Exercise 1
Create an interactive list using hide technique based on tables ekko and
ekpo. Output the following field in the basic list.
EKKO-EBELN.
Based on the output of the basic list I.e., EKKO-EBELN, output the
following fields in the secondary list by passing the field EKKO
EKKO-MATNR
MATNR
by HIDE Technique.
EKPO-BUKRS
EKPO-WERKS
EKPO-LGORT
EKPO-MENGE
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Solution
TABLES: EKKO, EKPO.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
TOP-OF-PAGE DURING LINE-SELECTION.
WRITE:/ 'MATERIAL' ,12 'COMPANY',18 'PLANT',28
'STORAGE',38'QUANTITY'.
AT LINE-SELECTION.
LINE SELECTION
* Interactive event, details list
* Read data corresponding to the selection criteria and
* display
SELECT MATNR BUKRS WERKS LGORT MENGE FROM EKPO INTO
CORRESPONDING
FIELDS OF ITAB2 WHERE EBELN = ITAB1 ITAB1-EBELN.
EBELN.
WRITE: / ITAB2-MATNR, * Material Number
12 ITAB2-BUKRS, * Company code
18 ITAB2-WERKS,, * Plant
28 ITAB2-LGORT, * Storage Location
38 ITAB2-MENGE. *Quantity
ENDSELECT.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Exercise NO: 2
Task:
Create a list of all flight connections for each airline carrier.
carrier
Output the following fields:
SPFLI-CARRID
SPFLI CARRID, SPFLI-CONNID
SPFLI CONNID, SPFLI-CITYFROM
SPFLI CITYFROM,
SPFLI-CITYTO, SPFLI-DEPTIME, SPFLI-ARRTIME.
Define a selection screen on which the user can enter selections for the
airline carrier (SPFLI-CARRID) and the connection ID (SPFLI-CONNID).
Read the data from table SPFLI in accordance with this selection.
When the user selects a line
line, the system should display a secondary
showing the flights (table SFLIGHT) available for the flight connection
concerned (see example list). Output the selected line as the header of
the secondary list. Calculate and output the number of vacant seats for
eachh flight.
fli ht Make
M k sure that
th t the
th program can handle
h dl invalid
i lid line
li
selection.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Example list
AA 0017 NEW YORK SAN FRANCISCO 13:30:00 16:31:00
Date Price Seats
max. occupied free
10.29.1995 666.67 USD 660 10 650
11.11.1995 666.67 USD 660 20 640
11.16.1995 666.67 USD 660 38 622
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Solution
REPORT ZABCD00111 .
TABLES: SPFLI, SFLIGHT.
* Report defined selection criteria for airline and for
* connection id
SELECT-OPTIONS: SELCARR FOR SPFLI-CARRID,
SELCONN FOR SPFLI-CONNID.
*AAuxiliary
ili fi
field:
ld number
b off free
f seats
t
DATA: SFREE LIKE SFLIGHT-SEATSMAX.
START-OF-SELECTION.
START OF SELECTION
* Read data corresponding to the selection criteria and
* display
SELECT * FROM SPFLI
WHERE CARRID IN SELCARR AND CONNID IN SELCONN.
WRITE: / SPFLI-CARRID,
SPFLI-CONNID,,
SPFLI-CITYFROM,
SPFLI-CITYTO,
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
SPFLI-DEPTIME,
SPFLI-DEPTIME
SPFLI-ARRTIME.
HIDE: SPFLI-CARRID, SPFLI-CONNID.
ENDSELECT.
END-OF-SELECTION.
CLEAR SPFLI-CARRID.
"initialization
AT LINE-SELECTION.
* Interactive event, details list
CHECK NOT SPFLI-CARRID IS INITIAL.
* Display detail list only if valid line-selection
WRITE SY-LISEL.
WRITE: /5 TEXT-001, 29 TEXT-002, 49 TEXT-003,
/ TEXT-004
TEXT 004 UNDER TEXT TEXT-003,
003 60 TEXT
TEXT-005,
005 70 TEXT
TEXT-006.
006
* D: TEXT-001: Date
* D: TEXT-002: Price
* D: TEXT-003: Seats
* D: TEXT-004: Max
* D: TEXT-005: occupied TEXT-006: free
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
ULINE.
ULINE
SELECT * FROM SFLIGHT WHERE CARRID EQ SPFLI-CARRID
AND CONNID EQ SPFLI-CONNID.
* Read data for details list using the hided key fields,
* list output
WRITE: /5 SFLIGHT-FLDATE,
SFLIGHT-PRICE,
SFLIGHT-CURRENCY.
SFREE = SFLIGHT-SEATSMAX - SFLIGHT-SEATSOCC.
WRITE: SFLIGHT-SEATSMAX,
SFLIGHT-SEATSOCC,
SFREE.
ENDSELECT.
CLEAR SPFLI
SPFLI-CARRID.
CARRID "initialization
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Summary
Extract datasets :
An extract is a sequential dataset you can create with a report.Use
extracts if you want to process large amount of data as a whole several
times
Declaring Extract Records as Field Groups
Filling an Extract with Data
Reading an Extract
Sorting an Extract
Lists
Lists are the output medium for data from ABAP/4 report programs.
Each pprogram
g can produce
p upp to 21 lists: one basic list and 20
secondary lists.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INTERACTIVE LISTS
Structure and the options of a list are
The Standard List
The Self-Defined List
Lists with Several Pages
Interactive List
A list is an interactive list if the user interface allows actions that trigger
events and if the corresponding interactive event keywords occur in the
report.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
Extract datasets
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
INTRODUCTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
SIMPLE REPORT
1. Simple Report
¾ Reuse_alv_list_display
¾ Reuse_alv_fieldcatalog_merge
¾ R
Reuse_alv_events_get
l t t
¾ Reuse_alv_commentary_write
¾ Reuse_alv_grid_display
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
1. Export:
a. I_callback_program : report id
b. I_callback_pf_status_set: routine where a user can set his own pf status
or change
g the functionality
y of the existingg ppf
status.
c. I_callback_user_command : routine where the function codes are
handled.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
2. Tables:
a. t_outtab : internal table with the data to be output
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
B. REUSE_ALV_FIELDCATALOG_MERGE:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
1. Export:
a. I_program_name : report id
b. I_internal_tabname : the internal output table
c. I_inclname : include or the report name where all the dynamic
f
forms are handled.
h dl d
2. Changing
ct_fieldcat yp SLIS_T_FIELDCAT_ALV
: an internal table with the type
which is declared in the type pool SLIS.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
1
1. Import:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
2. Export:
II_list_type:
list type:
0 = simple list
1 = hierarchical-sequential list
2 = simple block list
3 = hi
hierarchical-sequential
hi l ti l block
bl k list
li t
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
T : ‘H’ - header,
Typ h d ‘S’ - selection,
l ti ‘A’ - action
ti
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
HIERARCHICAL REPORTS
A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
1. Export:
a. I_CALLBACK_PROGRAM
b. I_CALLBACK_PF_STATUS_SET
c I_CALLBACK_USER_COMMAND
c. I CALLBACK USER COMMAND
d. IS_LAYOUT
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
e. IT_FIELDCAT
f. IT_EVENTS
i. IS_KEYINFO : This structure contains the header and item table field names
which link the two tables (shared key).
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
Hierarchical reports
p Contd.….
2. Tables
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
BLOCK REPORT
A. REUSE_ALV_BLOCK_LIST_INIT
B REUSE_ALV_BLOCK_LIST_APPEND
B. REUSE ALV BLOCK LIST APPEND
D. REUSE_ALV_BLOCK_HS_LIST_APPEND
C. REUSE_ALV_BLOCK_LIST_DISPLAY
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
A. REUSE_ALV_BLOCK_LIST_INIT
Parameters:
a. I_CALLBACK_PROGRAM
I CALLBACK PROGRAM
b. I_CALLBACK_PF_STATUS_SET
_ _ _
c. I_CALLBACK_USER_COMMAND
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
B. REUSE_ALV_BLOCK_LIST_APPEND
Export :
a. IS_LAYOUT : layout settings for block
b. IT_FIELDCAT : field catalog
c. I_TABNAME : Internal table name of the output data
d. IT_EVENTS : internal table name with all
possible events
Tables :
a T_OUTTAB
a. T OUTTAB : internal table with output data
data.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
I used
Is d tto appendd the
th Hierarchical
Hi hi l Sequential
S ti l blocks.
bl k
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
C. REUSE_ALV_BLOCK_LIST_DISPLAY
This function module display the list with data appended by the above
function.
function
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
Important Attributes:
a. col_pos : position of the column
b fieldname
b. fi ld : i t
internal l fieldname
fi ld
c. tabname : internal table name
d. ref_fieldname : fieldname (dictionary)
e. ref_tabname : table ((dictionary)
y)
f. key(1) : column with key-color
g. icon(1) : icon
h. hotspot(1) : hotspot
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
ii. Symbol(1)
S b l(1) : symbol
b l
j. Checkbox(1) : checkbox
k. just(1) : (R)ight (L)eft (C)ent
l. do_sum(1)
( ) : sum upp
m. no_out(1) : (O)blig. (X)no out
n. outputlen : output length
o. seltext-l : long key word
p seltext_m
p. seltext m : middle key word
q. seltext_s : short key word
r. reptext_ddic : heading(ddic)
s. ddictxt(1) : (S)hort (M)iddle (L)ong
t. datatype : datatype
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
6. LIST PROCESSING TECHNIQUES
• I_CALLBACK_PF_STATUS_SET
Syntax :
FORM set_pf_status USING rt_extab TYPE slis_t_extab
The table RT_EXTAB contains the function codes which are hidden in
the standard interface.
interface
• I_CALLBACK_USER_COMMAND
Syntax :
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
The structure rs_selfield has the details about the current cursor position.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
7. DIALOG PROGRAMMING
S
Screen (b
(basics)
i )
Screen logic,
g , Screen Painter , Menu Painter
Error handling
St loops
Step l
Table Control
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
7. DIALOG PROGRAMMING
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Central Components of an Online Program
Runtime environment
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Transactions
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Structure of the Dialog Programming
Program Name
– Dictionary Structure
– Global data
– PBO modules
– PAI modules
– Subroutines
– Screens
– GUI Status
– Transaction code
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Transactions- Structure
Screen
Attributes
Att ib t Painter
Define screens
Fullscreen
ABAP/4 Dict. fields
Field list
Fl
Flow logic
l i
ABAP/4
Online program Program
Global data
module
d l pooll
PBO modules
PAI modules
Subroutines
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Summary
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Screen Attributes
•Program
P (type
(t M)
•Screen Number : A four-digit number, unique within the ABAP program,
that identifies the screen within the program.
•Screen Type : A normal screen occupies a whole GUI window. Modal
dialog boxes only cover a part of a GUI window. A subscreen is a screen
that y
you can display
p y in a subscreen area on a different screen in the same
ABAP program.
•Next Screen : Specifies the next screen.
•Hold
H ld Data
D t : If th
the user calls
ll th
the screen more than
th once during
d i a terminal
t i l
session, he or she can retain changed data as default values.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Screen Elements
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Screen Elements
Subscreen: Area on the screen in which you can place another screen.
Table Controls: Tabular input/output fields.
Tab
T b Strip
St i Controls:
C t l Areas
A on th
the screen iin which
hi h you can switch
it h between
b t
various pages.
Status Icons: Display elements, indicating the status of the application
program.
Ok_Code Field: Every screen has a twenty-character OK_CODE field (also
known as the function code field), which is not displayed on the screen.
User actions that trigger the PAI event also place the corresponding
function code into this field, from where it is passed to the ABAP
program.
p g You can also use the command field in the standard toolbar to
enter the function code. You must assign a name to the OK_CODE field to
be able to use it for a particular screen.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Screen Fields
Screen fields are fields in the working memory of a screen. Their contents
are passed to identically-named fields in the ABAP program in the PAI
event, and filled from the same identically-named fields in the program in
the PBO event. The screen fields are linked with the input/output fields.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Screen Fields(Attributes)
C t
Cont..
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
7. DIALOG PROGRAMMING
S
Screen (b
(basics)
i )
Screen logic,
g , Screen Painter , Menu Painter
Error handling
St loops
Step l
Table Control
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Screen Flow Logic
Screen flow logic contains the procedural part of a screen. The language
used to program screen flow logic has a similar syntax to ABAP, but is not
part of ABAP itself.It is otherwise referred to as Screen Language.It
contains no explicit data declarations.It serves as a container for
processing
i blocks.
bl k
There are four event blocks, each of which is introduced with the screen
y
keyword PROCESS:
PROCESS BEFORE OUTPUT.
...
PROCESS AFTER INPUT.
INPUT
...
PROCESS ON HELP-REQUEST.
...
PROCESS ON VALUE-REQUEST.
g must contain at least the two statements PROCESS
The screen flow logic
BEFORE OUTPUT and PROCESS AFTER INPUT in the correct order.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Screen Flow Logic
Cont..
Co t
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
displayed.
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.
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.
called
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Screen Flow Logic
Keyword Function
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
conj nction with
ith FIELD
CHAIN Starts a processing chain
ENDCHAIN Ends a processing chain
CALL Calls a subscreen
LOOP Starts processing a screen table
ENDLOOP Stops processing a screen table
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Screen Painter
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Screen Painter
S
Screen P
Painter
i t To
T ABAP/4 Edit
Editor
SCREEN
PAINTER
Screen Screen Field
attributes layout attributes Flow logic
Screen number Text Field Name PROCESS BEFORE OUTPUT.
Short description Fields Data Type MODULE CLEAR.
Screen type Input/Output Length
Follow up screen
Follow-up templates I
Input/Output
t/O t t PROCESS AFTER INPUT
INPUT.
... .... MODULE READ.
ABAP/4
Editor
Global data PBO module PAI module
DATA: NUMBER(10) MODULE CLEAR OUTPUT
OUTPUT. MODULE READ INPUT
INPUT.
TYPE C. CLEAR NUMBER. SELECT ...
. ENDMODULE. .
.
. . .
. . ENDMODULE.
.
.
.
.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Screen Painter
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Screen Painter
Data Transfer within the Screen and Module Pool work Area .
Screen
Screen work area Module pool work area ABAP/4
Painter
TABLES: SAREA.
SAREA-AREA FI Financial accounting
FI PBO AREA AREATEXT
SAREA-AREATEXT
Financial accounting PAI DATA: OK-CODE(4).
OK-CODE
OK CODE
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Sequence of operation
ENTER
Execute module C
Execute module D
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Overview
SET SCREEN
CALL SCREEN
.
.
.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Set Screen / Leave Screen
Screen Screen
Screen attributes Painter Screen attributes Painter
Screen Screen
Painter Painter
PROCESS AFTER INPUT. PROCESS BEFORE OUTPUT.
.
MODULE OK_CODE. .
.
ABAP/4
MODULE OK_CODE INPUT.
. PROCESS AFTER INPUT.
. .
. .
SET SCREEN 201. .
LEAVE SCREEN.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Inserting a Screen as a Screen Sequence
Screen Screen
Screen attributes Painter Screen attributes Painter
Screen Screen
Painter PROCESS BEFORE OUTPUT. Painter
.
PROCESS AFTER INPUT. .
.
MODULE OK_CODE. PROCESS AFTER INPUT.
MODULE OK_CODE.
ABAP/4 ABAP/4
MODULE OK_CODE INPUT. MODULE OK_CODE INPUT.
.
. .
.
. .
CALL SCREEN 201 SET SCREEN 0.
STARTING AT 30 10 LEAVE SCREEN.
.
.
ENDING AT 60 20. .
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Leaving Screen
S t
Syntax:
• LEAVE TO SCREEN <screen number>.
(or)
• SET SCREEN <screen number>.
LEAVE SCREEN.
• LEAVE TO SCREEN 0.
– From called screen
– From main screen
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Menu Painter
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
7. DIALOG PROGRAMMING
S
Screen (b
(basics)
i )
Screen logic,
g , Screen Painter , Menu Painter
Error handling
St loops
Step l
Table Control
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Input Checks
Field
Fi ld fformatt Ch
Check
k :This
Thi format
f t limits
li it the
th kind
ki d off input
i t that
th t is
i valid.
lid
For ex. , a DATS field (Date field) is an 8 char string in YYYYMMDD
format. All char must be numbers . For the given value entered, the
system checks that the day value is valid.
valid
Required Check : In the screen painter you can set a field’s required
Input Attribute . The system requires the user to enter the input
b f
before entering
t i PAI Processing.
P i
Foreign Key Check:The field can have a foreign key relationship with
another table or its domain can specify
p y a fixed value list for the
field.The system checks the user input value can be found in the
related check table or in the fixed-value lists.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Field Format Check
Screen
Painter
Field list
Field name Format
DATE DATE
.
.
.
AMOUNT DEC
Date 31.11.1993
11.13.1996 Date
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Required Field
Screen
Painter
Field list
TEST FIELD X
?
?
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Foreign Key Check
ABAP/4
Dictionary
Field name Check table
.
.
.
FIELD1 P1
.
.
. Check table P1
KEY
A
Screen
Painter
B
Field list C
.
.
Field Foreign key .
FIELD1 X
Check
Field1 C
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Changing Input Values
Use the FIELD..VALUES to check the field values in Screen Flow Logic.
FIELD <screen field> VALUES [<value list>]
Screen
PROCESS AFTER INPUT. Painter
FIELD <screen field>
VALUES (<copy1>, <copy2>, ...).
Copy:
<value>
NOT <value>
BETWEEN <value1> AND <value2>
NOT BETWEEN <value1> AND <value2>
Screen
PROCESS AFTER INPUT. Painter
FIELD SCOUR-COURSE
VALUES ('01', BETWEEN '20' AND '30', 'ABC').
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Input Check in Module Pool
Screen
ABAP/4
PROCESS AFTER INPUT. Painter MODULE <module> INPUT.
FIELD <screen field> .
.
MODULE <module>. .
MESSAGE E ... .
ENDMODULE.
1 1
E M
E...Message
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example
Screen
PROCESS AFTER INPUT. Painter
FIELD SCOUR-COURSE
MODULE CHECK_SCOUR.
ABAP/4
MODULE CHECK_SCOUR INPUT.
IF SY
SY-SUBRC
SUBRC NE 0
0.
MESSAGE E123 WITH 'SCOUR'.
ENDIF.
ENDMODULE
ENDMODULE.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Field Group-Related Checks
Screen
ABAP/4
PROCESS AFTER INPUT. Painter MODULE <module> INPUT.
CHAIN. .
.
FIELD: <screen field1>, .
MESSAGE E ... .
<screen field2>,
. ENDMODULE.
.
.
<screen field n>
n>.
MODULE <module>.
ENDCHAIN.
1 1
1 1
..
.
1 1
E... Message
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example
Screen
PROCESS AFTER INPUT. Painter
CHAIN
CHAIN.
FIELD: SCOUR-AREA, SCOUR-COURSE.
MODULE CHECK_FIELD.
ENDCHAIN.
ABAP/4
MODULE CHECK_SCOUR INPUT.
IF SY
SY-SUBRC
SUBRC NE 0
0.
MESSAGE E123 WITH 'SCOUR’,’COURSE’.
ENDIF.
ENDMODULE
ENDMODULE.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Conditional Check
• ON INPUT
INPUT:
If the field value is different from the initial value.
• ON REQUEST:
This module will be executed if a value has been entered in
the specific field since the screen was displayed.
• AT EXIT-COMMAND:
EXIT COMMAND
At EXIT-COMMAND module will be executed only if the user
invokes a function code with ‘E’ function type.
yp
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
On Input / on Chain Input
Screen
PROCESS AFTER INPUT. Painter
FIELD <screen field>
MODULE <module> ON INPUT.
.
.
.
Screen
PROCESS AFTER INPUT. Painter
C
CHAIN.
FIELD: <screen field 1>,
<screen field 2>,
.
.
.
<screen field n>.
MODULE <module> ON CHAIN-INPUT.
ENDCHAIN.
.
.
.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
On Request / On Chain Request
Screen
PROCESS AFTER INPUT. Painter
FIELD <screen field>
MODULE <module> ON REQUEST.
.
.
.
Screen
PROCESS AFTER INPUT. Painter
CHAIN
CHAIN.
FIELD: <screen field 1>,
<screen field 2>,
.
.
.
<screen field n>.
MODULE <module> ON CHAIN-REQUEST.
ENDCHAIN.
.
.
.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
At Exit Command I
Field ?
Cancel
Screen
PROCESS AFTER INPUT. Painter
MODULE XX.
MODULE TERMINATE
AT EXIT-COMMAND.
.
.
.
ABAP/4
.
.
.
MODULE TERMINATE INPUT.
SET SCREEN ... .
LEAVE SCREEN.
ENDMODULE.
.
.
.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
At Exit Command II
Menu
Painter
F
Function
ti list
li t
Function Type
ABBR E
Field ?
Screen
Painter
Cancel List of modification groups
Field name Fcode Type
ABEND ABBR E
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
7. DIALOG PROGRAMMING
S
Screen (b
(basics)
i )
Screen logic,
g , Screen Painter , Menu Painter
Error handling
St loops
Step l
Table Control
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Error Handling
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Error Handling Overview
Screen
PROCESS AFTER INPUT. Painter
CHAIN
CHAIN.
FIELD: <screen field 1>,
<screen field 2>.
MODULE CHECK.
ENDCHAIN.
ENDCHAIN
ABAP/4
PROGRAM B220MAIN MESSAGE-ID <id>.
.
.
.
MODULE CHECK INPUT.
.
.
.
IF SY-SUBRC ...
MESSAGE <qnnn>
WITH <value 1>..<value 4>.
ENDIF.
.
ENDMODULE.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Dynamic Screen Modification
Display Change
A A
B B
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Dynamic Screen Modification
SCREEN-INPUT
Input field
Highlighted SCREEN-INTENSIFIED
Invisible SCREEN-INVISIBLE
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Dynamic Screen Modification- Program
Screen
PROCESS BEFORE OUTPUT. Painter
.
.
.
MODULE MODIFY_SCREEN.
.
.
.
ABAP/4
MODULE MODIFY_SCREEN OUTPUT.
.
.
.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'GR1'.
SCREEN-INPUT = 1.
ENDIF.
IF SCREEN-NAME = 'TAB-FELD'.
SCREEN-ACTIVE = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SCREEN TABLES
• Table controls and step loops are types of screen tables you
can add to a screen in the Screen Painter.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Table Controls
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
7. DIALOG PROGRAMMING
S
Screen (b
(basics)
i )
Screen logic,
g , Screen Painter , Menu Painter
Error handling
St loops
Step l
Table Control
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Step Loops
• The feature of step loops is that their table rows can span more than one
line on the screen. By contrast, the rows in a table control are always
single lines, but can be very long.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Screen Table Processing
Note :
Atleast, an empty LOOP...ENDLOOP must be there in PAI.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
7. DIALOG PROGRAMMING
S
Screen (b
(basics)
i )
Screen logic,
g , Screen Painter , Menu Painter
Error handling
St loops
Step l
Table Control
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Syntax for table Controls
At PBO.
Loop at <itab> with control <name> cursor <name>-top_line.
Module <mod_name>.
Endloop.
At PAI.
Loop at <itab>.
Endloop.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Syntax for step loops
At PBO.
Loop at <itab> cursor <var>.
Module <mod_name>.
Endloop.
At PAI.
L
Loop att <itab>.
it b
Endloop.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Leaving to transaction
To branch to another transaction and end the current one, use the LEAVE
TO TRANSACTION statement:
Syntax
Once the new transaction starts, the user can not return to the previous
transaction by pressing the Exit icon. Any data the user did not save in
the previous transaction is lost.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Calling a transaction
If you want the user to be able to return to the initial transaction after
processing an interim transaction, use the ABAP/4 statement:
Syntax
y
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Suppressing the transactions initial screen
syntax:
The initial screen is processed but not displayed. while suppressing the
first screen, for all required fields in the initial screen, your program must
pass in data values when calling the transaction.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Passing data with SPA / GPA Parameters
Syntax
SET PARAMETER ID 'RID' FIELD <FIELD NAME1>.
GET PARAMETER ID 'RID' FIELD <FIELD NAME1>.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Ways to produce list from within transaction
·SUBMIT
Use the SUBMIT statement to start a separate report directly from the
transaction.
SUBMIT <prog>.
prog .
SUBMIT <prog> AND RETURN.
SUBMIT <prog> VIA SELECTION-SCREEN
SUBMIT <prog> WITH <prog sele var> = <fld>
SUBMIT <prog> WITH <para> IN <seltab>
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
How List-Mode in Dialog-Mode Works
You can code list-mode logic in PBO or PAI for the current screen.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Leaving the List
The user requests BACK or CANCEL from the basic-list level of the
report.
If the user, exits the list using the BACK or CANCEL icons, you do not
need to program an explicit LEAVE LIST-PROCESSING. When the user
presses one of these,
these the system returns to the screen containing the
LEAVE TO LIST-PROCESSING and re-starts PBO processing screen.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Returning to different screen
When returning to dialog-mode, your program can also re-route the user
to a screen different from the one that started the list. To do this, use the
keywords AND RETURN TO SCREEN when you first branch to list-mode:
syntax
t
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 100.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Programming Field- and Value-Help
You can program help texts and possible values lists using the PROCESS
ON HELP-REQUEST (POH) and PROCESS ON VALUE-REQUEST (POV)
events.
Syntax
PROCESS ON HELP-REQUEST.
FIELD <field> MODULE <module>.
PROCESS ON VALUE-REQUEST.
FIELD <field> MODULE <module> .
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Programming Field- and Value-Help
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Customizing F4 value request
• Matchcode help
• Check tables
• Help views
• Domain values
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Customizing F4 value request
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Customizing F1 Help
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database
INSERT
DB
UPDATE
DELETE
MODIFY
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INSERT
I
Insert
t a new record
d into
i t a database
d t b
Syntax:
INSERT <table>[<workarea>]
Eg:
MOVE ‘BC’
BC TO SPLAN
SPLAN-AREA.
AREA.
MOVE ‘BC200’ TO SPLAN-COURSE
MOVE ….
INSERT SPLAN.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
UPDATE
UPDATE C
U Changes
a ges a record
eco d in tthe
e database
syntax: UPDATE <table>.
UPDATE <TABLE> SET <F1> = <V1>…<FN> = < VN>
WHERE <f1> = <x1> .
Eg:
SELECT SINGLE * FROM SPLAN WHERE AREA = ‘BC’
AND COURSE = ‘BC200’
AND WEEK = ‘23’.
SPLAN-TID1 = ‘007’.
UPDATE SPLAN.
UPDATE SPLAN
SET TID1 = ‘007’
TID2 = ‘003’
WHERE AREA = ‘BC’
BC AND COURSE = ‘BC200’
BC200
AND WEEK = ‘23’.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
DELETE
Eg:
MOVE ‘BC’ TO SPLAN-AREA.
MOVE ‘BC200’ TO SPLAN-COURSE
MOVE ….
DELETE SPLAN.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ARRAY OPERATIONS
g
Eg:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
COMMIT WORK – ROLLBACK WORK
ABAP/4
.
.
.
MODULE UPDATE INPUT. Dialog1 Dialog2 Dialog3
.
.
.
UPDATE <table1>.
IF SY-SUBRC EQ 0.
COMMIT WORK.
UPDATE1 UPDATE2
ELSE.
ROLLBACK WORK.
MESSAGE E ... .
ENDIF. DB-COMMIT DB-COMMIT (Implicit)
UPDATE <table2>.
.
. SAP-COMMIT (Explicit)
.
ENDMODULE.
.
.
.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Programming database updates
To program database
T d t b updates
d t effectively,
ff ti l programmers are mainly
i l
concerned with:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
LUW
• Database LUW
• SAP LUW
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Update Bundling
With Update Bundling you can execute updates at the end of the update
transaction, rather than at every screen change.
You can avoid your updates being committed at each screen change.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Bundling Techniques
With update bundling, you package your updates in special routines that
run only when your program issues a ABAP/4 commit/rollback. To do
this you use:
this,
•PERFORM ON COMMIT
•CALL
CALL FUNCTION IN UPDATE TASK
•CALL FUNCTION IN BACKGROUND TASK
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Updating in the dialog task
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Updating in a background task
Background-task
B k d t k ffunctions
ti are processedd as low-priority
l i it requests,
t but
b t all
ll
requests for the same destination run in a common update transaction.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
N
Now create
t a screen using
i Transaction
T ti SE80
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
W can also
We l create
t a screen using
i Transaction
T ti SE51
Enter a meaningful description for the screen and select the screen
type
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
C c o
Click on tthe
e DICT/PROGRAM
C / OG fields
e ds button
butto oon the
t e app
application
cat o toolbar
too ba to
include the fields on the screen from the dictionary tables or internal
tables or other fields declared in the program
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
Enter the Internal or Table or field name on the Table/Field name and click
on the Get from program
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
In tthe
e PBO
O write
te tthe
e relevant
e e a t code for
o PF-STATUS
S US a
and
d TITLE BAR
This is a GUI status containing buttons and menus for the screen. All
ABAP programs will have a default GUI status.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
Th title
The titl Bar
B off the
th window
i d that
th t you will
ill use to
t display.
di l
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
IIn the
th PAI off the
th flow
fl logic
l i we can use the
th conditional
diti l statement
t t t
AT EXIT-COMMAND as below.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
Code for
o the
t e Field
e d check
c ec in tthe
e PAI module.
odu e
In tthis
s module
odu e we
e can
ca even
e e write
te tthe
e code to Retrieve
et e e tthe
e Data,
ata,
Branching to Different Screen and also use function codes .
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
IIn the
th Process
P on value
l requestt (POV) off the
th flow
fl logic
l i we can use the
th
search help for a particular field
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
In tthe
e Process
ocess o
on value
a ue Help
e p ((POH)
O )oof tthe
e flow
o logic
og c we
e ca
can use tthe
e
additional documentation descriptive text for the data element in the
ABAP/4 Dict.
In the screen painter you place the cursor in the field string of a screen on
the field to be documented and select the menu goto > documentation >
data el. extra
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
N
Now while
hil RRunning
i ttransaction
ti place
l th
the cursor on the
th field
fi ld and
d press F1
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
Now
o Create
C eate a ttransaction
a sact o code for
o you
your d
dialog
a og p
program
og a us
using
g Txn S
SE93
93
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
IIn Screen
S 100 we give
i the
th required
i d input(Employee
i t(E l No)
N ) andd retrieve
ti the
th
Data from the Data Dictionary and display the details on to the screen 200.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
EXAMPLE
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example : Table Control
In tthis
seexample
a p e we
e will c
create
eate a sc
screen
ee aand
d use tthe
e tab
table
e co
control
t o object to
display data. Use SE51 to Create a screen (In our case 300)
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example : Table Control
W will
We ill d
design
i th
the screen with
ith a ttextt object
bj t and
d th
the ttable
bl control
t l object
bj t
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example : Table Control
Enter
te tthe
e Internal
te a o or Table
ab e o
or field
e d name
a eoon tthe
e Table/Field
ab e/ e d name
a eaand
dcclick
c
on the Get from program
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example : Table Control
Us g the
Using t e attribute
att bute butto
button o
of tthe
e tab
table
e co
control
t o you ca
can put vertical
e t ca and
a d
horizontal separators an resizing if required and name the table control
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example : Table Control
Now we have to write code for the data retrieval and populate the internal
table. In the PAI of the screen 100 we are branching it to our table control
screen i.e. 300.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example : Table Control
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example : Table Control
Now using the PBO of the screen 300 flow logic we populate the table
control
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example : Table Control
In our example when the user clicks the LIST Button in the initial screen
screen,
the complete list of employees will be displayed in the second screen.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example : Table Control
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Transactions
Su
Summary
ay
The slides explained the structure of transaction, screen and
menu painter and all the main features associated with dialog
programming.
programming
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
8. DATABASE UPDATES
LUW processing
Unbundled Updates
Local Updates
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database
INSERT
DB
UPDATE
DELETE
MODIFY
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
INSERT
I
Insert
t a new record
d into
i t a database
d t b
Syntax:
INSERT <table>[<workarea>]
Eg:
MOVE ‘BC’
BC TO SPLAN
SPLAN-AREA.
AREA.
MOVE ‘BC200’ TO SPLAN-COURSE
MOVE ….
INSERT SPLAN.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
UPDATE
UPDATE C
U Changes
a ges a record
eco d in tthe
e database
syntax: UPDATE <table>.
UPDATE <TABLE> SET <F1> = <V1>…<FN> = < VN>
WHERE <f1> = <x1> .
Eg:
SELECT SINGLE * FROM SPLAN WHERE AREA = ‘BC’
AND COURSE = ‘BC200’
AND WEEK = ‘23’.
SPLAN-TID1 = ‘007’.
UPDATE SPLAN.
UPDATE SPLAN
SET TID1 = ‘007’
TID2 = ‘003’
WHERE AREA = ‘BC’
BC AND COURSE = ‘BC200’
BC200
AND WEEK = ‘23’.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
DELETE
Eg:
MOVE ‘BC’ TO SPLAN-AREA.
MOVE ‘BC200’ TO SPLAN-COURSE
MOVE ….
DELETE SPLAN.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ARRAY OPERATIONS
g
Eg:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
COMMIT WORK – ROLLBACK WORK
ABAP/4
.
.
.
MODULE UPDATE INPUT. Dialog1 Dialog2 Dialog3
.
.
.
UPDATE <table1>.
IF SY-SUBRC EQ 0.
COMMIT WORK.
UPDATE1 UPDATE2
ELSE.
ROLLBACK WORK.
MESSAGE E ... .
ENDIF. DB-COMMIT DB-COMMIT (Implicit)
UPDATE <table2>.
.
. SAP-COMMIT (Explicit)
.
ENDMODULE.
.
.
.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
8. DATABASE UPDATES
LUW processing
Unbundled Updates
Local Updates
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
LUW
• Database LUW
• SAP LUW
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
PROGRAMMING DATABASE UPDATES
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
TRANSACTIONS IN THE SAP SYSTEM
( Database LUW
( SAP LUW
( ABAP/4 Transaction
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
DATABASE LUW
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
SAP LUW
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
ABAP/4 TRANSACTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
( By inserting an SAP LUW
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
( By running two SAP LUWs in parallel
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
8. DATABASE UPDATES
LUW processing
Unbundled Updates
Local Updates
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
INTRODUCTION TO UPDATE BUNDLING
With Update Bundling you can execute updates at the end of the
update transaction, rather than at every screen change. ABAP/4
provides commands for bundling updates in special update
routines.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
SUMMARY OF BUNDLING TECHNIQUES
With update bundling, you package your updates in special routines that
run only when your program issues a ABAP/4 commit/rollback. To do
this, you use:
( PERFORM ON COMMIT
( CALL FUNCTION IN UPDATE TASK
( CALL FUNCTION IN BACKGROUND TASK
( COMMIT WORK
( ROLL BACK
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
BUNDLED UPDATING IN THE DIALOG TASK
You can bundle updates for dialog-task processing and have them
execute in the last LUW for the transaction. To do this:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
The effect of using PERFORM ON COMMIT, Instead of simple perform, is
that the system delays execution of the form routine until it encounters
the COMMIT WORK statement. You should position the commit WORK at
the end of the statement or wherever user can select the save condition.
You can assign a run priority to each form routine by adding the level
parameter to the PREFORM ON COMMIT statement.
For Ex.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
When this reaches COMMIT WORK statement, the FORM routines will run
in this order.
First : Update_table3.
Second : Update_table1.
Update table1
Third : Update_table2.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
BUNDLED UPDATING IN THE UPDATE TASK
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
The following diagram illustrates the Synchronous Update in Update Task
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
CREATING UPDATE FUNCTION MODULES
To create a function module, you first need to start the Function Builder.
Choose Tools - ABAP Workbench, Function Builder.
Sett this
S thi option
ti f low
for l priority
i it ("V2") functions
f ti th t run in
that i their
th i own
update transactions. These functions can be restarted by the update task
in case of errors.
To display the attributes screen in the Function Builder, choose
Goto - Administration.
DEFINING THE INTERFACE
Function modules that run in the update task have a limited interface:
• Result parameters or exceptions are not allowed since update-
task function modules cannot report on their results.
• You must specify input parameters and tables with reference fields or
reference structures defined in the ABAP Dictionary.
y
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
CALLING UPDATE TASK FUNCTION MODULES:
( COMMIT WORK:
Your program does not wait for the requested functions to finish
processing, which specifies asynchronous processing.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
CALLING UPDATE FUNCTIONS DIRECTLY
You can also put the CALL FUNCTION IN UPDATE TASK into a
subroutine and call the subroutine with:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
a = 1.
PERFORM F ON COMMIT.
a = 2.
PERFORM F ON COMMIT.
a=3 3.
COMMIT WORK.
FORM ff.
CALL FUNCTION 'UPD_FM' IN UPDATE TASK EXPORTING
PAR = A.
ENDFORM.
In this example, the function module UPD_FM is carried out with the value
3 in PAR. The update task executes the function module only once,
despite the two PERFORM ON COMMIT statements. This is because a
given function module, logged with the same parameter values, can
never be executed more than once in the update task.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
TRANSACTION THAT CALL UPDATE TASK FUNCTIONS
If your program calls another program that itself calls an update function
module you should be aware of the following:
module,
When the new program is called, a new SAP LUW begins, and a new
update
d t key
k isi generated.
t d This
Thi key
k isi used d to
t identify
id tif all
ll update-task
d t t k
operations requested during the called program.
When returning from the program, the LUW of the calling program is
restored together with the old update key.
If the called program does not contain its own COMMIT WORK, the
database update requests are not processed, and the update function
modules are not called.
called In the following example,
example F1,
F1 F2,
F2 and F3 are
update function modules:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
Here, F1 and F3 are executed in the update task, because the COMMIT
WORK for the main program triggers their execution. However, since
transaction ZABC contains no COMMIT WORK statement, the function F2
is never executed by the update task.
task
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
BUNDLED UPDATING IN A BACKGROUND TASK
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
This statement requests execution of an update function in an external
system. The destination specifies the remote system. On encountering
this statement, the system writes your request to the log table and then
executes it at the next commit statement.
You can also use this statement without the DESTINATION parameter.In
this case , the function runs in a separate work process, but on the local
host.
host
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
ERROR HANDLING FOR BUNDLED UPDATES
Runtime errors can occur during execution of bundled updates. How are
they handled? In general, COMMIT WORK processing occurs in the
following order:
All dialog-task
di l t k FORM routines
ti l
logged
d with
ith PERFORM ON
COMMIT are executed.
All high-priority (V1) update-task function modules are
executed.
The end of V1-update processing marks the end of the . If you
used COMMIT WORK AND WAIT to trigger gg commit p
processing,g,
control returns to the dialog-task program.
All low-priority (V2)update-task function modules are
triggered.
All background-task function modules are triggered.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
Runtime errors can occur either in the system itself, or because your
program issues an termination message (MESSAGE type ‘A’). Also, the
ROLLBACK WORK statement automatically signals a runtime error. The
y
system handles errors accordingg to where they
y occur:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
In a V1 update-task function module (requested IN UPDATE TASK)
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
In a V2 update-task function module (requested IN UPDATE TASK)
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
In a background-task function module (requested IN BACKGROUND
TASK DESTINATION)
− Background-task
B k d t k updates
d t already
l d executed
t d for
f the
th currentt
DESTINATION are not rolled back.
− All further background-task requests for the same
DESTINATION are thrown away.
− No other previously-executed updates are not rolled back.
− No error message appears on the screen
screen.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
UNBUNDLED UPDATES
You can make database updates in ABAP/4 without these bundling Here
You can place update statements (insert,Modify,DELETE) directly in your
code These are inline updates without using any bundling techniques.
code. techniques
Even if you code No COMMIT WORK statement the database commit at
the next screen change will commit the updates to the database.
This inline update is only suitable for the single screen transactions. With
Multiple screen transactions, if any error occurs in later screens, you
can't roll back the data committed in earlier screens.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
8. DATABASE UPDATES
LUW processing
Unbundled Updates
Local Updates
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
UNBUNDLED UPDATES
You can make database updates in ABAP/4 without these bundling Here
You can place update statements (insert,Modify,DELETE) directly in your
code These are inline updates without using any bundling techniques.
code. techniques
Even if you code No COMMIT WORK statement the database commit at
the next screen change will commit the updates to the database.
This inline update is only suitable for the single screen transactions. With
Multiple screen transactions, if any error occurs in later screens, you
can't roll back the data committed in earlier screens.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
Advantages and Disadvantages:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
8. DATABASE UPDATES
LUW processing
Unbundled Updates
Local Updates
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Database Update Techniques
LOCAL UPDATES
In ABAP/4 You can tell the system to perform updates locally, rather than
in the update task. To do this, use the statement SET UPDATE TASK
LOCAL whenever your program runs in background.
background You can check the
task from your code by querying the SY-BATCH system variable.
IF SY-BATCH NE SPACE.
SET UPDATE TASK LOCAL.
ENDIF.
…
CALL FUNCTION UPDATE_TABLE1
UPDATE TABLE1 IN UPDATE TASK.
TASK
…
CALL FUNCTION UPDATE_TABLE2 IN UPDATE TASK.
…
COMMIT WORK.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
9. ENHANCEMENTS & MODIFICATIONS
E h
Enhancements
t via
i Menu
M exits
it / Screen
S exits
it / FM exits
it
Business Add-Ins
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
ADAPTABILITY OF SAP
R/3
Menu Exit Function Exit Screen Exit Field Exit Keyword Exit
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
There are four different ways of adapting the SAP system to fit your
needs :
z Customizing : Configuration of system parameters via a special user
interface, the possible changes are preplanned and organized.
Customizing is required during implementation of the system.
z Modification : Alteration of SAP Repository objects in the form of
custom changes when SAP changes occuroccur, the customer version and
the new SAP version must be reconciled manually.
z Enhancement concept : Changing of SAP Repository objects by the
customer without modification.
z Custom development : Creation of custom objects within the customer
name range.
g
Modification and Customer development involve high maintenance
and costs. Hence use these only when customer requirements are not
met by customizing or by user exits
exits.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
Advantages of Enhancements
z There
Th are two
t main
i reasons why h you should
h ld use exits
it rather
th than
th
modifying SAP software yourself.
Add-ons attached to exits have the advantage that:
z They do not affect standard SAP source code.
z They do not affect software updates.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
9. ENHANCEMENTS & MODIFICATIONS
E h
Enhancements
t via
i Menu
M exits
it / Screen
S exits
it / FM exits
it
Business Add-Ins
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
z Menu Exits
z Screen Exits
z Function module Exits
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
Locating Applications that Have Exits
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
Searching in the Application Hierarchy
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
MENU EXITS
z Menu exits allow you to attach your own processes to action menu
items. For this, the SAP applications programmer reserves certain
menu entries in the GUI interface.
z The Menu exit entries have function codes that begin with + (Plus sign).
z Once you activate the menu exits, they become visible in the
application. When the menu item is selected, either the functionality
provided by the SAP applications programmer or your own
functionality implemented in the program exit is processed.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
Step-by-step process of creating Menu Exits
z Evoke the Transaction code CMOD or alternatively you can use the
path tools --> ABAP workbench --> utilities --> Enhancements -->
Project Management.
z Specify a Project name in the Enhancement Text box.
z Click on the create icon on the screen. For example let us create an
enhancement project say zuser.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
z In the next screen enter the description of the project.
z Save the changes made so far in the development class.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
Select Enhancement components.
The system lists all customer exits contained in the
enhancements included in your project.
z Place the cursor on the menu exit you want to add your own function
to.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
Choose Edit component.
The system displays technical information about the menu
entry. It also displays two input fields where you can specify a
language and the text you want your menu item to have.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
Enter the name of your menu function (such as test menu) in the field
New text.
z Choose Save text.
Your special menu function will not appear in the pulldown menu of
the corresponding standard
transaction until you activate your enhancement project.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
z After activation the menu(rounded) will be visible on the standard menu
for the transaction S001.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
Screen Exits
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
Step-by-step process of creating Screen Exits
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
z Choose Edit component.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
z Create your subscreen using the Screen Painter.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
z Design your screen to be added to the standard screen and activate the
particular screen and return back to the flow logic .
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
Choose the PAI and PBO to write down the logic.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
z Generate your screen and choose Back (the green arrow) to return to
the Project management transaction.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
z Go to the transaction ME22 to view the customer defined screen exit.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
z Enter the purchase order number and press Enter.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
Go to the menu header --> Details.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
z Purchase
u c ase number
u be is
s visible
s b e on
o the
t e standard
sta da d sc
screen(rounded).
ee ( ou ded)
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
Function module Exits
z Function module exits allow you, as customer, to implement additional
logic in an application function. The SAP applications programmer
defines where in the application function the function module exits are
placed and which data is to be transferred. The programmer also
creates the related function modules with short text, interface, and
documentation and describes the intended functionality of the function
module exit in the SAP documentation.
z You code the function modules, and if needed the screens, text
elements, and your own Includes for the function group.
z After you activate the enhancement project that contains the function
module as component the ABAP/4 code will be processed. Before that,
the program exits have no effect
effect.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
Step-by-step process of creating Functional module Exits.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
z Place the cursor on the function module exit y
you want to use.
z Choose Edit component.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
z Call the function module’s include p
program
g by
y double-clicking
g on it.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
z Confirm that y
you want to create the include p
program
g .
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Enhancements
z Enter y
your function’s source code in the editor.
z Save
Sa e your
o r incl
include
de program and activate
acti ate it.
it
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
9. ENHANCEMENTS & MODIFICATIONS
E h
Enhancements
t via
i Menu
M exits
it / Screen
S exits
it / FM exits
it
Business Add-Ins
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
9. ENHANCEMENTS & MODIFICATIONS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
9. ENHANCEMENTS & MODIFICATIONS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
9. ENHANCEMENTS & MODIFICATIONS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
9. ENHANCEMENTS & MODIFICATIONS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
9. ENHANCEMENTS & MODIFICATIONS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
9. ENHANCEMENTS & MODIFICATIONS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
9. ENHANCEMENTS & MODIFICATIONS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
9. ENHANCEMENTS & MODIFICATIONS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
9. ENHANCEMENTS & MODIFICATIONS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
9. ENHANCEMENTS & MODIFICATIONS
E h
Enhancements
t via
i Menu
M exits
it / Screen
S exits
it / FM exits
it
Business Add-Ins
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Modifications
Registering the Modification in SSCR
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Modifications
How do you benefit from SSCR ( SAP Software Change Registration)?
z Quick error resolution and therefore high availability of modified
systems
All th
the changed
h d objects
bj t are llogged
d by
b SAP.
SAP Based
B d on this
thi information,
i f ti
SAP’ s First Level Customer Service can quickly localize and remove
the causes of problems. This increases the availability of your R/3
system.
system
z Dependable Operation
The necessity to register will likely prevent unintended modifications.
This in turn promises the dependable operation of your R/3 system.
z Simplification of upgrades
Upgrades and release changes become considerably easier because
of fewer modifications.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Modifications
Procedure for a Registered Modification
If you change one of the SAP's Repository objects, the Workbench
Organizer will require a change request, same as if you were creating
your own object.. The object is automatically added to a repair task.
z Once the development is completed, the Programmer releases the task.
The objects and the object locks are transferred from the task to the
change request..
request
z Once the project is completed, you release the change request. This will
remove the object locks of the change request.
z Change request may be transportable or local. The WBO will
automatically classify the change request depending upon the
development
p class. Only
y transportable
p change
g request
q will be
transferred to the transport system after their release.
z Immediately after the export a test import will check if all objects
can be imported into the target system
system.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Modifications
z Repository objects are exported to the central transport directory.
z The result of export and test import are recorded in the transport
log of the change request to be verified by the programmer.
z The
Th import
i t into
i t the
th target
t t system
t is
i nott automatic,
t ti rather
th it is
i initiated
i iti t d
by the system administrator of the transport control program tp at the
operating system level.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Modifications
Modification Adjustment at Release Change
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Modifications
old
ZABAP Release
Full version
request
Backward Delta
old Release
ZABAP q
request
z The versions of a Repository object are the basis for the modification
adjustment .To support this adjustments,information on whether the
version was created by SAP or by the customer is also stored
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Modifications
Objects of the Modification Adjustment
z Dictionary objects
z Tables, Data Elements, Domains, Matchcodes, Views
z ABAP/4 Programs
z Reports, Module Pools, Function groups
z Screens
z Menus
z Enterprise Data Models
The object listed above are managed by version ,therefore they are
included in the modification adjustment.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Modifications
Modification Adjustment
zThe modification adjustment for Dictionary objects is done during the
release change. Other Repository objects are adjusted after the release
change.
z A Dictionary adjustment after the release change would result in the
loss of new custom fields.
z The Dictionary adjustment is done with transaction SPDD, the
adjustment of the remaining Repository objects with transaction SPAU.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Modifications
Rules for Modifications
z Use the following rules when modifying or adjusting:
z Try to concentrate the changes in one place ( possibly by using
I l d within
Includes ithi the
th customer
t name range).)
z The workbench Organizer does not allow modifications by DDIC
and SAP*.
z Release open repairs and open requests containing repair objects
prior to the release change. Such repairs and requests will be
pointed out to your during the upgrade.
z Never create custom programs within the SAP name range. You will
find the customer name range in the SAP Style Guide.
z Avoid modification adjustments by avoiding modifications.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Modifications
Avoiding
g the Adjustments
j
z Try to avoid changing SAP objects to prevent the necessity for
modification adjustments.
z By using program enhancements and appends for SAP tables you
can enhance SAP object without having these changes
overwritten by SAP during an upgrade.
z To avoid manual patches ,SAP offers online correction services in
release 3.0 which allow automatic implementation and
deimplementation of hot packages and patches
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Summary
Summary
z There are four ways of modifying the standard system.
z Customizing
z Modifications
z Enhancement Concepts
z Custom Development
z The advantages of enhancements are
z They do not affect standard SAP source code
z They do not affect software updates
z Enhancements can be achieved by Exits.
Exits
z There are three types of Exits.
z Menu Exits
z Screen Exits
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Summary
z Function Module Exits
z Registering the Modifications in SAP Software Change
Registration (SSCR).
z Procedure
P d for
f a Registered
R i t d Modification.
M difi ti
z Rules for modifications or adjusting.
z Avoid the adjustment using the program enhancements for SAP tables.
tables
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Exercise
Exercise
Create a menu exit SDW00003 in the area menu ‘TEST’ and add an user-
defined report for that menu exit.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Exercise
Solution
Follow the steps mention in the step-by-step process of creating the
menu exits.
For the
F th menu exits
it SDW00003,
SDW00003 T Transaction
ti code
d +DW3
DW3 isi predefined.
d fi d
Now go to transaction SE80 and select the user-defined report say for
example : ZTEST56.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Exercise
For the particular report create the transaction as shown in the picture.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Exercise
Mention the transaction code that is predefined by the menu exit and
mention the short text, highlight the Program and selection screen
radiobutton and press enter.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Exercise
Assign report ZTEST55 to the transaction +DW3 and save it.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Exercise
Go to the transaction S001 and go the menu TEST, there you can find
USER DEFINED REPORTS menu item. Click the menu item and it will take
you to the output of the report.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Exercise
Output for the report ZTEST56 executed through the transaction +DW3.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
10. ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS
BAPI Creation
List of Macros
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
10. ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
10. ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS
BAPI Creation
List of Macros
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
10. ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
10. ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS
BAPI Creation
List of Macros
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
10. ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
10. ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS
St t
Structure off Business
B i Obj
Objects
t
BAPI Creation
T h i l St
Technical Steps ffor BAPI Creation
C ti
List of Macros
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
10. ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
10. ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS
BAPI Creation
List of Macros
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
10. ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
10. ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS
BAPI Creation
List of Macros
Microsoft Word
Document
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
10. ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS
BAPI Creation
List of Macros
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Objectives
D i i Smart
Designing S t Forms
F
Writing
g Programs
g for Smart Forms
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms
•Structure of a form
•Windows
•Architecture
•Forms
•Nodes
•Form Painter
•Table Painter
•PC Editor
•Style
Style Builder
•Driver Program
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms
• SAP Smart Forms is introduced in SAP Basis Release 4.6C as the tool for
creating and maintaining forms for mass printing in SAP Systems.
• SAP S Smartt F
Forms allow
ll you tto execute
t simple
i l modifications
difi ti tto th
the fform and
d iin
the form logic by using simple graphical tools.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Advantages
g advantages:
SAP Smart Forms offers the following g
• The adaptation of forms is supported to a large extent by graphic tools for layout and
logic, so that no programming knowledge is necessary (at least 90% of all adjustments).
Therefore, power user forms can also make configurations for your business processes
with data from an SAP system.
• Data interface in XML format (XML for Smart Forms, in short XSF)
• Interactive Web forms with input fields, pushbuttons, radio buttons, etc. (Basis-Release
6.10)
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Structure of a Form
A form consists of:
•pages
•output areas – called “windows”
•Addresses
•graphics
graphics (such as company logo)
•data or text contents.
Within an output
p area, yyou can use static or dynamic
y tables to display
p y data or texts
in lines, columns, or cells.
To further structure and format text and data, use paragraphs with the paragraph
and character formats
formats.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Pages of a form
On the pages of a form you determine the page layout and the sequence of pages
with different structures
structures.
Print pages are those pages that are eventually printed. The page layout includes
the page format (for example,
example DIN A4
A4, Letter
Letter, DIN A5 landscape) and the position of
the windows on a page.
For each draft page, you must specify a next page to make the page sequence
clear.
You can also repeatedly call the same draft page if you want recursive output.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Pages of a form
Many forms contain only two pages of different structure, for example one for the letter and
one for listing the invoice items. For such a form you need two draft pages; the second page,
which is defined as next page of the first one
one, calls itself as next page
page. If the text does not
entirely fit onto the second print page, another print page with identical structure is started
automatically.
For draft page 22, the page break is triggered either automatically by the main window or built
into the form logic.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Windows
On a page, there
O th are two
t different
diff t types
t off output
t t areas for
f texts
t t and
d data:
d t the
th
main window and the secondary window.
You can position the same window (determined by the technical name on several
pages of a form, so that the same contents are displayed on all these pages.
You can choose a different size for the window on each page, except for the main
window.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Main Window
In a main window you display text and data, which can cover several pages (flow
text). As soon as a main window is completely filled with text and data, the system
continues displaying the text in the main window of the next page. It automatically
triggers the page break.
Th main
The i window
i d mustt have
h the
th same width
idth on each
h page, but
b t can differ
diff iin h
height.
i ht
A page without main window must not call itself as next page, since this would
gg an endless loop.
trigger p In such a case,, the system
y automatically
y terminates after
three pages.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Secondary Windows
In a secondary window you display text and data in a predetermined output area.
There is no flow text display with page break. If you position a secondary window
with
ith th
the same name on severall pages, ththe system
t di
displays
l th
the contents
t t off this
thi
secondary window on each page.
Text and data that do not fit into the secondaryy window are truncated and not
displayed.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Architecture
The architecture of SAP Smart Forms separates application data retrieval from
the actual definition of the form
When you activate the Smart Form, the system generates a function module
that encapsulates all attributes of the Smart Form. As soon as the application
program calls the function module, the Smart Form uses the module's interface
(which corresponds to the form interface) to transfer any table data previously
selected
l t d andd tto print
i t th
the fform according
di tto the
th fform d
description.
i ti Thi
This iis also
l
referred to as 'calling a Smart Form for printing'.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Creating and Printing Forms
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Describing a Form
1. Describe the interface of the form. It results from the application data
previously selected.
2 Create one or more pages
2. pages. On a page
page, you can position windows
windows, addresses
addresses,
and graphics. Within a window, you can create additional elements.
3. Create elements (text, graphics, tables, and so on) for each page, using other
tools of the Form Builder:
* Use the Form Painter to position windows, graphics, and addresses on a
page (the other elements are displayed in an assigned window).
* Use the PC Editor to write your texts.
* Use the Table Painter to format your tables
tables.
4.Use the flow control to control whether and when to print pages and elements
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Form Attributes
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Form Interface
We define the form interface to pass the data to the form. In the form interface
we can define import and export parameters, tables and exceptions.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Global Definitions
Global definition apply for the entire form
form. We can use any object defined there
in all nodes of the tree.
We can initialize the global data before we start processing the start page.
Withi the
Within th form
f routines
ti we cannott access any global
l b l data
d t unless
l we explicitly
li itl
pass them to the form routine interface.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Global Definitions
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Form logic
IIn the
th Form
F Builder
B ild you describe
d ib a Smart
S t Form
F by
b a sett off nodes.
d To
T do
d this,
thi
you build up a tree structure on the left side of the user interface
The numbering of the nodes also shows the sequence in which they are
processed (from top to bottom). The first node is the root node.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Nodes in Smart Forms
•Page
P
•Window
•Text
•Graphic
p
•Template
•Table
•Command
•Loop
•Alternative
•Folder
•Complex Section
•Program Lines
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Node Types - 1
O t t Areas
Output A
Node type Description Possible direct
successors
Page A page of the form. Direct successors of this node can Window, graphic,
be placed directly on the page. address
Window Output area on a page. There are main windows and All except window and
subwindows. page nodes
Graphic You use this node to position graphics in the form. To include background graphics, use
node type Page .
Address You use this node to include an address. The system reads the address data directly from
the database tables and formats them for print output
output.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Node Types - 2
Table
ab e output
Icon Node Type Description Possible Directly
Inferior Nodes
Template You use this node to print a table with All except window,
fixed layout page, table, and
template nodes
Table You use this node to print a table with Directly inferior nodes
dynamic layout are automatically the
three nodes Header ,
Main Area and
Footer . As their
directly inferior nodes
nodes,
loop nodes, folder
nodes, or table nodes
are allowed.
Table line You use this node to print a table line in Table cell
a table or template
Table cell You use this node to print a table cell of As with the template
a table line according to the line type node
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Node Types - 3
Flow Control
Node type Description Possible direct successors
Loop Processes successor node repeatedly. All except window and page nodes
Alternative Branches depending on condition. Direct successors are automatically the nodes TRUE and
FALSE. The direct successors of these are all nodes except
window and page nodes.
Other Nodes
N d ttype
Node D
Description
i ti P ibl direct
Possible di t successors
Folder Combines successor nodes to All except window and page nodes
logical groups
Complex section Combines all attributes of the node All except window and page nodes
types template, table, loop, folder
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Tools in Smart Forms
•Form
F Painter
P i t
•Table Painter
•PC Editor
•Navigation Tree
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Form Painter
•Used
U d to
t design
d i theth layout
l t off the
th Smart
S t Form
F
•Used to create and change the size of the windows
•Add graphical images
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Table Painter
•Drawing
D i rows and
d columns
l
•Deleting cells
•Splitting cells
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Table Painter
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms PC Editor
•Enter
Enter, delete,
delete select
select, cut
cut, and copy texts
•Assign paragraph and character formats
•Include, change, and delete fields
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Inserting Addresses
In many applications,
applications addresses are administered using the Business Address
Services (BAS).
The addresses are stored in the database tables of the central address
administration and identified by the application via a number.
Procedure
1.Create a node of type Address in the navigation tree of the Form Builder.
2.Create the address node as directly inferior node of the page node or use the
context menu in the layout of the Form Painter. You can then position the
address anywhere on the page.
3.Enter a unique name for the node and a description
4D t
4.Determine
i ththe address
dd ttype on th
the General
G l Att ib t tab.
Attributes t b
For organization addresses you must specify only an address number. For any
other address types,
yp , you
y must specify
p yap person number and an address
number. To do this, use the search help.
In the box Additional Address Specifications you can maintain other attributes to
specify how you want to display the address.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Inserting Addresses - Illustration
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Including Fields in the PC Editor
You include
Y i l d fifields
ld ((your own fifields
ld and
d system
t fifields)
ld ) tto di
display
l variable
i bl ddata
t iin th
the
form. The field serves as placeholder. When the system displays the form, it replaces
the field with the value that was assigned to it during processing.
Prerequisites
If you use your own fields, you must have defined them either as global data or as
parameters in the form interface.
The text node into which you want to include a field must exist
exist.
Process:
1.Include field ( ) to include a defined field into the text
2.A dialog window appears. Enter the field name in a line. Make sure that the field
name is enclosed in ampersands ('&').
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms System Fields
Description
Field Name
&SFSY-DATE& Displays the date. You determine the display format in the user master record.
&SFSY-TIME& Displays the time of day in the form HH:MM:SS.
&SFSY-PAGE& Inserts the number of the current print page into the text. You determine the format of the page
number (for example
example, Arabic
Arabic, numeric) in the page node
node.
&SFSY-FORMPAGES& Displays the total number of pages for the currently processed form. This allows you to include
texts such as ‘Page x of y’ into your output.
&SFSY-JOBPAGES& Contains the total page number of all forms in the currently processed print request.
&SFSY-WINDOWNAME& Contains the name of the current window (string in the Window field)
&SFSY-PAGENAME& Contains the name of the current page (string in the Page field)
&SFSY-XSF& Smart Forms sets this flag ( SFSY-XSF = 'X' ), if you want to print the form in XSF format
or HTML format
format. On the Conditions tab of a node,
node you can use this field to suppress
output that is intended only for these output formats (for example, pushbuttons).
&SFSY-COPYCOUNT& Queries whether the original is printed or which number the copy has. COPYCOUNT = 1 :
orginal, COPYCOUNT = 2 : first copy; COPYCOUNT = 3: second copy, and so on.
&SFSY-COPYCOUNT0& Queries whether the original is printed or which number the copy has. COPYCOUNT = 0 :
orginal, COPYCOUNT = 1 : first copy; COPYCOUNT = 2 : second copy, and so on.
SFSY-SUBRC Return value that you can query in program lines nodes. This enables you to react dynamically
to error situations during output. Up to now, this field can be used only for include texts and text
modules:
•SFSY-SUBRC = 0 :Text T t module
d l or include
i l d text
t t found
f d and
d printed
i t d
•SFSY-SUBRC = 4 :Text module or include text not found
SFSY-USERNAME Logon name of the user who prints the form.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Tabular Data Layout
You can use the following node types for tabular data layout:
•The template node. Templates are static because the number of columns and lines
are determined before the actual output.
•The table node. Tables are dynamic because the table size depends on the amount
of data selected at runtime.
Line Types:
You use the line type to describe the following attributes of a table line:
•The width of the table line
•The number and width of individual cells within the table line
A major difference between line types of templates and line types of tables lies in
the height:
•line types of templates all have the same height,
•while SAP Smart Forms determines the height of table lines dynamically
(depending on the output in the table).
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Style Builder
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Style Builder
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Driver Program
REPORT ZSALES_PRINT
ZSALES PRINT NO STANDARD PAGE HEADING.
HEADING
DATA FLAG(1).
DATA: FORM_NAME(30)
( ) VALUE 'ZSALES_PRINT'.
DATA: FM_NAME TYPE RS38L_FNAM.
START-OF-SELECTION.
SELECT SINGLE * FROM VBAK WHERE VBELN = VBELN
AND KUNNR = KUNNR.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Driver Program
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms
SF_EXAMPLE_01
Simple example; invoice with table output of flight booking for one
customer
SF_EXAMPLE_02
Similar to SF_EXAMPLE_01 but with subtotals
SF_EXAMPLE_03
SF EXAMPLE 03
Similar to SF_EXAMPLE_02, whereby several customers are selected
in the application program; the form is called for each customer and
a
all
form outputs are included in an output request
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Frequently Asked questions
Create a loop around the table. Put a Command node before the table in the loop that forces a
NEWPAGE on whatever condition you want.
Then only loop through a subset of the internal table (based on the conditions in the Command
node) of the elements in the Table node.
Line in Smartform
Either
t e you ca
can use a window
do tthat
at ta
takes
es up tthe
e width
dt oof you
your page a
and
doonly
y hasas a height
eg to of 1
mm. Then you put a frame around it (in window output options).
Thus you have drawn a box but it looks like a line.
Or you can just draw "__" across the page and play with the fonts so that it joins each
UNDER_SCORE.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Smart Forms Frequently Asked questions
Form Interface is where you declare what must be passed in and out of the smartform (in
from the print program to the smartform and out
from the smartform to the print program).
Global definitions is where you declare data to be used within the smartform on a global
scope ie: anything you declare here can be used in any other node in the form
form.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Sap Script
SAP Script
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Sap Script
INTRODUCTION
Note:
Entering and formatting text in SAP script is a little bit different than
traditional text-processing
p g programs
p g on a PC.
The main difference: the text that you enter is not in its final format.
SAP script applies your formatting to text only when a document
is printed, print-previewed, or displayed on-line in the SAP System
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Sap Script
How does a SAP Script work ?
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Sap Script
1. Standard Text
This is like a normal document.You can create letters , articles bascially
y
any static text.
This can be created from transaction SO10.
2. Layout Set
This also called as Form created from Transaction SE71.
3 P
3. Print
i t Program
P
This program retrieves desired data from the database , calls the Form,
supplies data to the Form and finally closes the Layout Set ( Form ).
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Sap Script
Supplies
S li
data
Driver Program Layout set Gets printed
Defines
Forms
Sap
Script
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Sap Script
Name WINDOW
House name
Postal Code
City
Name
House name
Postal Code
City Page window
Particular area in the
page where the window
is printed out
o t
Page
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Standard Text
Transaction SO10
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Standard Text
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Standard Text
If you want text in your standard text to appear as per attributes of
character string , you need to enclose the text <character string>TEXT</>.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Layout Set
• Header
• Pages
• Page
g Windows
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Header
Header data is found both in style and layout set maintenance. In style
maintenance, it is used primarily to present information designed to make
it easier for the end user to select a style.
The header
Th h d data
d t in
i layout
l t sett maintenance,
i t on the
th other
th hand,
h d is
i used
d for
f
information and control purposes.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Header
• Standard
• Font
• Tabs
• Outline
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Paragraph
Paragraph Format
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Character Format
Character formats
• Allow y
you to format entire blocks of text within a p
paragraph
g p
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Windows and Text Elements
WINDOWS
• To refer a window via program each window must have a unique name
• We
W can assigni text
t t to
t each
h windows
i d via
i text
t t elements
l t
TEXT ELEMENTS
Text elements can be defined in layout set maintenance for each window.
The text elements are accessed by name by a print program, formatted,
and output in the respective window. The /E in the tag column is used to
identify the text as a text element
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Windows
Windows
Wi d are defined
d fi d in
i layout
l t sett maintenance.
i t They
Th representt areas
which are positioned on pages -- as page windows -- and in which text
is later output. At least one window must be defined for each layout set.
If not
not, a text cannot be formatted by SAP Script.
Script
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Windows
WINDOWS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Windows
MAIN
Main window in which continuous text is output. The text in the main
window can extend over several pages. If the text fills one page, output
continues in the window of the next and subsequent pages, as long as
MAIN has been defined for these pages.
VAR
Window with variable contents. The text can vary on each page in
which the window is positioned. Variable windows are formatted for
each page.
CONST
Window with constant contents which is only formatted once.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Pages
Att least
east o
one
e page must
ust be de
defined
ed for
o eevery
e y layout
ayout set
set. You
ou must
ust a
also
so
designate a "first" page in the layout set header. Otherwise text
formatting is not possible.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Pages
PAGES
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Page Windows
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP
SapScript
Script: Page Windows
PAGE WINDOWS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Sap Script
COMPONENTS OF SCRIPT
• Text Elements
• Style
• Layout set
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Text Elements
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Text Elements
• To out put named text elements we have to call the function module
WRITE_FORM
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Style
A sty
style
e de
defines
es tthe
e set o
of pa
paragraph
ag ap aand
dccharacter
a acte formats
o ats tthat
at a
are
e
available for formatting a document.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Layout Set
• Layout sets are used to control the page layout and also the text
formatting in your documents.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Layout Set
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Symbols
SYMBOLS
Symbols are constants that can be inserted in a document. They save the
user unnecessary workk when
h replacing
l i sections
ti off text,
t t phrases,
h etc.
t
Possible symbol types are:
• System
y symbols
y
• Standard symbols
• Program symbols
• Text symbols.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Symbols
• The delimiter & must be used both immediately before and after the
symbol.
symbol
• A SAP Script editor line break should not occur between the symbol
delimiters.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Symbols
SYSTEM
S S SYMBOLS
S O S
STANDARD SYMBOLS
• Standard
St d d symbols
b l are defined
d fi d in
i the
th TTDTG table.
t bl
• This table contains both the name of each symbol and its value.
• The value, which is language-dependent, can contain up to 60 chars.
• This table is delivered complete with standard entries supplied by SAP
SAP.
• It may be extended with customer-specific symbols
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Symbols
PROGRAM SYMBOL
SAP Script cannot read this data out of the SAP database itself, but has to
call
ll on another
th program tto ddo thi
this. The
Th data
d t are then
th copied i d into
i t workk
areas declared using TABLES. If SAP Script is now called from this
program in order to format a text, it can copy the data out of these work
areas.
areas
Symbols which obtain their values from this kind of data area are called
program symbols.
Note
• The value of a p
program
g symbol
y is limited up
p to a maximum of 255 chars.
• The name of a program symbol consists of the table name and the field
name separated by a hyphen.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
SAP Script : Symbols
TEXT S
SYMBOLS
O S
for ee.g
g
/: DEFINE &mysymbol& = ‘XXXX’
/ &mysymbol&
/: DEFINE &mysymbol& = ‘YYYY’
YYYY
/ &mysymbol&
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Control Commands
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Control Commands
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Control Commands
/: NEW-PAGE
/ RESET paragraph_format
/: h f t
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Control Commands
/: TOP
:
/: ENDTOP
/: BOTTOM
:
/: ENDBOTTOM
/: IF condition
:
/: ENDIF
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Control Commands
SET DATE MASK command
The formatting for date fields can be defined with the SAPscript SET
DATE MASK command. Executing this command causes all
subsequent date fields to be output using the specified formatting.
formatting
Syntax
/: SET DATE MASK = 'date
date_mask
mask'
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Control Commands
SET TIME MASK command
You can use the SAPscript SET TIME MASK command to format time
fields in a way that differs from the standard setting. Executing this
command causes all subsequent time fields to be output using the
specified formatting.
Syntax:
/: SET TIME MASK = 'time_mask'
The following
g templates
p may y be used in the time mask:
HH hours (two digits)
MM minutes (two digits)
SS seconds (two digits)
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Control Commands
BOXES LINES,
BOXES, LINES SHADING: BOX,
BOX POSITION,
POSITION SIZE
The BOX, POSITION and SIZE commands for drawing boxes, lines and
shadowing can be used for specifying that within a layout set particular
windows or passages of text within a window are to be output in a frame
or with shadowing.
Syntax
1. /: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]
2. /: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]
3. /: SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE]
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Control Commands
ADDRESS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Control Commands
BOTTOM /ENDBOTTOM
/:BOTTOM
The text
te t lines bet
between
een the ttwo
o commands are o
output
tp t at the bottom of
MAIN window
/:ENDBOTTOM
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Incorporating Graphics
3 S
3. System
t generates
t a suggested
t d name for
f the
th text
t t
e.g ZHEX-MACRO-LOGO Use ID “ST” and logon language.
4 Include ZHEX-MACRO-LOGO
4. ZHEX MACRO LOGO object Text ID ST in the Layout
Layout.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example of Print Program
Calling an Script from a program created in SE38
REPORT ZSCRIPT .
TABLES: SPFLI.
DATA: I_SPFLI
I SPFLI LIKE SPFLI OCCURS 0 WITH HEADER LINE
LINE.
SELECT * FROM SPFLI INTO CORRESPONDING FIELDS OF TABLE
I_SPFLI.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example of Print Program
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ADDRESS_LIST'
* FUNCTION = 'SET'
TYPE = 'BODY'
BODY
WINDOW = 'WINDOW1'.
LOOP AT I_SPFLI.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'LINE_ITEM'
* FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
'MAIN'.
ENDLOOP.
CALL FUNCTION 'CLOSE_FORM'.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example of Print Program
Pages
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example
Windows
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example
Page Windows
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example
Output
p Length
g
&symbol(3)& ----> 123
&symbol(7)& ----> 1234567
Time Mask
&Time&
Normally 10:08:12
(hh) : (mm): (ss)
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Example
Date Mask
//: Set Date
ate Mask
as = ‘DDMMYY’
&Date& = 01 05 01
/: Set Date Mask = ‘MMMM DD,YYYY’
&Date& = May 01,2001
Fill Character
Leading spaces in a value can be replaced with a fill character.
The ‘F’ option
p is used and character to be filled is specified.
p
E.g &KNA1-UMSAT& = 700.00
&KNA1-UMSAT(F*)& = **700.00
Space Compression
&symbol(C)&
It has a effect of replacing each string of space characters with a single space and
shifting the words to left as necessary to close up gaps.
Also Leading spaces are completely removed.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WfMC
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Definition of Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Wh is
When i Workflow
W kfl needed
d d?
It is particularly beneficial
• when different people are involved in different parts of
the process
• when the users need to be reminded of what they need to
do
• when the duration of the process is critical and deadlines
have to be met
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
H ddoes it workk ?
How
• When the workflow runs it creates work items which are like
e mails but
e-mails,
o they have the advantage that they contain the intelligence needed to
execute the relevant task with the correct data when the operational
user executes them,
o they provide their own functionality so that the operational user has
access to everything that is useful to improve the flow of the
process,
o they disappear on their own when they have been executed by
someone else or made obsolete.
• These work items can be received in the R/3 business
workplace, MS Outlook (or any other MAPI compatible
client), Lotus Notes, or work item notifications can be
distributed by e-mail.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Integration
• SAP Business Workflow uses the existingg transactions
and functions of the R/3 System and does not change the
functions. You can combine the existing functions of the
R/3 System to form new business processes with SAP
Business Workflow. The workflow system takes over
control of the business processes.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Technical Principles
• The definition and execution of Workflow can be divided
into four main areas.
¾ Business Workplace
¾ Workflow Builder
¾ Tasks
¾ Business Object Repository (BOR)
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Technical Principles
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Technical Principles
• BUSINESS WORKPLACE
o Work items are displayed to the user for execution in their SAP Inbox
• WORKFLOW BUILDER
o W
Workflow
kfl ddefinitions
fi iti are defined
d fi d which
hi h are made
d up off steps
t that
th t control
t l
the workflow or the tasks to be executed . This linking is defined in
Workflow Builder .
• TASKS
o Tasks describe elementary business activities . They always refer to the
method of the object . Tasks can be background tasks or dialog tasks .
• OBJECTS AND OBJECT TYPE
o Object type describes the data with which you want to work in workflow ,
e.g. MATERIAL . Each Object type has methods in which activities are
g creation of material .
defined which can be executed with data e.g.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Demo Example
• Process Flow
o An employee enters a notification of absence (leave request) in
the R/3 System by filling out the relevant input template.
o The direct superior of the employee is responsible for approving
or rejecting the notification of absence. The R/3 System
determines the direct superior automatically on the basis of the
organizational
i ti l plan
l maintained.
i t i d
o If the request is approved the creator is notified by mail:
o If the request is not approved, the creator is informed and can
decide whether to withdraw the notification of absence or
revise it. If the superior has given reasons for the rejection in
an attachment, the creator can take these into consideration.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Demo Example
• Process Flow
o If the creator revises the request, it is submitted to the superior
for approval again. The applicant can also add an attachment,
which
hi h can then
th be b accessed db
by th
the superior.
i
o This cycle is repeated until either the superior approves the
leave request or the creator withdraws it.
o The applicant can find out the current processing status at any
time by looking in their workflow outbox.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Demo Example
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Roles in Workflow
• Process Cons
Consultant
ltant
¾ Person within the system of workflow roles who analyses the
existing business processes, identifies those that are suitable for
SAP Business Workflow and maps them onto a business process
model.
¾ The process consultant is also responsible for the maintenance of
the organizational plan required for the workflow.
¾ Roles to be assigned
9 SAP_BC_SRV_USER
SAP BC SRV USER
9 SAP_BC_BMT_WFM_PROCESS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Roles in Workflow
• Workflow
Workflo Developer
De eloper
¾ Person within the system of workflow roles who implements the
workflow based on the business process model developed by the
process consultant and using the SAP Business Workflow definition
tools .
¾ Roles to be assigned
9 SAP_BC_BMT_WFM_DEVELOPER
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Roles in Workflow
• Workflow
Workflo System
S stem Administrator
¾ Person within the system of workflow roles who is responsible for
the technical maintenance of the development environment and the
runtime behavior after automatic Customizing.
¾ Roles to be assigned
9 SAP_BC_ENDUSER
9 SAP_BC_SRV_USER
9 SAP_BC_BMT_WFM_ADMIN
SAP BC BMT WFM ADMIN
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Roles in Workflow
• Workflow
Workflo Agent
¾ Person within the system of workflow roles who appears as an end
user in productive workflows
workflows.
¾ The workflow agent starts workflows and processes work items.
Their work area is the Business Workplace.
¾ Roles to be assigned
9 SAP_BC_SRV_USER
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Roles in Workflow
• Process Controller
¾ Person within the system of workflow roles who evaluates the
workflow from a business perspective at runtime, and is
responsible for suggesting improvements.
¾ Roles to be assigned
g
9 SAP_BC_SRV_USER
9 SAP_BC_BMT_WFM_CONTROLLER
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
USE :
¾ Y
You use the
h B Business
i Object
Obj Builder
B ild to create , display
di l or change
h
object types .
¾ The path is Tools Æ Business Workflow Æ Development Æ
Definition T l Æ Workflow
D fi i i Tools W kfl Builder
B ild
¾ The transaction code is SWO1
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
PROCEDURE :
1. Choose Tools Æ Business Workflow Æ Development Æ Definition tools
Æ Business Object Builder. This displays the screen Business Object
Builder: Initial Screen.
2. Select Create.
3 The
3. Th Create
C Object
Obj Type
T di
dialog
l box
b appears.
4. Edit the fields Object type, Object name, Name and Description. When
doing so, bear in mind the general naming conventions for object types.
Leave the field Supertype blank.
5. Enter the name of a new program for the implementation of the object
type Bear in mind the naming conventions in your application.
type. application
6. Specify the code letter of your application (usually Y or Z).
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
• Examples
E l off object
bj t type
t componentt IDs
ID off th
the object
bj t ttype
Material are:
Key field : Material.Material
Attribute : Material.Industry
Method : Material.Display
Event : Material.Created
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
DEFINITION OF OBJECT TYPE COMPONENTS :
o You need object type components to work with an object type.
A newly created object type only has the object type
components that is inherits from the standard interface, which is
supported by every object type
o To set up the object type for your tasks, you define key fields,
attributes, methods and events
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
PROCESS FLOW :
• To define an object type, you do not have to edit all
object type components. You should follow the
sequence below:
• You check whether any object type components required are
already contained in interfaces and implement them.
them
• You define the key fields.
• You create the necessary attributes.
• Y create the
You h necessary methods,
h d ffor which
hi h you can ddefine
fi
method parameters and exceptions.
• You create the necessary events, for which you can create
additional
ddi i l event parameters.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
IMPLEMENTATION OF INTERFACES :
o You use this function to define the interfaces that your object
type supports
o SAP supplies
pp interfaces that yyou can use when definingg yyour
own object types
o Using interfaces standardizes the definition of the object type
components.
p
o Using an interface guarantees that the object type fully supports
the methods (with all parameters and all exceptions), attributes
and events in the interface
o All objects types support the standard interface.
o This contains the interfaces Check existence and Display
o You can add other interfaces to your object type
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
INTERFACE AGGREGATE :
o The aggregate type is used to specify functional relationships
between object types
o There is no inheritance
o The attribute Aggregate contains the reference to this aggregate
type
o You do not have to implement anything in the program of the
object type
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
INTERFACE EXTENDED APPROVAL :
• Result of this method
• The method XApproval has one result with four possible values.
The values are specified using the fixed values for the domain
SWF_XAPPRE :
• 0 (object approved)
• 1 (object proposed for approval)
• 3 (object proposed for rejection)
• 4 (object rejected)
• In the implementation of this method, the container element
RESULT of the method container must be assigned one of the
four values at the end
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
INTERFACE APPROVAL :
• The interface Approval is used to offer a method for the object
type, which can be used in an approval task.
• The implementation
p of this method is always
y incomplete
p and not
adapted to the current conditions of the object type
• RESULTS OF THIS METHOD :
– The method Approval has one result with two possible values. These are
specified using the fixed values for the domain SWF_APPRES :
– 0 (object approved)
– 4 (object rejected)
– In the implementation of this method, the container element RESULT of
the method container must be assigned one of the two values at the end
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
INTERFACE CREATE :
• Used for creating an object for the object type
• EXCEPTIONS FOR THIS METHOD :
• Three exceptions are defined in the interface Create for the method
Create
• You must implement these exceptions at the appropriate points in
the program. Use the macro following macro instruction:
EXIT_RETURN <Code> <Variable1> <Variable2> <Variable3>
<Variable4>
• As the <Code>, enter the exception’s 4-digit number specified
when the exception was defined. The variables (maximum of four)
are derived from the definition of the message that is linked to the
exception
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
INTERFACE DISPLAY :
The interface Display contains the method Display for displaying an
object
Th method
The th d Display
Di l is i implemented
i l t d for
f the
th interface
i t f in
i suchh a manner
that the key field values of the object are displayed as standard
It is also entered as default method in the basic data
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
INTERFACE EDIT :
• To offer a method for editing an object for your object type
• Exceptions for the method
• The exception Object does not exist is defined for the method
Edit under the number 0001 in the interface Edit. You must
implement this exception at the appropriate point in the
program. Use
U th the macro ffollowing
ll i macro instruction:
i t ti
» EXIT_RETURN 0001 SPACE SPACE SPACE SPACE
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
INTERFACE FIND :
With this method you can use the inherited source code unchanged.
The source code is not entered in the program of your object type, but
only in the program of the interface Find, from which it is inherited
The system sets up an object reference in the inherited implementation
of the method Find. To do this, the system generates a dialog box with
input fields for the key fields of the object
Th system
The t alsol checks
h k within
ithi the
th implementation
i l t ti whether
h th the
th key
k
fields entered actually identify an existing object
So that the method Find really does only return objects that exist, you
must also define and implement the method ExistenceCheck (interface
Check existence) for the object type
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
INTERFACE FIND :
• Exceptions for the method
• Two exceptions are defined for the method Find :
• Exception 0001: Object does not exist
• Exception 1017: Cancellation by user
• The exceptions are implemented in the program of the interface
Find
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
STANDARD INTERFACE :
All object types support the standard interface and hence inherit the
attribute ObjectType and the interfaces Display and Check existence
These contain the methods Display and ExistenceCheck
The attribute ObjectType returns the type of an object
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
DEFINING KEY FIELDS :
• Objects are always identified using one or more key fields
• The identifying key of an object is made up of all the key fields of the
object type
• Procedure
• Position the cursor on the component name Key fields (blue
background).
• Select
• Answer YES to the question Create with ABAP Dictionary field
proposals? The Create with Data Dictionary Field Proposals
dialog box appears
• Enter the table from which you want to reference the fields, and
select the fields that are the key fields of your object type
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
DEFINITION OF ATTRIBUTES FOR AN OBJECT TYPE :
• You must define attributes for an object type when you want to query
particular properties, statuses or values at runtime
• Attributes can be used to formulate conditions in the workflow
definition
• At runtime, the attribute values are read or calculated, and can also
be used to control the workflow
• Object type attributes can return data in the following formats:
• Value of ABAP Dictionary field
• Object reference
• Value calculated at runtime
• Object status in status management
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
DEFINITION OF ATTRIBUTES FOR AN OBJECT TYPE :
• Att ib t have
Attributes h various
i sources off information
i f ti
VIRTUAL
Attribute for which a read procedure always has to be
implemented, since no field content in the database
corresponds to this attribute. A virtual attribute can return
the value of an ABAP Dictionary field or an object reference
DATABASE FIELD
When this type of attribute is defined, reference is made to
a database field as the source of the required information.
An attribute whose source is a database field can either
return the database field contents or an object reference
OBJECT STATUS
¾ Attribute whose value is an object status
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
DEFINITION OF ATTRIBUTES FOR AN OBJECT TYPE :
o Relationships between two object types are described using attributes,
which return their information as object references to the other object
type
o In the field Inverse attribute, enter the attribute of the other object type,
which contains the object reference to this object type
o You can use macros to access the attribute
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
DEFINITION OF METHODS FOR AN OBJECT TYPE :
• With a method you define a function with which you can edit,
create, search for or delete an object of this object type
• The methods refer to ABAP functions (transactions,
(transactions function
modules, dialog modules, and so on) and make them available to
the workflow system
• Features
– You can also define the following data for each method:
Import
p p
parameters ((for synchronous
y and asynchronous
y
methods)
A result (only for synchronous methods)
Export parameters (only for synchronous methods)
Exceptions (only for synchronous methods)
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
DEFINITION OF METHODS FOR AN OBJECT TYPE :
• SYNCHRONOUS METHODS :
– Method that assumes process control for the duration of its
execution and reports back to the calling component (in this
case the work item manager) after its execution
– Terminating events can be defined for a single-step task
described with a synchronous object method
– A synchronous method can return the following data to the
workflow:
– Return parameters
– One result
– Exceptions
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
DEFINITION OF METHODS FOR AN OBJECT TYPE :
• ASYNCHRONOUS METHODS :
– Method that does not report back directly to the calling
component (in this case the work item manager) after its
execution
– It does not return any result, any parameters or any
exceptions
– At least one terminating event must be defined for a single-
step task described with an asynchronous object method
– An asynchronous method must enter its results itself.
itself Import
parameters can be passed to it only
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
DEFINITION OF METHODS FOR AN OBJECT TYPE :
• RESULT
– A specific parameter of a synchronous method for returning
the essential result of this method
– The possible values of this result can be defined in a fixed
value domain or a check table so that they are known in the
workflow definition and can be taken into account
– A method can only ever have one result, but it can have any
number of return parameters as well
– A method does not necessarily have to have a result
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
DEFINITION OF METHODS FOR AN OBJECT TYPE :
• EXCEPTIONS
– Object type component: Error which may occur during
method execution and indicates whether a method was
successful
– Exception categories:
– Application and system error
– Temporary error
– Temporary errors can occur when system resources are not
available
il bl
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• DEFINITION OF METHODS FOR AN OBJECT TYPE :
• PROCEDURE
– To create methods for an object type, position the cursor on
the name Methods (blue background),
background) and select
– If the new method is based on a function module, you should
answer the question with YES . You are then supported by a
wizard in the definition of the method
– GENERAL TAB
– DIALOG : If you do not set the indicator Dialog on the tab
page General,
General the method is executed in the background at
runtime
– SYNCHRONOUS
– RESULT
SU
– INSTANACE DEPENDENT
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• DEFINITION OF METHODS FOR AN OBJECT TYPE :
• PROCEDURE
– RESULT TYPE TAB
• Define the reference to ABAP Dictionary
– ABAP TAB
• You enter the function to be executed when the method is
called on the tab page ABAP
A A
e.g if the transaction has to be called by the method then
Checkbox “Transaction” is to be selected and the transaction code
to be entered in the NAME
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• DEFINITION OF METHOD PARAMETERS :
• You define method parameters for a method under the following
circumstances:
– When the method requires other input values apart from the
object reference, which are not requested in dialog.
– When the method returns parameters apart from the object
reference
• Integration
– The following data type references exist for method
parameters:
– ABAP Dictionary reference
– Object
j type
yp reference
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj t Builder
B ild
DEFINITION OF METHOD EXCEPTIONS :
• You define eexceptions
Yo ceptions for a method when
hen you
o wantant to "p
"publicize"
blici e" error
situations in a standardized manner in order to give the caller of the
method the opportunity to react to the error situations
• To d
T define
fi exceptions
ti ffor a method,
th d position
iti the
th cursor on the
th method
th d and
d
select Exceptions. The existing exceptions for the method are displayed
and you select to create a new exception.
• Give the
Gi th exception
ti an identifying
id tif i number b in i the
th dialog
di l box
b Add
Exceptions, which is used to address it in the implementation program.
The following number ranges apply:
» 0001-1000:
0001 1000 EExceptions
ti defined
d fi d ffor iinterfaces
t f
» 1001-7999: Application-specific exceptions, reserved for SAP
development
» 8000-8999: Exceptions
p triggered
gg by
y the object
j managerg
» 9000-9999: Customer-defined exceptions, reserved for
customers
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
DEFINITION OF METHOD EXCEPTIONS :
• Exceptions are classified according to error types.
• Temporary error: This error type indicates that certain system
resources are not available at the moment,, and that it is
advisable to call the method again at a later point in time.
Temporary errors can also occur if the method is temporarily
locked by another user for processing.
• Application error: This error type is caused within the
application called in the method. A table that cannot be
maintained or a document that does not exist are typical
application errors.
• System error: This error type shows incorrect configuration of
the object manager or an inconsistency between object type
definition and method call. Missing mandatory method
parameters when calling a method are an example of a system
error.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
DEFINITION OF EVENTS FOR AN OBJECT TYPE :
• You define events for an object type, if a status change in an
object of this type is to be published across the system
• You use an event in a workflow under the following
circumstances:
• In a workflow or task definition as a triggering event
• The workflow or task is started when the event is triggered.
• In a task definition as a terminating event
• The task is terminated when the event is triggered.
• In a workflow definition for steps of the types Event creator
and Wait for event.
• The event is triggered (event creator) or the workflow is
continued when the event is triggered (wait for event).
event)
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
DEFINITION OF EVENTS FOR AN OBJECT TYPE :
o The event is not normally triggered in the implementation program, but
instead by an event creation. You can use the function modules
SWE_EVENT_CREATE or SAP_WAPI_CREATE_EVENT to trigger
an eventt
o An event is published without the creating application being informed
as to whether a receiver reacts to this event. The system enters potential
receivers in a linkage table, which is evaluated by the event manager
o Every event has an event container that contains data about the context
of its creation. The data is passed to the task or workflow via a binding
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
DEFINITION OF EVENT PARAMETERS :
• You define event parameters to supplement the system event
parameters
• EVENT PARAMETERS :
– Runtime-specific information from the event creation
context
– Event parameters are defined as elements of the event
container and are passed to the event receivers via binding
– The following event parameters are automatically contained
in the event container:
– The reference to the object whose change of state is
described by the event.
– The user name of the party who triggered the event
creation.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
DEFINITION OF EVENT PARAMETERS :
• The event parameters are displayed as event container elements
and you use them in binding definitions between the event
container and the task or workflow container
• There are two different types of data type reference for event
parameters:
• ABAP Dictionary reference
• Object type reference
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
PROGRAMMING IN THE IMPLEMENTATION PROGRAM :
o The information specified about the object type components is
only of a descriptive nature. Attribute accesses and method calls
are programmed in the implementation program of the object
type
o This program is called and executed by the system at runtime.
o Duringg object
j type
yp definition you
y select Program
g to g
go to the
ABAP Editor
o You go directly to the lines in the implementation program that
contain the relevant source text for the selected method or
attribute
o Parts of the source text can be generated automatically to help
implementation
p
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
PROGRAMMING IN THE IMPLEMENTATION PROGRAM :
• The source text is generated based on the specifications you made
when defining the object type and the object type components,
and inserted into the implementation
p p
program
g
• MANUAL POSTPROCESSING
– You need to check the program as automatic program
generation
i only provide
i templates
• CHANGES AFTER PROGRAM GENERATION
– Changes
g made to object
j type
yp components
p do not
automatically change the program
– So all subsequent changes have to be made manually
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
PROGRAMMING IN THE IMPLEMENTATION PROGRAM :
• Only in the following cases the source code gets automatically
changed in the implementation program
• Deletion of methods
• Deletion of virtual attributes
• Renaming of methods
• Renaming of virtual attributes
• INCLUDING MACRO INSTRUCTIONS
• Macro instructions for processing containers and accessing
objects
bj t are usedd iin th
the iimplementation
l t ti program
• The macro instructions are available if the macro <OBJECT>
has been included into the implementation program
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
PROGRAMMING IN THE IMPLEMENTATION PROGRAM :
• The macro instructions for processing the container can also be
used outside the implementation program
• The macro instructions for accessing objects
objects, attributes and
methods can only be used within the implementation program
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• MACRO INSTRUCTIONS FOR PROCESSING A CONTAINER
These macro instructions can be used in following programs :
• Implementation programs of object types
• Function modules for event creation
• Function modules for role resolution
Processing a container instance includes:
• Accessing
A i the value off a container
i element
• Entering a value for a container element
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• The include file <CNTN01> must have been included into the
program in order to use these macros
• The container must be declared and initialized with the following
macro instructions:
– SWC_CONTAINER <Container>. "Declaration
SWC_CREATE_CONTAINER <Container>. "Initialization
• You can assign the content of a field to a container element or
write the content of a container into a field
• This content can be multiline, that is, in the form of an internal
table
• The content of a field can be an elementary data type, a structure
oor an
a object reference
e e e ce
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• ACTIVITIES :
9 Deleting a container element
9 SWC_DELETE_ELEMENT <Container>
<ContainerElement>.
9 Copying a container element
9 SWC_COPY_ELEMENT <SourceContainer>
<SourceElement> <TargetContainer> <TargetElement>.
<TargetElement>
9 Writing a field value
9 SWC_SET_ELEMENT <Container>
<ContainerElement> <Value>.
<Value>
9 Reading a field value
9 SWC_GET_ELEMENT <Container>
<ContainerElement>
C i El <FieldVariable>.
Fi ldV i bl
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• ACTIVITIES :
• Writing a multiline field value
– SWC_SET_TABLE <Container> <ContainerElement> <Value>.
• Reading a multiline field value
– SWC_GET_TABLE
S C G A <Container>
C i <ContainerElement>
C i l
<TableVariable>.
• Writing an object reference
– DATA <Object> j TYPE SWC_OBJECT.
SWC_CREATE_OBJECT <Object> <ObjectType> <ObjectKey>.
SWC_SET_ELEMENT <Container> <ContainerElement> <Object>.
• Reading an object reference
– DATA <Object> TYPE SWC SWC_OBJECT.
OBJECT
SWC_GET_ELEMENT <Container> <ContainerElement> <Object>.
SWC_GET_OBJECT_KEY <Object> <ObjectKey>.
SWC_GET_OBJECT_TYPE <Object> <ObjectType>.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• ACTIVITIES :
• Writing a multiline object reference
– DATA <ObjectList> TYPE SWC_OBJECT OCCURS 0.
DATA <Object> TYPE SWC_OBJECT.
SWC_CREATE_OBJECT <Object> <ObjectType>
<ObjectKey>.
APPEND <Object> TO <ObjectList>.
...
SWC_SET_TABLE <Container> <ContainerElement>
<ObjectList>.
• Reading a multiline object reference
– DATA <ObjectList> TYPE SWC_OBJECT OCCURS 0.
SWC_GET_TABLE <Container> <ContainerElement>
<ObjectList>.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• MACRO INSTRUCTIONS FOR ACCESSING OBJECTS ,
ATTRIBUTES AND METHODS
• You can use these macros for simplifying access to Business
Object Repository objects
• The include file <OBJECT> must be incorporated into the
program in order to use these macros
• You must declare variables in which an object reference is to
b stored
be t d withith th
the ffollowing
ll i iinstruction:
t ti
» DATA : <Object> TYPE SWC_OBJECT.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• GENERAL MACROS
• SWC_CREATE_OBJECT <Object> <ObjectType>
<ObjectKey>.
• SWC_REFRESH_OBJECT <Object>.
• SWC_GET_OBJECT_TYPE <Object> <ObjectType>.
• SWC_GET_OBJECT_KEY <Object> <ObjectType>.
• SWC_CALL_METHOD <Object> <Method> <Container>.
• SWC_GET_PROPERTY <Object> <Attribute>
<AttributeValue>.
• SWC_GET_TABLE_PROPERTY
SWC GET TABLE PROPERTY <Object>
<Obj t> <Attribute>
<Att ib t >
<AttributeValue>.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• EXECUTING MACROS ON OWN OBJECT
• All the macros in the section General macros can also be
executed directly on the object itself in the implementation
program
• To do this, you replace <Object> with SELF in the macro calls
e.g.
» SWC_GET_PROPERTY SELF <Attribute>
<Att ib t V l > .
<AttributeValue>.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• SETTING AN OBJECT KEY
• When implementing methods with which an object is created,
the object key must be set
• This typically applies to the methods Create and Find
• SWC_SET_OBJECTKEY <ObjectKey>.
• RAISING EXCEPTIONS
• W
Within thee implementation
pe e o program,
p og , you ccan raise
se thee
exceptions defined for a method
• EXIT_RETURN <Exception> <Var1> <Var2> <Var3>
<Var4>.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• DATA DECLARATION FOR VARIABLES USED
• The system automatically creates an area for the data
declaration for key fields, attributes and method parameters in
the implementation program
• This area is between the two macro instructions
BEGIN_DATA OBJECT and END_DATA OBJECT at the
beginning of the source text
• The data structure of the object key is between the macro
instructions BEGIN OF KEY and END OF KEY and is created
automatically by the system
• The method p parameters and attributes are then declared
• Since the system obtains the information about the names of
the variables and the field references directly from the
definition of the individual object type components, you cannot
make
k any changes
h h
here
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• DATA DECLARATION FOR VARIABLES USED
¾ BEGIN_DATA OBJECT. " Do not change.. DATA is generated
* only private members may be inserted into structure private
DATA:
" begin of private,
" to declare private attributes remove comments and
" insert private attributes here ...
" end of private,
BEGIN OF KEY,
MATERIAL LIKE MARA-MATNR,
END OF KEY,
PURCHASEREQUISITION TYPE SWC_OBJECT OCCURS 0,
PURCHASEORDER TYPE SWC_OBJECT OCCURS 0,
PURCHASINGINFO TYPE SWC_OBJECT OCCURS 0,
PURCHOUTLINEAGREEMT TYPE SWC SWC_OBJECT
OBJECT OCCURS 0,
0
DOCUMENT TYPE SWC_OBJECT OCCURS 0,
COSTESTIMATE TYPE SWC_OBJECT OCCURS 0,
PIECEOFEQUIPMENT TYPE SWC_OBJECT OCCURS 0,
_MAKT LIKE MAKT,
_MARA LIKE MARA.
END_DATA OBJECT. " Do not change.. DATA is generated
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• PROGRAMMING ASYNCHRONOUS METHODS
• It is programmed between the macro instructions
BEGIN_METHOD
• <Method> and END_METHOD
• The unique ID of the object is available in the structure of the
key fields under the variable OBJECT-KEY
• An asynchronous method can be implemented with a
t
transaction.
ti Th ttransaction
The ti iis called
ll d in
i the
th program withith the
th
ABAP command CALL TRANSACTION
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• PROGRAMMING SYNCHRONOUS METHODS
• It is programmed between the macro instructions
BEGIN_METHOD <Method> and END_METHOD
• The unique ID of the object is available in the structure of the
key fields under the variable OBJECT-KEY
• A synchronous method can be implemented with a function
module. The function module is called with the ABAP
command CALL FUNCTION in the program
• In the case of synchronous methods, a result and/or the export
parameters can be returned to the caller if you pass the result
to the container CONTAINER within the method
implementation
• The result is always put into the container element RESULT.
The result is available in the task container in the container
element
l t _WI_RESULT
WI RESULT
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• PROGRAMMING EXCEPTIONS
• You implement exceptions within a method, that is within the
macro instructions BEGIN_METHOD <Method> and
END_METHOD , using the macro instruction EXIT_RETURN
• EXIT_RETURN <Code> <Variable1> <Variable2>
<Variable3> <Variable4>.
• You must declare <Code> with the type SWOTINVOKE-
CODE
• STANDARD EXCEPTIONS
• EXIT_OBJECT_NOT_FOUND
• EXIT_CANCELLED
• EXIT_NOT_IMPLEMENTED
• EXIT_PARAMETER_NOT_FOUND
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• EXTENDING AND ADAPTING OBJECT TYPES
¾ DELEGATION TYPE
» Object type whose definition is considered at runtime instead of the
definition of another object type, although this other object type is
specified in all definition components (for example task and workflow
definition, linkage tables). In all definition tools you can still refer to
the original object type, but the system uses the definition of the
delegation type for every access.
» The delegation type must always be a subtype of the object type it is to
replace. The delegation type can have different or additional methods,
attributes and events.
» A delegation type is always defined for an object type on a system-
wide and cross-client basis
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• EXTENDING AND ADAPTING OBJECT TYPES
¾ DELEGATION TYPE
» Object type whose definition is considered at runtime instead of the
definition of another object type, although this other object type is
specified in all definition components (for example task and workflow
definition, linkage tables). In all definition tools you can still refer to
the original object type, but the system uses the definition of the
delegation type for every access.
» The delegation type must always be a subtype of the object type it is to
replace. The delegation type can have different or additional methods,
attributes and events.
» A delegation type is always defined for an object type on a system-
wide and cross-client basis
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• EXTENDING AND ADAPTING OBJECT TYPES
• DEFINING DELEGATION TYPES
¾ Defining a customer-specific delegation type across the system
» Choose Settings ÆDelegation ÆSystem-wide. You are on the screen
Display View "Customizing
Customizing Object Types":
Types : Details.
Details
» Select .
» Select New entries.
» The screen New Entries: Details of Added Entries is displayed.
» E
Enter the
h ID off the
h object
bj type ffor which
hi h you want to ddefine
fi a ddelegation
l i
type. in the field Object type.
» Enter the name of a person responsible.
» Enter the ID of the subtype for the object type in the field Delegation type
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
B i
Business Object
Obj Builder
B ild
• EXTENDING AND ADAPTING OBJECT TYPES
• DEFINING DELEGATION TYPES
¾ Defining a customer-specific delegation type for a specific frontend
» On the screen Business Object Builder: Initial Screen,
enter the ID of an object type as a frontend-specific
delegation type in the field Object/interface type.
» You can only specify a frontend-specific delegation for an
object type if you checked "GUI
GUI-specific
specific" beforehand for
this object type when maintaining system-wide delegation.
» Choose Settings Æ Delegation ÆFrontend.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
T k
Tasks
• DEFINITION OF TASK
o You use a Task to define an activity that can be executed within a
workflow definition or independently (as a single step). This
activity can be an SAP System transaction.
o You have to create new tasks as standard tasks .
CREATING A TASK
– Choose Tools Æ Business Workflow Æ Development Æ Definition Tools Æ
Tasks/Task Groups ÆCreate.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
T k
Tasks
• SINGLE STEP TASK
– Maintain names, work item text, object type and method Tab page Basic data
– Maintain agent assignment Additional data ÆAgent assignment
Æ Maintain
– Maintain elements in task container Container
– Maintain triggering events Tab page Triggering events
– Maintain terminating events Tab page Terminating events
– Maintain default rules Tab page Default rules
– Maintain description and notification texts Tab page Description
– Maintain additional data Additional data Æ Selection
criteria...Additional data Æ
Classification Æ Change
– Maintain SAPphone properties Tab page SAPphone.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
T k
Tasks
• MULTI STEP TASK
– Maintain names, work item text, object type and method Tab page Basic data
– Maintain agent assignment Additional data ÆAgent assignment
Æ Maintain
– Maintain elements in task container Container
– Maintain triggering events Tab page Triggering events
– Maintain description and notification texts Tab page Description
– Maintain additional data Additional data Æ Selection
criteria...Additional data Æ
Classification Æ Change
– Maintain SAPphone properties Tab page SAPphone.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Tasks
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
CONTAINER
• The elements of a container are described with ID, data type reference
and other properties
• Types of Container
¾ Method Container
¾ Event Container
¾ Rule Container
¾ Task Container
¾ Workflow Container
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
BINDING
• Values can be assigned to container elements in different
ways.
¾ Value assignment using a binding from another container according to a binding
definition carried out previously.
¾ V l assignment
Value i directly
di l to a container
i instance
i in
i the
h program off an
application.
¾ Value assignment with an initial value determined at definition time when the
container instance is created.
• At definition time you create binding definitions for the workflow. This
involves specifying
p y g the assignment
g rules for how data is exchanged
g
between two containers. At runtime these binding definitions are
executed making workflow execution possible
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
BINDING
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
BINDING
• Binding Definition from Task Container
• You define the bindings from the task container in the following two
places.
– In the definition of a task
» There are binding definitions to the:
» Method container (for import parameters of method)
» Rule container (for definition of default rules)
– In the step definition in the Workflow Builder
» The binding definition to the workflow container.
• Binding Definitions to Workflow Container
• You define the bindings
g from the workflow container within the
Workflow Builder. There are binding definitions to the:
» Task container (activity, user decision, document from template, send
mail, form step)
» E ent container (event
Event (e ent creator)
» Rule container (for definition of responsible agents and recipients)
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
BINDING
• Binding Definition from Method Container
¾ You define the binding from the method container to the task container
(for export parameters of the method with synchronous methods) during
definition of a task.
• Binding Definition from the Rule Container
¾ You make the binding definition from the rule container to the workflow
container during the definition of a step.
• Binding Definition from Event Container
¾ You define the bindings from the event container in the following three
places.
» In the definition of a task for the binding definition to the task
container (for triggering or terminating events of the task).
task)
» In the Workflow Builder in the basic data of a workflow for the
binding definition to the workflow container (for triggering events
of the workflow).
» InI the
th Workflow
W kfl B Builder
ild iin th
the ddefinition
fi iti off a wait
it step
t for
f the
th
binding definition to the workflow container.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Workflow Builder
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
• This is the main WebFlow Engine tool for creating, displaying, and
processing
i workflow
kfl ddefinitions.
fi iti You
Y can test
t t workflow
kfl definitions
d fi iti andd
generate operable versions.
• The Workflow Builder pprovides a ggraphical
p and an alphanumeric
p
modeling view and also a tree display of the workflow definition
• You can only use the graphical modeling view if you are working with
the SAPGUI for Windows
Windows. If you call the Workflow Builder using a
different SAP GUI, the alphanumeric modeling view is displayed
automatically
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
¾ Workflow
¾ Here you can insert new steps into the workflow definition and
process existing ones. Double-clicking on a step calls the associated
step definition.
¾ Overview
¾ The overview graphic is displayed here. The part of the workflow
graphic displayed in the screen area Workflow is marked with a
green rectangle. Changing the size or position of the rectangle
changes the display in the screen area Workflow.
Workflow
¾ Step types
¾ All step types that you can use in the workflow are displayed here
if you are in change mode. You can insert a new step using
Drag&Drop.
¾ Objects
¾ This screen area contains the following:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
» Workflow container
» All workflow container elements are displayed here.
here You can also define new
container elements and generate a where-used list here. In the options in the
Workflow Builder, you can choose not to display the workflow system elements
here.
» Document templates
» All the workflow's document templates that can be used in steps of the type
document from template are displayed here. You can use a where-used list to
determine the steps in which a document template is used
used.
» Workflow Wizards
» All Workflow Wizards that you can use in the definition of your workflow are
displayed here.
» T
Teamworking
ki
» Here you can search for steps by selected criteria. The result is displayed
graphically in the workflow area.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
» Workflows of this definition
» Your Workflow Outbox is displayed here
here, which displays all running workflows
for this definition.
¾ Navigation
» The workflow steps are displayed here according to the
workflow definition display. You can go directly to the
relevant step definition from the list.
¾ Messages
» All messages generated in where
where-used
used lists and workflow tests
are displayed here. Double-clicking on a message takes you to
the relevant step definition.
¾ Information
» This displayed which workflow is loaded in which definition,
the status of the respective workflow, and the version number
of this workflow in the original system
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
CALLING THE WORKFLOW BUILDER
Direct Start
Tools ÆBusiness Workflow Æ Development ÆDefinition
tools ÆWorkflow Builder .
St t ffrom T
Start Task
kDDefinition
fi iti
» If you start the Workflow Builder from a screen for
processing or displaying a multistep task, choose Workflow
Builder on the tab page Basic Data. The active version of the
workflow definition is loaded. If there is no active version, the
version with the highest version number is loaded.
» To call another version of the workflow definition, choose
Goto Æ Workflow Builder Æ Choose version in the task
definition. This takes you to a dialog box in which you can
choose a version of the workflow definition.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
WORKFLOW BUILDER
ADDITIONAL TOPICS: SAP Business Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
Maintenance of Activities
• At runtime, an activity is represented with a work item of one
of the following types:
» Dialog work item if the activity references a task with dialog.
» Background work item if the activity references a task
processed by the system without dialog.
» Workflow work item if the activity represents a workflow.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
Maintenance of Mail Transmission
• You use this step type to send a mail to different recipients. You
define the text and subject of the mail when defining the step.
Y can use variables
You i bl iin th
the ttext,
t which
hi h are fill
filled
d from
f the
th task
t k
container at runtime.
• This step type replaces the wizard Include "Send mail".
• The system creates a task automatically
automatically, which sends the mail
mail.
The text to be sent is stored with the task. The system creates
the variables used within the step definition in the task
container and defines a binding from the workflow container to
the task container for them
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
Maintenance of Form Steps
This step type enables you to display or process the data in a container
element of the workflow container. The container element must refer to
a structure whose fields are used in the form. A form can be generated
automatically by the workflow system. You can process the form
generated to adapt it to suit your individual requirements
• The maintenance of a form step is spread across several tab pages. You
can process its
it properties
ti on them,
th such
h as:
» Data for deadline monitoring
» Outcomes
» Responsible
p agents
g
• At runtime, a form step is represented by a dialog work item
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
Maintenance of User Decision
• In a user decision, the recipients receive the task description
together with the possible decision options during execution. You
can use a user decision
d i i in i the
th following
f ll i situations:
it ti
» Only one of several possible alternatives can be processed in the
workflow from a business point of view at execution time.
» A decision about the pprogression
g of the workflow must be made
in dialog with a user.
» An instruction (= user decision with only one decision option) is
required to continue the workflow.
» For approval and release steps
steps, possibly in connection with a
secondary method (the latter is possible without the application
having to cater for these functions).
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
Maintenance of Documents from a Template p
• You use this step type to create documents of various PC
applications and process them within the workflow. The work item
recipient creates the document based on a document template,
which
hi h can also
l containi container
i elements
l off the
h workflow
kfl
container
• The maintenance is spread across several tab pages. You can
process properties on them,
them such as:
» Template selection
» Responsible agents
» Deadline monitoringg
• At runtime, this step is represented by a dialog work item in the
Workflow Inbox of its recipients.
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
Maintenance of Conditions
• You use a condition in a workflow definition if:
» At execution time, only one of two possible alternatives can be
processed during the workflow, from a business point of view.
» The workflow system can make a decision based on the contents
of the workflow container without user interaction
• The system inserts a step of the type condition into the workflow
definition The system adds a branch to the workflow definition for
definition.
each outcome. To ensure the consistency of the block structure, all
branches created are brought together before the next step of the
workflow definition
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
Maintenance of Multiple
p Conditions
• You use a multiple condition in a workflow definition if:
» At execution time, only one of several possible alternatives can
be processed during the workflow, from a business point of view.
» The workflow system can make a decision based on the contents
of the workflow container.
» The decision can be formulated based on a comparison between
an expression
p from workflow container and a finite amount of
comparison values (constants, expressions).
» The system inserts a step of the type condition into the workflow
definition. The system adds a branch to the workflow definition
for each outcome. To ensure the consistency of the block
structure, all branches created are brought together before the
next step of the workflow definition
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
Maintenance of Event Creators
• Use an event creator if you want to publish an event from a
workflow. This event can be used as follows:
– To start other workflows or tasks.
– For this, the event must be entered as a triggering event for the
relevant workflow or task.
» As a terminating event of a task.
» For internal communication and synchronization
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
Maintenance of Wait Steps
• The following shows possible uses of a wait step in a workflow
definition:
» To suspendd the
h entire
i executioni off the
h workflow
kfl until
il a defined
d fi d
event has occurred.
» To wait for an event in a parallel processing branch, which
renders processing in the other branches unnecessary
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
Maintenance of Until Loops
p
• You use an UNTIL loop in a workflow definition if:
» At execution time with one of two possible alternatives, the
workflow is to "jump back" to process sections of the workflow
d fi i i again.
definition i
» The workflow system can make a decision based on the contents
of the workflow container
Maintenance of While Loops
• You use the WHILE loop in a workflow definition if:
» At execution time, only one of several possible alternatives can
be processed in the workflow from a business point of view, and
then
h theh comparison
i is
i to be
b performed
f d again.
i
» The workflow system can make a decision based on the contents
of the workflow container.
» The decision can be formulated based on a comparison
p between
an expression from workflow container and a finite amount of
comparison values (constants, expressions).
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
WORKFLOW BUILDER
Maintenance of Forks
• You use a fork in a workflow definition when the business process
can be continued by several users at the same time. You can also
configure
fi th
the ffork
k iin such
h a manner th
thatt nott all
ll branches
b h have
h to
t be
b
processed .
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
Events in Workflow
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
EVENTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
EVENTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
EVENTS
• EVENT CREATION
• Events can be created in following ways :
• Function Module like SWE_EVENT_CREATE
• Change Documents : Events are created when change documents are
written
• General Status Management : Events creation at status changes
• Message Control
• LIS : Event creation when an exception situation occurs
• Business Transaction Events
• HR Master Data : Event creation when HR Master data changes
• You can used ‘Wizard’ for Event Creation
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
EVENTS
• EVENT CONTAINER
• The eventt container
Th t i contains
t i the
th eventt parameters
t as container
t i
elements.
• If you define triggering events or terminating events for a task, you
can specify the binding from the event container to the task
container.
• If you define triggering events for a workflow, you can specify the
binding from the event container to the workflow container
• You define a binding from the workflow container to the event
container in the definition of an event creator.
• You define a binding from the event container to the workflow
container
i in
i the
h definition
d fi i i off a wait
i step.
• The event container contains workflow system elements as
standard. You can add more container elements to the event
container within object type definition in the Business Object
Builder
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
EVENTS
• USING LINKAGES
• A linkage defines the assignment of events to the event receivers
interested in them
• The ppotential receiver of an event must define the linkage.
g This
can be done using function modules provided or a maintenance
transaction
• The workflow system in the form of the event manager evaluates
all
ll the
h events created.
d In
I doing
d i this,
hi the
h event manager carries i out
the following steps:
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
EVENTS
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
ADDITIONAL TOPICS: SAP Business Workflow
EVENTS
• Receiver Type Function Module
• You can enter
Y t a receiver
i type
t function
f ti moduled l for
f the
th linkage
li k to
t
determine a receiver type at runtime . The interface of the receiver
type function module is described in the documentation for the
function module SWE_TEMPLATE_RECTYPE_FB
_ _ _ . This
function module can be used as a template and is stored in the
function group SWE_TEMPLATE .
• Check Function Module
• You can enter a check function module for the linkage to decide
whether the receiver function module should actually be called.
The data in the event container can be used for this
• R i
Receiver F
Function
ti Module
M d l
• A receiver function module must be entered for each linkage,
which executes the actual reaction to the event
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation
Thank You
Satyam
SAP PMGSAP PMG Delivering Solution Excellence and Innovation