0% found this document useful (0 votes)
74 views

ABAP Programming Overview

The document provides an overview of ABAP programming including: - An outline of ABAP course chapters covering topics like list processing, SQL, selection screens, and modularization. - Descriptions of ABAP features such as data types, control structures, reports, and dialog programming. - Explanations of key ABAP concepts like variables, structures, value assignments and error handling.

Uploaded by

Vikrant077
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views

ABAP Programming Overview

The document provides an overview of ABAP programming including: - An outline of ABAP course chapters covering topics like list processing, SQL, selection screens, and modularization. - Descriptions of ABAP features such as data types, control structures, reports, and dialog programming. - Explanations of key ABAP concepts like variables, structures, value assignments and error handling.

Uploaded by

Vikrant077
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 72

ABAP Programming

ABAP Programming
Overview
Overview

ABAP Course Outline

Chapter 1 : Introduction to ABAP

Chapter 2 : List Processing in ABAP

Chapter 3 : Open SQL & Internal Tale

Chapter ! : "#ent$dri#en Progra%%ing &


Selection Screen

Chapter & : 'odulari(ation & Catch State%ent

Chapter ) : 'essage* +eugging* ,ile Trans-er


and T.pe /roup

ABAP Chapter 1

Introduction to SAP Architecture

ABAP O#er#ie0

+ata O1ect in ABAP



SAP S.ste% : 3 Tier Client2Ser#er
SAP S.ste% : 3 Tier Client2Ser#er
DB Server
SAP
Application
Server
SAP GUI
Presentation
Server
SAP GUI
SAP GUI

