Professional Documents
Culture Documents
Objectives:
Content
R/3 user
R/3 user
Presentation component
ABAP
Workbench
R/3 Basis
system
R/3
R/3
Application 1 ... Application N
Database
Content
ABAP/4 overview
Topics:
Often used transactions
What is ABAP/4 program?
ABAP dictionary
Function Module
Message
Transaction code
Authorization in ABAP object
SE11 - Dictionary : Used to define and save data definitions You can also store
documentation, help information, data relationships, and other information. You also
use the Dictionary to generate database objects like tables and indexes.
The Dictionary is a central storage area for system-wide data definitions. Because
definitions are stored centrally, they are available for use anywhere in any program
throughout the system
SE41 - Menu Painter : Used to design the menus that appear in your
interface
ABAP/4 overview
Topics:
Function Module
Message
Transaction code
Authorization in ABAP object
Executable program(Report/Interface)
Can be started with transaction code/directly/background
(via SE38 or SA38 - For example: RMCB0100 )
INCLUDE program
Can not run on its own, has been included in other program
Module pool
Processing step of screens, can be executed via transaction code or
Menu function (For example: SAPMV45A - Sale order processing)
Function group
Contain function modules (SE37)
Subroutine pool
Externally-called subroutines
ABAP/4 overview
Topics:
Function Module
Message
Transaction code
Authorization in ABAP object
ABAP Dictionary
SE11 - Data dictionary
View
Table
Structure
Data element
ABAP Dictionary
Domain
F4
Search help
Lock object
ABAP/4 overview
Topics:
Function Module
Message
Transaction code
Authorization in ABAP object
Function module
Function Module
- ABAP/4 program: Include program
ABAP/4 overview
Topics:
Function Module
Message
Transaction code
Authorization in ABAP object
Message
Note :
ABAP/4 overview
Topics:
Function Module
Message
Transaction code
Authorization in ABAP object
Transaction code
Transaction type:
Dialog transaction - Flow by sequence of screens (for example FB03)
Report transaction - Start program with type 1 (for example MCBA)
Variant transaction - (client specific) start another transaction with variant
(for example UPAR)
ABAP/4 overview
Topics:
Function Module
Message
Transaction code
Authorization in ABAP object
Program authorization
Transaction code
Table maintenance/Data browser
execute programs
schedule jobs for background processing
maintain programs
maintain variants
When creating a program, you can specify an authorization group
as one of the program attributes. This allows you to group together
programs for the purposes of authorization checking.
Content
Topics:
Event in ABAP/4 program
- Dialog module
- Executable program (Selection screen,
lists)
100
Transaction code
has been
requested from
R/3 user
200
300
PBO Module.
Module xxxx
Module yyyy
PAI Module
Module aaaa
PBO
Module.
Module
bbbb
Module xxxx
Module yyyy
PAI Module
ModulePBO
aaaaModule.
Module Module
bbbb xxxx
Module yyyy
PAI Module
Module aaaa
Module bbbb
Module pool
Question??
Topics:
Event in ABAP/4 program
- Dialog module
- Executable program (Selection screen,
lists)
Statement
The ABAP programming language consists of the following
element types: STATEMENT, KEYWORD, COMMENT.
An ABAP program consists of individual ABAP statements.
Each statement begins with a keyword and ends with a
period. There might be comment in the same line as a
statement
For example:
PROGRAM ZTEST.
Keywords
Declarative keywords :
Declarative keywords
TYPES create user-defined elementary data types and structured data types
street(30),
Internal
structure
table
Modularization keywords
Event define keywords
INITIALIZATION
AT SELECTION-SCREEN
START-OF-SELECTION
GET <table>
END-OF-SELECTION
TOP-OF-PAGE
END-OF-PAGE
AT LINE-SELECTION
AT USER-COMMAND
FORM...ENDFORM
Define subroutine
FUNCTION...ENDFUNCTION
Define Function module
MODULE...ENDMODULE
After process selection screen
Built in function
Arithmetic & string function
ABS
SIGN
CEIL
FLOOR
TRUNC
FRAC
STRLEN
1. SELECT statements
SELECT statement
SELECT statement
For selecting 1 or more records from a table:
Additions
. . . WHERE <condition>
. . . ORDER BY PRIMARY KEY
. . . ORDER BY <f1> <f2> . . . <fn>
SELECT statement
For selecting individual columns from a table:
( full key )
SELECT
AVG( <f1> )
COUNT( DISTINCT <f1> )
COUNT( * )
MAX( <f1> )
MIN( <f1> )
SUM( <f1>
FROM <dbtab> . . .
INTO (<g1> . . . <gn>)
SAP Table
Table fields
Foreign keys
Technical Settings
Indexes
Internal Table
TYPES:
BEGIN OF T_T001K,
BWKEY LIKE T001K-BWKEY,
BUKRS LIKE T001K-BUKRS,
END OF T_T001K.
DATA:
IT_T001K TYPE T_T001K OCCURS 0.
DATA:
BEGIN OF IT_T001K OCCURS 0,
BWKEY LIKE T001K-BWKEY,
BUKRS LIKE T001K-BUKRS,
END OF IT_T001K.
WITH HEADER LINE
FROM <table>
INTO TABLE <internal table>
WHERE <condition>
LOOP Command
DO Command
DO
<n>
TIMES.
statements
ENDDO.
SY-INDEX
Loop index
WHILE Command
WHILE <logical expression>.
statements
ENDWHILE.
SY-INDEX
Loop index
LOOP AT IT_T001K.
WRITE: / IT_T001K-BWKEY.
ENDLOOP.
WRITE Command
WRITE Command
<OPTION> behind the WRITE statement is for formatting options
E.g. : ..NO-ZERO, NO-SIGN, No GROUPING, DD/MM/YY,
WRITE: / Write.
WRITE: it_bseg-dmbtr CURRENCY it_bkpf-hwaer.
WRITE: text-t01 LEFT-JUSTIFIED.
Comment
Comment example
* Write Sales Order number to the screen
Write: Sales Order : ,
20 it_vbak-vbeln. Sales Order Number
Relational Operator
String Comparison
Logical Expression
If/Case/Check Statement
Exit/Continue Statement
Display
Relational Operator
EQ =
Equal to
NE <> ><
Not equal to
GT >
Greater than
GE >= =>
LT <
Smaller than
LE <= =<
Meaning
Interval
Initial value
String Comparison
<f1> CO <f2>
contains only: f1 contains only characters from f2
ACCOUNT CO '0123456789'
<f1>
CA
<f2>
<f1> CS <f2>
'ABCDE'
CS
<f1> CP <f2>
'ABXDE'
CP
'DE'
contains pattern: f1 corresponds to the model f2
Model:
* any string
+ any character
# escape symbol
'*B+D*'
Logical Expression
1. AND
2. OR
3. NOT
COUNTER GE 0
COUNTER GT 0 AND
FLAG IS INITIAL
IF <logical expression>.
IF Statement
statements
ENDIF.
IF <logical expression>.
statements
ELSE.
ENDIF.
statements
IF <logical expression>.
statements
ELSE.
statements
ENDIF.
CASE statement
Execute different
statement blocks
depending on the contents
of particular data fields
WHEN OTHERS:
contents of <field>
does not equal to any
of the <value?>
contents
CASE <field>.
WHEN <value1>.
statements
WHEN <value2>.
statements
WHEN <value3>.
statements
WHEN OTHERS.
statements
ENDCASE.
CHECK statement
1
Within Loop:
to terminate loop
pass conditionally
statements
ENDWHILE.
2
CHECK <condition>.
statements
Terminate loop
entirely without
any condition
Terminate a
subroutine
without any
condition
EXIT.
1
IF COUNTER GE 100.
EXIT.
ENDIF.
statements
ENDDO.
EXIT outside loop structure.
statements
IF ... .
EXIT.
ENDIF.
statements
CONTINUE.
DO 100 TIMES.
Terminate loop
pass
immediately
without any
condition
statements
IF SY-INDEX GE 10
AND SY-INDEX LE 20.
CONTINUE.
ENDIF.
statements
ENDDO.
PROGRAM RSDEMO01.
Call calculate_tax
..
.
Subroutine
Calculate_tax
PROGRAM RSDEMO02.
..
.
Avoid redundancy
Modularization:
easy to read
easy to call
PROGRAM RSDEMO04.
Subroutine SUB1
Call calculate_tax
..
.
PROGRAM RSDEMO03.
..
.
Call calculate_tax
Function module
Subroutine
Calculate_tax
ABAP/4 function library
Function module
Calculate_tax
Define
FORM <name> [<parameters>].
<statement block>
ENDFORM.
Calling internally
PERFORM <name> [<parameters>].
Calling external subroutine
PERFORM <name>(program name) <parameters>
[IF FOUND]
Parameters:
p_path like rlgrap-filename.
..............................
perform f_check_file_exists using p_path.
Content
PgmID:
Program Id in request and task, normally there are 2 types for ABAP objects
R3TR - name for R/3 Repository objects and Customizing objects
Version management
serves different purposes and user groups:
- The developer can keep track of his or her work ("What have I changed?")
- The developer can restore a previous version by reactivating it.
- The system administrator can monitor work ("Which objects were changed and
how were they changed in a specific time interval?")
- It provides the basis for the auditor, who requires a complete history of
changes.
- It enables customers to adjust data with the help of the system after upgrading
to a new Release.
Data Dictionary
Transaction code SE11, Under menu Utilities-->Version management
Object Browser
Transaction code SE80, Go to specific object and under menu utilities,
Version management
Workbench Organization
Transaction code SE09, under menu Environment
Content
Type of problems
Unexpected message
Update Terminate
Cause: Update module can not be completed
Program bug
Cause: Written code is not correct
Double click to
display detail
Unexpected message
2. Read through the section in the message help text, process where
appropriate.
Message help text component
Diagnosis
System response
Procedure
3. Find the message location, the logic that drive the message
appearance.
Debugging
Use Where used list function to find out the code where
message is located (Not applicable for dynamic call)
Check the above logic before get into the current command, see the
related data/value from debugging screen.
2. Using Where used list Function in message workbench SE91/SE80
Update terminate
Program bug
1. Debugging
2. Use Call Hierarchy (SE48)
3. Use find function in ABAP editor
Simple Debugging
How to:
Switch on the debugger.
Set and delete static and dynamic breakpoints.
Set Watch points.
Simple Debugging
Start debugging:
/h
Start the debugger in Normal mode. Press enter to start.
/hs
Start the Debugger in System mode, for example, in order to debug
the system program (program with type S)
Appropriate menu options under system -> Utilities -> Debug ABAP
Break-points Command.
Simple Debugging
Dynamic break-point
In ABAP Editor SE38 --> Utilities --> Breakpoints --> Display/Set
In Debugging mode
Place the cursor on the statement
Choosing break-point -> Set/Delete
At ABAP command
At Event/Subroutine
At Function module
System exception
Simple Debugging
Stepping
Display mode
Execute (F6)
Return (F7)
Continue (F8)
Simple Debugging
Question ??