Professional Documents
Culture Documents
APPLICATION PROGRAMMING
-An Introduction
01/27/10 Prepared By SUSHEEL THAKUR(2658) 3
SAP SYSTEM (3 Tier Architecture)
SAP GUI SAP GUI
Presentation Layer
(Windows based)
SAP Instance
Application Layer
Dispatcher M
(Windows Server/UNIX)
Requ
est SAP Buffer
Queu (Shared
e Mem)
D D B V S E
G
Oracle
Database Layer
Informix
(Windows Server/UNIX)
DB2
Database Server
MS SQL Server
MaxDB
01/27/10 Prepared By SUSHEEL THAKUR(2658) 4
SAP ARCHITECTURE
Ø Based on client/server architecture and uses
a relational database to track all
information.
Ø Made up of small programs called
transactions.
Ø R/3 gathers related transactions together
into groups and call them modules.
Ø Module- set of transactions that deal with
the same area of business functionality.
Ø
01/27/10 Prepared By SUSHEEL THAKUR(2658) 5
ABAP
Advanced
Business
Application
Programming
Editor
Ø
Ø
01/27/10 Prepared By SUSHEEL THAKUR(2658) 10
01/27/10 Prepared By SUSHEEL THAKUR(2658) 11
2. MENU PAINTER:
Ø A tool with which you design user interfaces
for your ABAP programs.
Ø An instance of the user interface, consisting
of a menu bar, a standard toolbar, an
application Toolbar, and a function key
setting, is called a GUI status. The GUI
status and GUI title defines how the user
interface will look and behave in an
ABAP program.
Ø
01/27/10 Prepared By SUSHEEL THAKUR(2658) 12
01/27/10 Prepared By SUSHEEL THAKUR(2658) 13
3. SCREEN PAINTER
Ø A ABAP Workbench tool that allows to create screens for
transactions.
Ø SCREEN PAINTER MODES:
The Screen Painter has a layout editor that you use to
design your screen layout. It works in two modes:
-Graphical mode and
- Alphanumeric mode.
Ø Both modes offer the same functions but use different
interfaces. In graphical mode, you use a drag and drop
interface similar to a drawing tool. In alphanumeric
mode, you use your keyboard and menus.
Ø
01/27/10 Prepared By SUSHEEL THAKUR(2658) 14
To start the Screen Painter, choose the corresponding pushbutton on the
initial screen of the ABAP Workbench or enter Transaction SE51
=
* PROGRAM SAPMTEST *
CHAINED STATEMENT
DATA tmp TYPE I.
WRITE :‘Hello World’,‘OK’.
01/27/10 Prepared By SUSHEEL THAKUR(2658) 20
01/27/10 Prepared By SUSHEEL THAKUR(2658) 21
ELEMENTARY DATA TYPES
Predefined
Type Descri
C Charac
01/27/10 Prepared By SUSHEEL THAKUR(2658)
Date
22
DEFINING DATA TYPES
ØExample:
TYPES: BEGIN of address,
name TYPE surname,
code TYPE zip_code,
town TYPE city,
str TYPE street,
END OF address.
ØExample:
DATA: tmp(10) TYPE C,
tmp1 TYPE I,
tmp2(8) TYPE P DECIMALS 2 VALUE ‘1.50’.
Ø
DATA tmp TYPE I. Text Literal
WRITE ‘Hello World’.
WRITE ’10’. Text Literal
MOVE 9 TO tmp.
Numeric Literal
PROCESSING DATA:
Move Statement
ØSyntax:
Ø MOVE <f1> TO <f2>.
ØExample:
DATA: T(10) TYPE C,
NUMBER TYPE P DECIMALS 2,
COUNT TYPE I.
T = 1111.
MOVE '5.75' TO NUMBER.
COUNT = NUMBER.
Ø
01/27/10 Prepared By SUSHEEL THAKUR(2658) 29
Assigning Values with WRITE
TO Statement
Ø Converts the contents of the source field into a field with type C.
Ø Syntax:
Ø WRITE <f1> TO <f2> [<option>].
Ø Example:
DATA: NUMBER TYPE F VALUE '4.3',
TEXT(10),
FLOAT TYPE F,
PACK TYPE P DECIMALS 1.
WRITE NUMBER.
WRITE / TEXT.
WRITE NUMBER TO FLOAT.
WRITE / FLOAT.
WRITE NUMBER TO PACK.
Ø
ØExample:
DATA: COUNTER TYPE I.
COMPUTE COUNTER = COUNTER + 1.
COUNTER = COUNTER + 1.
ADD 1 TO COUNTER.
Ø
01/27/10 Prepared By SUSHEEL THAKUR(2658) 31
Arithmetic Calculations
Ø Output: abcdefghij
bcdefghij
01/27/10 Prepared By SUSHEEL THAKUR(2658) 34
ØConverting to Upper or Lower Case
Ø TRANSLATE <c> TO UPPER CASE.
Ø TRANSLATE <c> TO LOWER CASE.
ØExample:
DATA: INT TYPE I,
WORD1(20) VALUE '12345'.
INT = STRLEN( WORD1 ).
WRITE INT .
Syntax:
IF <condition1>.
<statement block>
ELSEIF <condition2>
<statement block>.
ELSEIF <condition3>.
<statement block>
.....
ELSE.
<statement block>
ENDIF.
01/27/10 Prepared By SUSHEEL THAKUR(2658) 37
Example:
DATA: TEXT1(30) VALUE 'This is the first text',
TEXT2(30) VALUE 'This is the second text',
TEXT3(30) VALUE 'This is the third text',
STRING(5) VALUE 'eco'.
IF TEXT1 CS STRING.
WRITE / 'Condition 1 is fulfilled'.
ELSEIF TEXT2 CS STRING.
WRITE / 'Condition 2 is fulfilled'.
ELSEIF TEXT3 CS STRING.
WRITE / 'Condition 3 is fulfilled'.
ELSE.
WRITE / 'No condition is fulfilled'.
ENDIF.
•
ENDWHILE.
Ø
Ø
EXAMPLE:
DATA: BEGIN OF LINE,
LAND(3) TYPE C,
NAME(10) TYPE C,
AGE TYPE I,
WEIGHT TYPE P DECIMALS 2,
END OF LINE.
DATA ITAB LIKE SORTED TABLE OF LINE
WITH NON-UNIQUE KEY LAND NAME AGE WEIGHT.
LINE-LAND = 'G'. LINE-NAME = 'Hans'.
LINE-AGE = 20. LINE-WEIGHT = '80.00'.
INSERT LINE INTO TABLE ITAB.
LINE-LAND = 'USA'. LINE-NAME = 'Nancy'.
LINE-AGE = 35. LINE-WEIGHT = '45.00'.
INSERT LINE INTO TABLE ITAB. LOOP AT ITAB INTO LINE.
WRITE: / LINE-LAND, LINE-NAME, LINE-AGE, LINE-WEIGHT.
ENDLOOP.
The output is: F Michele 30 60.00
•
• Reading Data
•
•
•
•
• For now deselect the “With TOP INCL” flag.
Click on Enter to continue
•