SAP SYSTEM (3 Tier Arcitect!re"
SAP SYSTEM (3 Tier Arcitect!re"
Presentation #a$er
(%in&ows 'ase&"
Application #a$er
(%in&ows Server(U)I*"
Data'ase Server
Data'ase #a$er
(%in&ows Server(U)I*"
M
SAP Instance
Oracle
In+ormi,
DB-
MS S.# Server
Ma,DB
G
Dispatcer
/e0!est
.!e!e
D D B 1 S E
SAP B!++er
(Sare& Mem"
SAP GUI
SAP GUI

+ialog Processing

Data'ase Server
Application Server
+ispatcher
/e0!est
.!e!e
D D D D
3
SAP B!++er
Program
Ta'le
2
3
3
4
5
6 7
8
39
4eport (ps%15
Tales custo%ers5
Select single 6 -ro%
custo%ers 0here id 7 15
8rite: 2 custo%ers$na%e5
Execute
ABAP
statemen
t
Check Program in
Program Buffer
:
Load&Gen
Program
SQL
Request
Send List
Generate
Screen(List
Send Request
Reques
t
List
-
Search for
free WP
Store request to
queue
Send request to
WP
SAP G!"
SAP S.ste% : +ialog Processing


Tas;<an&ler
DY)P/O Processor
ABAP Processor
#ocal Memor$
Memor$ Space
DB Inter+ace
#ist '!++er
Data'ase Server
Dialog %or; Process
+ialog 8or9 Process Architecture
Resu#t Set $emor%

ABAP Progra%%ing O#er#ie0

ABAP O#er#ie0
DATA ... DATA ...
WRITE ... WRITE ...
IF ... IF ...
MOVE MOVE
WHILE... WHILE...
*Comment... *Comment...
SEARCH ... SEARCH ...
SELECT ... SELECT ...
LOOP AT ... LOOP AT ...
DO ... DO ...

ABAP
ABAP
A
A&vance&
B
B!siness
A
Application
P
Programming


ABAP =eat!re
ABAP =eat!re

Declaring &ata wit vario!s t$pes an& str!ct!re

Operational elements +or &ata manip!lation

>ontrol elements +or controlling te program


+low

Event elements +or reacting to e,ternal events



ABAP
ABAP

Operating(Data'ase s$stem?in&epen&ent
programming

ABAP contains a s!'set o+ S.# calle&


Open SQL
Open SQL
+or com+orta'le &ata'ase access +or
vario!
vario!
"ata#a!e
"ata#a!e

ABAP Programming
ABAP Programming

ABAP /eport

Dialog Programming(Transaction"

ABAP Program @ /eport
ABAP Program @ /eport
+ata
/eport Program
$ attri#te t%pe &
'e(e)ta#*e+
/ea&ing
Data'ase

Rea"in, "ata
Rea"in, "ata

T.pes o- ABAP 4eport
3A /eport #isting
-A Drill?&own /eport
3A >ontrol?'rea; /eport
4A A#1 /eport
1
3
!

ABAP Program @ Dialog Program
ABAP Program @ Dialog Program
+ata
Dialog Program
$ attri#te t%pe M
'Mo"*e Poo*+
/ea&ing
Data'ase

Rea"in, an" )-an,in, "ata


Rea"in, an" )-an,in, "ata
%riting

+ialog Progra% : Transaction

ABAP Progra%%ing

:o0 to create ABAP progra%
Tran!a)tion Co"e $ SE./

Transaction : S"3;

Progra% Attriute

ABAP "ditor

Te Str!ct!re o+ te #ang!age
Te Str!ct!re o+ te #ang!age

Eac statement m!st en& wit a perio&




DATA tmp TYPE IA
%/ITE B<ello %orl&CA %/ITE BODCA

#iteral
#iteral


DATA tmp TYPE IA
%/ITE B<ello %orl&CA
%/ITE C39CA
MO1E 8 TO tmpA
Te<t Literal
=u%eric Literal
Te<t Literal

Chained State%ents

Successi#e state%ents that ha#e the sa%e string


seg%ent can e co%ined to -or% a single
chained state%ent

To do so* .ou speci-. the identical starting


seg%ent once and conclude it 0ith a colon >:?*
the re%aining seg%ents are then listed*
separated . co%%as >*? and concluded 0ith a
period >5?

At runti%e* a chained state%ent is treated li9e an


e@ui#alent se@uence o- indi#idual ABAP
state%ents

>aine& Statements
>aine& Statements
%/ITE B<ello %orl&CA
%/ITE BODCA
E
%/ITE@ B<ello %orl&CF BODCA
DATA tmp3 TYPE IA
DATA tmp- TYPE >A
E
DATA@ tmp3 TYPE IF
tmp- TYPE >A

>aine& Statement
>aine& Statement
MO1E s$?s!'rc TO tmp3A
MO1E s$?s!'rc TO tmp-A
MO1E s$?s!'rc TO tmp3A
E
MO1E s$?s!'rc TO@ tmp3F
tmp-F
tmp3A

>aine& Statement
>aine& Statement
PE/=O/M calG3 USI)G a3 a-A
PE/=O/M calG3 USI)G a3 a4A
E
PE/=O/M calG3 USI)G@ a3 a-F
a3 a4A

>omments
>omments
H Tis is +!ll line comment
%/ITE B<ello %orl&CA I %rite &ata (partial line comment"
%/ITE BTestCA

ABAP >omman& @ >ase Sensitivit$
ABAP >omman& @ >ase Sensitivit$
%/ITE B<ello %orl&CA
%riTe B<ello %orl&CA
w/iTE B<ello %orl&CA

ABAP comman& is not case sensitive





+ata O1ects in ABAP

Data O'Jects in ABAP
Data O'Jects in ABAP
'e%or. Space



Structure
Table Structure
Internal Table
Variable
Constants
<Field-symbols>

Aariale

1aria'le
1aria'le

1aria'les can 'e &eclare& at an$ point in a program

1aria'les can 'e !p to 39 caracters in lengt


/EPO/T KTESTA
DATA +irstname TYPE ST/I)GA
+irstname E BLonCA

Pre&e+ine& ABAP Data T$pes
Pre&e+ine& ABAP Data T$pes

T$pe Description Initial 1al!e
>
D
=
I
)
P
T
*
String
,string
>aracter
Date
=loating Point
Integer
)!meric Te,t
Pac;e& Decimal
Time
<e,a&ecimal
1aria'le?lengt
1aria'le?lengt
<e,a&ecimal
Space
B99999999C
9A9
9
B9C
9
B999999C
C99C
Space
Blan; string
#engt
3 M 65535
7 caracters
7 '$tes
4 '$tes
3 M 65535
3 M 36 '$tes
6 caracters
3 M 65535
1aria'le
1aria'le


De+ining 1aria'le wit DATA Statement
De+ining 1aria'le wit DATA Statement
H S$nta,
DATA varN(*en,t-"O NT$pe t%peO NDecimals nm#erOA
DATA var #IDE Ta'le?=iel& N1A#UE initia* va*eOA

De+ining 1aria'le wit DATA Statement
De+ining 1aria'le wit DATA Statement
H Data Declaration
DATA@ tmp(39" TYPE >F
tmp3 TYPE IF
tmp-(7" TYPE P DE>IMA#S - 1A#UE B3A59CA
DATA@ tmp3(5" TYPE )F
tmp4A

De+ining 1aria'le wit DATA Statement
De+ining 1aria'le wit DATA Statement
H Data Declaration
DATA c!stomerno #IDE c!stomers?i&A
DATA matnr #IDE mara?matnrA
+ATA custo%erno TBP" custo%ers$id5
+ATA %atnr TBP" %ara$%atnr5

ABAP Prede-ined +ata T.pes
ABAP Predefined &ata '%(es
Com(#ete '%(es
(")*)&)')S'R"+G and ,S'R"+G
"ncom(#ete '%(es
(C)+)P and ,

Aariale

+ata T.pe >F) and * length et0een 1 C )&&3&


>+e-ault 1?

+ata T.pe P length et0een 1 C 1) >+e-ault ;? and


deci%als length et0een D C 31

+ata T.pe I #alue et0een C 2


31
to 2
31
C 1
or C2*1!E*!;3*)!; to 2*1!E*!;3*)!E
DATA tmp(39" TYPE >A
DATA tmp(5" TYPE P DE>IMA#S -A
DATA tmp TYPE IA
tmp E 3999999A

+ata t.pe =
&ata tmp(5" t$pe )A
tmp E B*ca8$$-3D6CA

ABAP "rror
ABAP Error
S%ntax
Error
Runtime
Error
S$stem /!ntime
Error
User /!ntime
Error
Time E,cee&
(39 Min!tes"
>annot Allocate
Space

Fser 4unti%e "rror
DATA res!lt TYPE iA
res!lt E 39 ( 9A

S.ste% 4unti%e "rror : Space Allocation

S.ste% 4unti%e "rror : Ti%e "<ceed

)on?elementar$ T$pe
)on?elementar$ T$pe
H Data Declaration
TYPES tname(39" TYPE cA
DATA@ c!stomerGname TYPE tnameF
+irstname TYPE tnameA


1al!e Assignment
1al!e Assignment
H 1al!e assignment
DATA@ name3(39"F
+irstGn!m TYPE IF
ne,tGn!m TYPE IA
MO1E B****C TO name3A
MO1E 5 TO +irstGn!mA
>OMPUTE ne,tGn!m E +irstGn!m P 5A
name3 E BSAPCA
ADD 3 TO ne,tGn!mA

1al!e Assignment
1al!e Assignment
H 1al!e assignment
DATA@ tmp3 TYPE iF
tmp- TYPE iA
tmp3 E tmp- E 39A

ABAP Practice
firstname lastname
firstname lastname !
" firstname lastname # $

Structure

Str!ct!re
Str!ct!re
H S$nta,
DATA BEGI) O= Q!tr)tre nameRA
DATA 0ie*"&.
DATA 0ie*"1.
3
3
DATA E)D O= Q!tr)tre nameRA

Str!ct!re
Str!ct!re
H S$nta,
DATA BEGI) O= waA
DATA i& #IDE c!stomers?i&.
DATA name #IDE c!stomers?name.
DATA cit$ #IDE c!stomers?cit$.
DATA E)D O= waA
MO1E 8 TO wa?i&A
%/ITE wa?i&A
i& cit$
wa
99999999
name

