Sie sind auf Seite 1von 20

1

Copyright 2011 Tata Consultancy


Services Limited
BASIC ABAP STATEMENTS .
Darshan Desai - 760428
Rushi Shah
Pratik Tank
Paan Inak!ta - 7722"8
2
Ta#$e !% C!ntent
&. Intr!'u(ti!n T! ABAP
2. Basi(s !% ABAP
). Basi( ABAP State*ents

Data+ Para*eter State*ents

Arith*eti( State*ents

C!ntr!$ State*ents
3
Intr!'u(ti!n T! ABAP
1. Advanced Business Application Programming .
2. A high level Programming Language created by SAP .
3. Operating/atabase system!independent programming .
". ABAP contains a subset o# S$L called Open S$L #or
com#ortable database access #or various database .
%. ABAP is not case sensitive programming language .

4
Basi( !% ABAP

&or identical statement that have same string segment


you speci#y the starting segment once and conclude
it 'ith a colon ()*+ the remaining segments are then listed+
separated by commas (+* and concluded 'ith a period (.*
Chaine' State*ents ,-
,-./0 12ello ,orld3.
,-./0 1O43.
5
,-./0) 12ello ,orld3+ 1O43.
5
C!**ents ,-
6 /his is #ull line comment
,-./0 12ello ,orld3. 7 ,rite data (partial line comment*
,-./0 1/est3.
&or multiple line comment 'e can use the #ollo'ing steps)!
1. Select the te8t .
2. Press 9trl : 1 ; 1 <ey.
/he selected te8t 'ill turn as a comment.
6
Case Sensitiit-,-
ABAP (!**an's are n!t (ase sensitie

,-./0 120LLO ,O-L3 .

,rite 120LLO ,O-L3 .

'-./0 120LLO ,O-L3 .



Basi( ABAP State*ents
DATA State*ent,-

=ariables can be declared at any point in a program using


the A/A statement .

=ariables can be o# type C! "! #! $! %! &! T! '! String (



S-nta.,-
-0PO-/ >/0S/.
DATA /var?name0 T1PE ;var?type@ a$ue ;var?value@.
)
PARAMETER State*ent,-

,henever you run the program+ the system 'ill display the
parameters as input #ields on a selection screen be#ore the program
actually begins to e8ecute.
S-nta.,-.
Para*eters ;para?name@ AtypeB Apara?typeB ...
or
Para*eters p1 li<e v1 ...
... Ade#ault C888CB AobligatoryB Alo'er caseB Aas chec<bo8B
Aradiobutton group gB.
*
M23E State*ent,-

Dsed to move value #rom one #ield to another.


S-nta.,-
move v1 to v2.
or
v2 5 v1. 7EO=0 <ey'ord is optional
,here+
=1 + v2 5 =ariables.
.
10
11
,e can per#orm calculations using the #ollo'ing statements)
F 9ompute

F Add or add!corresponding

F Subtract or subtract!corresponding

F Eultiply or multiply!corresponding
F ivide or divide!corresponding
Arith*eti( State*ents,
12
Synta+,
compute op1 -op.op2(
/alid 0perators 1or the C02&3T4 Statement
0perator 0peration
5 6ddition
7 Su8traction
9 2ultiplication
: "ivision
99 4+ponentiation
"$/ $nteger division
20" ;emainder o1 integer division
9ompute
13
Using the add Statements:
6dd statement adds one num8er to another(
Syntax for the add Statement:
add v1 to v2(
<v2 = v2 5 v1(>
Similarly the synta+ 1or su8tract! multiply and divide
statements,
Su8tract v1 1rom v2(
<v2 = v2 7 v1>
A and SDB/-A9/)
14
#or multiply!
2ultiply v2 8y v1(
<v2 = v2 9 v1(>
#or divide!
"ivide v2 8y v1(
<v2 = v2 : v1(>
EDL/.PLG and .=.0
15
#ield strings ?ith components having the same name can 8e
added together ?ith add7 corresponding(
Synta+ 1or the add7corresponding Statement
add7corresponding -structure s1. to -structure s2.(
Similarly!
su8tract7corresponding -structure s1. 1rom -structure
s2.(
(

A!9O--0SPOH.HI and
SDB/-A9/! 9O--0SPOH.HI
16
EDL/.PLG!9O--0SOH.HI and
.=.0!9O--0SOH.HI
Synta+ 1or multiply7corresponding@
multiply7corresponding -structure
s2. 8y
-structure s1.(
Synta+ 1or divide7corresponding,
divide7corresponding -structure
s2. 8y -structure s1.
1
DATA: BEGIN OF rate,
usa TYPE f VALUE '0.6667',
frg TYPE f VALUE '.0',
aut TYPE f VALUE '7.0',
END OF rate.
DATA: BEGIN OF !"#e$,
usa TYPE % VALUE 00,
frg TYPE % VALUE &00,
aut TYPE % VALUE '00,
END OF !"#e$.
(ULTIPLY)*O++E,PONDING rate BY
!"#e$.
-+ITE . rate)usa.
-+ITE . rate)frg.
-+ITE . rate)aut.
DATA: ! TYPE % VALUE &,

# TYPE % VALUE &,

/ TYPE % VALUE ',
res TYPE %.
res 0 ! 11 # 11 /.
-+ITE: res.
1)
1*
Auestions
1
*
20
Copyright 2011 Tata Consultancy
Services Limited
ThanB you

Das könnte Ihnen auch gefallen