Professional Documents
Culture Documents
Presentation component
Database
Content
Topics:
• 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
Topics:
•Often used transactions
•What is ABAP/4 program?
•ABAP dictionary
•Function Module
•Message
•Transaction code
•Authorization in ABAP object
What is ABAP/4 program?
1 Executable program(Report/Interface)
Can be started with transaction code/directly/background
(via SE38 or SA38 - For example: RMCB0100 )
I INCLUDE program
Can not run on its own, has been included in other program
M Module pool
Processing step of screens, can be executed via transaction code or
Menu function (For example: SAPMV45A - Sale order processing)
F Function group
Contain function modules (SE37)
S Subroutine pool
Externally-called subroutines
ABAP/4 overview
Topics:
•Often used transactions
•What is ABAP/4 program?
•ABAP dictionary
•Function Module
•Message
•Transaction code
•Authorization in ABAP object
ABAP Dictionary
SE11 - Data dictionary
View
Table Structure
Data element
ABAP Dictionary
Search help
ABAP/4 overview
Topics:
•Often used transactions
•What is ABAP/4 program?
•ABAP dictionary
•Function Module
•Message
•Transaction code
•Authorization in ABAP object
Function module
Function Module
- ABAP/4 program: Include program
- Special external subroutines (include) stored in a central library
- Different from normal ABAP routine is the clearly defined interface
for passing data to and from the function module. The calling program
and the called function module have separate work areas
- Located in Function group (main program start with SAPLxxxx)
- Can be tested separately in SE37
- Statement in ABAP to call function module are:
- CALL FUNCTION ‘xxxxx’
ABAP/4 overview
Topics:
•Often used transactions
•What is ABAP/4 program?
•ABAP dictionary
•Function Module
•Message
•Transaction code
•Authorization in ABAP object
Message
Topics:
•Often used transactions
•What is ABAP/4 program?
•ABAP dictionary
•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)
Note : All transactions are stored in table TSTC, Maintain via SE93
ABAP/4 overview
Topics:
•Often used transactions
•What is ABAP/4 program?
•ABAP dictionary
•Function Module
•Message
•Transaction code
•Authorization in ABAP object
Authorization in ABAP object
• Program authorization
• Transaction code
• Table maintenance/Data browser
Program authorization group
Topics:
PBO Module.
Module xxxx
Module yyyy
PAI Module
100 Module aaaa
PBO
Module Module.
bbbb
Transaction code Module xxxx
Module yyyy
has been 200 PAI Module
requested from ModulePBO
aaaaModule.
Module Module
bbbb xxxx
R/3 user Module yyyy
300 PAI Module
Module aaaa
Module bbbb
Topics:
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.
WRITE ‘Hello world’.
Keywords
Declarative keywords : define data types or declare the data objects
Declarative keywords
TYPES create user-defined elementary data types and structured data types
Example TYPES: surname(20) TYPE C.
DATA define local/global variable for structure/internal table/memory block
address OCCURS 0
Example DATA: BEGIN OF address,
address_number(10) TYPE C,
street(30), Internal
structure
table
country LIKE T001-LAND1,
END OF address.
TABLES create a data object called a table work area refer to ABAP
dictionary(tables, structure,view)
Example TABLES: KNA1, KNB1.
Modularization keywords
Event define keywords
INITIALIZATION Before selection screen is displayed
AT SELECTION-SCREEN After input selection screen + selection screen is active
START-OF-SELECTION After process selection screen
GET <table> when logical DB offer a line of database table
END-OF-SELECTION After all selection has been done
TOP-OF-PAGE Process when new page is started
END-OF-PAGE Process when page is ended
AT LINE-SELECTION When user select line in the list
AT USER-COMMAND When user press function key/enter command in
command field
ABAP statement and Keyword(con’t)
FUNCTION...ENDFUNCTION
Define Function module
MODULE...ENDMODULE
After process selection screen
ABAP statement and Keyword(con’t)
Built in function
Arithmetic & string function
1. SELECT statements
2. SAP tables vs. Internal Tables
3. LOOP-ENDLOOP
4. WRITE statements
5. Comment in ABAP
6. Expressions and Operations in ABAP
7. Subroutines: FORMS, FUNCTION MODULE
ABAP statement and Keyword(con’t)
SELECT statement
SELECT statement
For selecting 1 or more records from a table:
Additions
. . . WHERE <condition>
SELECT statement
SELECT statement
For excluding duplicates:
Aggregate expressions:
SAP Table
Internal Table
• One way to process large quantities of data in ABAP
• Internal table is a dynamic sequential dataset in which
all records have the same structure and a key
• The data is taken from a fixed structure, stored line by
line in the memory
ABAP statement and Keyword(con’t)
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.
ABAP statement and Keyword(con’t)
LOOP Command
• To perform looping operation in the flow logic
• Four kinds of loops in ABAP:
• Unconditional loops using the DO statement
• Conditional loops using the WHILE statement
• Loops through internal tables and extract datasets
using the LOOP statement
• Loops through datasets from database tables using
SELECT statement
ABAP statement and Keyword(con’t)
DO Command
DO <n> TIMES.
statements
ENDDO.
WHILE Command
ENDWHILE.
LOOP AT IT_T001K.
WRITE: / IT_T001K-BWKEY.
ENDLOOP.
ABAP statement and Keyword(con’t)
WRITE Command
The basic ABAP statement for displaying data on the
screen
WRITE Command
• <OPTION> behind the WRITE statement is for formatting options
• E.g. : ..NO-ZERO, NO-SIGN, No GROUPING, DD/MM/YY,
• LEFT-JUSTIFIED, CENTERED, RIGHT-JUSTIFIED
• The most commonly used options:
• CURRENCY w
to treat the content of field <f> as a currency amount with w as a
currency key
• DECIMALS d
to determine number of decimals to be displayed
• UNIT u
to format the value according to the unit specified in the field u.
The content of field <f> is treated as a quantity.
ABAP statement and Keyword(con’t)
WRITE: / ‘Write’.
WRITE: it_bseg-dmbtr CURRENCY it_bkpf-hwaer.
WRITE: text-t01 LEFT-JUSTIFIED.
ABAP statement and Keyword(con’t)
Comment
Comment example
• Relational Operator
• String Comparison
• Logical Expression
• If/Case/Check Statement
• Exit/Continue Statement
ABAP statement and Keyword(con’t)
Display Meaning
Relational Operator
EQ = Equal to
NE <> >< Not equal to
GT > Greater than
GE >= => Greater than or equal to
LT < Smaller than
LE <= =< Smaller than or equal to
DATA: START TYPE D,
SUM1 TYPE F, BETWEEN f1 and f2 Interval
SUM2 TYPE P.
. IS INITIAL Initial value
.
.
IF START IS INITIAL ... .
IF SUM1 GT SUM2 ... .
String Comparison
Logical Expression
1. AND COUNTER GE 0
2. OR
3. NOT COUNTER GT 0 AND
FLAG IS INITIAL
IF <logical expression>.
IF Statement statements
ENDIF.
IF <logical expression>.
statements
ELSE.
statements
ENDIF.
IF <logical expression>.
statements
CASE statement
CASE <field>.
• Execute different
WHEN <value1>.
statement blocks
depending on the contents statements
ENDCASE.
ABAP statement and Keyword(con’t)
WHILE COUNTER GT 0.
• Within Loop:
statements
to terminate loop
CHECK FLAG NE SPACE.
pass conditionally
statements
ENDWHILE.
CHECK <condition>.
statements
ABAP statement and Keyword(con’t)
ENDDO.
2 EXIT outside loop structure.
statements
IF ... .
EXIT.
ENDIF.
statements
ABAP statement and Keyword(con’t)
CONTINUE.
DO 100 TIMES.
• Terminate loop statements
pass IF SY-INDEX GE 10
immediately AND SY-INDEX LE 20.
without any CONTINUE.
condition
ENDIF.
statements
ENDDO.
ABAP statement and Keyword(con’t)
• Define
FORM <name> [<parameters>].
<statement block>
ENDFORM.
• Calling internally
PERFORM <name> [<parameters>].
• Calling external subroutine
PERFORM <name>(program name) <parameters>
[IF FOUND]
ABAP statement and Keyword(con’t)
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
LIMU - enables transport of R/3 Repository object components
Obj: Object type (for example, DOMA, DTEL, FORM, PROG..)
Object name:
Name of the each object
Funct.: Function D,K,M
ObjStatus: LOCKED,ERR_IMP,OK_IMP and OK_GEN
Transportation of ABAP objects (con’t)
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.
Transportation of ABAP objects (con’t)
ABAP program
Transaction code SE38, Under menu Utilities-->Version management
Function module
Transaction code SE37, Under menu Utilities-->Version management
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
Transportation of ABAP objects (con’t)
Type of problems
Update Terminate
Cause: Update module can not be completed
Program bug
Cause: Written code is not correct
ABAP Runtime error - Analysis
Error ID
Double click to
display detail
Unexpected message
How to:
• Switch on the debugger.
• Set and delete static and dynamic breakpoints.
• Set Watch points.
• Stop a program at specific key words or events or when a fields
contents change.
• Continue processing after an interrupt.
• Display field contents during runtime.
• Display the contents of an internal table.
• Change field contents for testing purposes.
• Change the contents of an internal table.
• Display and use the debugger’s six different views.
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.
SE38 Start of programs in the debugging of transaction code SE38
SM50/SM51 via debugging menu
SE80 - Object browser
Simple Debugging