De+ining Str!ct!re (Incl!&e Str!ct!re"
De+ining Str!ct!re (Incl!&e Str!ct!re"
H Incl!&e Str!ct!re
DATA BEGI) O= waA
I)>#UDE ST/U>TU/E c!stomersA
DATA tel(:"A
DATA E)D O= waA

De+ining Str!ct!re
De+ining Str!ct!re
H #IDE option
DATA wa #IDE c!stomersA
wa?i& E 3A
wa?name E BLonCA
%/ITE@ wa?i&F wa?nameA

ABAP Practice
Structure myname #%& ' firstname lastname
%& ' firstname %& ' lastname
! " Structure # myname ! %& ' firstname
lastname # $

Constants

>onstants
>onstants
H >onstant varia'le
>O)STA)TS ma,Gno TYPE I 1A#UE 888A
DATA co!nter TYPE I 1A#UE ma,GnoA
%/ITE@ ma,GnoF co!nterA

>onstants Using E,ample
>onstants Using E,ample
H >onstant varia'le
>O)STA)TS cte,t(33" TYPE > 1A#UE B<ello %orl&CA
%/ITE cte,tA
%/ITE cte,tA
%/ITE cte,tA
%/ITE cte,tA
%/ITE cte,tA

S.ste% ,ields

The s.ste% -ields >structure s.st? are -illed .


the runti%e en#iron%ent5 Bou can use the%
to @uer. the s.ste% status in an ABAP
progra%

Bou should access the% onl. -or reading

s.$datu% 7 Current date o- application ser#er

s.$u(eit 7 Current ti%e o- application ser#er

s.$datlo 7 Current date o- SAP /FI

s.$ti%lo 7 Current ti%e o- SAP /FI

s.$%andt 7 Current client logon

s$?s!'rc 7 4eturn #alue o- ABAP state%ent


s%st-
datum

ABAP S.ste% ,ields : Structure SBST
>S"11?

DATE
DATE
H =i,e& #engt 7
H Incl!&e /epresentation BYYYYMMDDC
DATA to&a$ TYPE DA
to&a$ E s$?&at!mA
%/ITE to&a$A
to&a$ E B38883-33CA
%/ITE to&a$A

TIME
TIME
H =i,e& #engt 6
H =ormat B<<MMSSC
DATA times TYPE TA
times E s$?!SeitA
%/ITE timesA
<<MMSS

MO1E Statement
MO1E Statement
DATA wa #IDE c!stomersA
DATA ven&er #IDE c!stomersA
wa?i& E B3-34CA
wa?name E BTestT3CA
MO1E wa TO ven&erA
%/ITE@ wa?i&F ven&er?nameA
Iven&er E waA

MO1E?>O//ESPO)DI)G Statement
MO1E?>O//ESPO)DI)G Statement
+ATA: egin o- 0a1*
-1*-2*-!*
end o- 0a15
+ATA: egin o- 0a2*
-2*-1*-3*
end o- 0a25
3
'OA"$CO44"SPO=+I=/ 0a1 TO 0a25
84IT": 0a1$-1*0a2$-1 5

,ield$s.%ols

=iel&?s$m'ols
=iel&?s$m'ols
Data@ name(4" 1al!e BTestCF
n!m T$pe I 1al!e 39F
to&a$ T$pe D 1al!e B388794-8CA
=iel&?s$m'ols QtempRA
Assign name To QtempRA
%rite QtempRA
Assign n!m To QtempRA
%rite QtempRA
Assign to&a$ To QtempRA
%rite QtempRA

=iel&?s$m'ols @ U)ASSIG)
=iel&?s$m'ols @ U)ASSIG)
&ata@ name(4" 1al!e BTestCF
+iel&?s$m'ols QtempRA
assign name To QtempRA
write QtempRA
!nassign QtempRA

>#EA/ Statement
>#EA/ Statement


E,ample@
DATA tmp t$pe i val!e 8A
tmp E 39A
>#EA/ tmpA

Clear statement sets a field to an initial value appropriate for its type
CLEAR .data object/0

>#EA/ Str!ct!re
>#EA/ Str!ct!re


DATA wa li;e c!stomersA
2
>#EA/ waA


ABAP 4eport : Progra% Structure
4eport (test5
6+ata o1ects declaration
data 555
data egin o- 555
6Progra% Logic>+ata o1ects processing?
3
0rite 35

ABAP Practice

You might also like