You are on page 1of 57

ABAP BASICS

Intelligroup Asia Private Limited

ABAP TRAINING MATERIAL

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 1 of 57

ABAP BASICS
Intelligroup Asia Private Limited

TABLE OF CONTENTS SOME FACTS ABOUT SAP OR!ING IT" R#$ S%STEM 4 &

SAP R#$ lo'on S(reen))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))& Lo''in' Off)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))* U+in' Tran+a(tion Code))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))* Gettin' ,elp in t,e R#$ +y+te-))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))./ or0in' 1it, R#$ 2+er +e++ion+)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))).. R#$ ARC"ITECTURE ..

Client # Ser3er ar(,ite(t2re))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))).4 T,ree tier ar(,ite(t2re of R#$))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))).$ ABAP#4 5E6ELOPMENT 5ATA 5ICTIONAR% OR!BENC" .4 .&

A7o2t 5ata 5i(tionary)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))).& Ad3anta'e+)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))).& Ta7le+ in ABAP#4 di(tionary)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))).8 Creation of ta7le)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))4/ Creatin' 5o-ain))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))4/ Creatin' 5ata Ele-ent))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))4/ GENERAL INTRO5UCTION TO ABAP#4 44

C,ara(teri+ti(+ of t,e ABAP#4 pro'ra--in' lan'2a'e+)))))))))))))))))))))))))))))))))))))))))))))))))))))))))4$ REPORTS)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))44 5IALOG PROGRAMS)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))49


Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page 2 of 57

ABAP BASICS
Intelligroup Asia Private Limited

5ATA T%PES AN5 5ATA OB:ECTS

4;

5ata Type+))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))4; 5ata O7<e(t+)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))4* !ind+ of 5ata O7<e(t+))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))4* Para-eter+))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))$/ RITE STATEMENT $4

For-attin' o2tp2t))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))$$ For-attin' option+ for all data type+)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))$4 For-attin' option+ for n2-eri( field+)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))$4 BRANC"ES $&

Bran(,in' 1it, IF +tate-ent))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))$& Bran(,in' 1it, CASE +tate-ent))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))$; LOOPING $*

Loopin' 1it, 5O +tate-ent))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))$* Loopin' 1it, "ILE State-ent)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))$*

TRANSLATE (o--and)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))4. In+ert +tate-ent))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))4; Update +tate-ent)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))4; 5elete +tate-ent)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))4*

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page " of 57

ABAP BASICS
Intelligroup Asia Private Limited

So-e Fa(t+ a7o2t SAP


After t#e Internet, $AP %&" is one of t#e #ottest topi's in t#e 'omputer industr( and t#e 'ompan( t#at developed it) It is targeted to most industries, manufa'turing, retail, oil * gas, p#arma'euti'al, +an,ing, insuran'e, tele'ommuni'ation, -ransport, '#emi'al and so on) All ma.or #ard/are 0endors /ere full( engaged to partner /it# $AP1 A-*-, 2ULL, Compa3, I24, $un #ave supported and 'ertified %&" platform) $AP #as list of ma.or 'onsultants all over t#e /orld li,e Anderson Consulting, Pri'e 5ater#ouse 6 Cooper * L(+rand, 7rnst * 8oung, 9P4: and man( more) -#e 'ompan( +e#ind %&" is $AP A:, founded +( four former I24 emplo(ees in 1;72) -#e 'ompan(<s #ead3uarters are in 5alldorf, a small :erman to/n) -#e 'ompan( name, $AP stands for $8$-74$, APPLICA-I=>$ and P%=?UC-$ in data pro'essing) In 1;;2 %&" /as introdu'ed and in 1;;5 $AP A: /as ran,ed fift# among independent soft/are vendors) =ne of t#e reasons for $AP<s su''ess is t#at sin'e it is a standard pa',age, it 'an +e 'onfigured in multiple areas and adapted to spe'ifi' need of a 'ompan() -oda(, more t#an 21,!00 'ustomers in over 120 'ountries run more t#an !;,700 installations of $AP@ soft/are) 5it# su+sidiaries in more t#an 50 'ountries, t#e 'ompan( is listed on several eA'#anges, in'luding t#e Bran,furt sto', eA'#ange and >8$7 under t#e s(m+ol C$APD) $AP #as t/o main produ'ts in t#e +usiness soft/are mar,et, 4ainframe s(stem %&2 and Clientserver %&") 2ot# are targeted to +usiness appli'ation solutions) Eere % indi'ates %7AL -I47) %&2 is $AP A: mainframe soft/are t#at runs on I24, $iemens and ot#er 'ompati+le e3uipment) -#is t(pe of solution 'annot +e open, +ut /it# AL7 te'#nolog(, %&2 'an +e lin,ed /it# %&" s(stem and s#are data) -#is s(stem is mainl( targeted at enterprises /it# data-intensive and 'entraliFed industries) %&" is t#e produ't t#at #as reall( pla'ed $AP A: as t#e leader in t#e 'ountr() -#is 'ompleA Client&server s(stem is 'ore of our 'ourse) -#e glo+al a''eptan'e of %&" is not onl( +e'ause it 'aters all 'ompleA needs of +usiness +ut also t#is international a''eptan'e is +e'ause of %&"<s international appli'a+ilit() Bor $AP t#is does not mean #aving soft/are availa+le in different languages, +ut also 'overing 'urren'(, taAes, Legal pra'ti'e 'on'erning E%, Import&eAport regulations) $AP also values its 'ustomers and it is s#o/n +( t#e 'ompre#ensive set of 3ualit( servi'es put +( $AP to #elp 'ustomers during t#e pro'ess of implementing and supporting t#e %&" s(stems) -#ese servi'es in'lude produ't informationG training, installation and upgrade servi'e li,e1
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page 4 of 57

ABAP BASICS
Intelligroup Asia Private Limited

OSS= =nline $ervi'e $(stem is one of t#e primar( sour'es of servi'e and support provided +( $AP) 5it# =$$, 'ustomers 'an sear'# t#e $AP information data+ase and find solutions for errors and pro+lems /it# %&" s(stems) 8ou 'an also su+mit (our pro+lems to $AP) Con+2ltin' Ser3i(e= /it# remote 'onsulting servi'e 'ustomer re'eives immediate and updated te'#ni'al support and ans/ers to t#eir 3uestions) Maintenan(e +er3i(e= -#is is t#e +asi' and most 'ommon t(pe of support for 'ustomers in te'#ni'al support and ans/ers to t#eir 3uestions) Infor-ation Ser3i(e= -#ese are t#e various information sour'es for re'eiving detailed information a+out t#e %&" s(stem, mar,eting +ro'#ures, s(stem do'umentation, training information and man( more t#ings) Pre3enti3e +er3i(e+= -#e primar( one is t#e 7arl( 5at'# $ervi'e, /#i'# ensures su''essful and effi'ient installation of t#e %&" s(stem in all p#ases) -#is servi'e ma,es regular&performan'e '#e',s and anal(Fes t#e s(stem to identif( potential pro+lems, #elp s(stem managers and $AP administrators to tune t#e s(stem) $oon after t#e 7arl( 5at'# session, $AP sends t#e 'ustomer a report /it# t#e result of t#e anal(sis and re'ommendations for avoiding potential pro+lems su'# as data+ase +e'oming full) $o overall $AP %&" is an open 'lient&server soft/are s(stem, designed to manage +usiness information needs of an entire enterprise) -#e /#ole dataflo/ of $AP %&" /or,s in an integrated /a(, /#i'# means t#e data needs to +e entered .ust on'e and t#e s(stem automati'all( updates ot#er logi'all( related data)

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 5 of 57

ABAP BASICS
Intelligroup Asia Private Limited

OR!ING

IT" R#$ +y+te-

-#e $AP %&" presentation interfa'e +e#aves ver( similarl( to an( ot#er t(pi'al /indo/ appli'ation and is also ,no/n as $AP:UI) -#e first s'reen t#at (ou 'ome a'ross in %&" s(stem is $AP logon s'reen)

SAP R#$ lo'on S(reen


-#is is t#e first s'reen t#at appears /#en (ou use $AP logon utilit() It #as four fields1 t#e 'lient, t#e user, t#e pass/ord and t#e language)

Client= Eere (ou enter t#e 'lient num+er) -#e 'lient is group of users /#o #as similar rig#ts) It 'an +e group of users in a +usiness entit( or a /#ole +usiness entit( or a /#ole 'ompan() U+er= -#e name of t#e $AP user identifi'ation) Users of t#e $AP s(stem are 'lient-spe'ifi', /#i'# means t#at user +elonging to one 'lient is valid to onl( t#e parti'ular 'lient) Pa++1ord= It is t#e pass/ord t#at #as +een assigned +( t#e s(stem administrator) Lan'2a'e= $AP %&" s(stem supports multinational language on t#e same s(stem at t#e same time, /#i'# is ver( useful for multinational 'ompanies /it# different +ran'#es in several 'ountries and possi+l( using different languages) After entering all t#e fields press 7>-7% ,e( and s(stem /ill ta,e (ou to 4AI> 47>U s'reen)
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page ! of 57

ABAP BASICS
Intelligroup Asia Private Limited

User mig#t get different s'reens /#en #e logs on, depending upon default settings of t#e user master re'ord i)e), if user is ?707L=P7% t#en t#e s'reen /#i'# #e often /or,s on is editor s'reen and #e 'an go dire'tl( to t#is s'reen, if s(stem administrator sets t#is s'reen for t#e user) Main features of any R/3 window are as follows: %&" standard /indo/ elements +e#ave eAa'tl( t#e same, as an( ot#er standard /indo/ appli'ation /ould, li,e minimiFing a s'reen, setting t#e a'tive /indo/ et') Brom -=P to 2=--=4, %&" /indo/ 'an 'ontain t(pi'al elements su'# as '#e', +oAes, pus# +uttons, input fields and follo/ing elements1 Men2 7ar is t#e first element of t#e ever( %&" /indo/) It 'ontains t#e menu item 'orresponding to t#e parti'ular %&" appli'ation) -#e t/o menu options $8$-74 and E7LP are al/a(s present in ever( %&" /indo/) $8$-74 menu option 'ontains all utilities and fun'tions, and is availa+le to user at all t#e times) -#e E7LP menu 'ontains all t#e availa+le options for t#e different t(pes and met#ods of o+taining online #elp in t#e s(stem) Standard tool 7ar) -#e se'ond %&" /indo/ element i+ pre+ent in e3ery R#$ 1indo1) It is not#ing +ut a 'olle'tion of i'ons, /#i'# perform 'ommon fun'tions li,e saving t#e o+.e't, eAit et') -#e various i'ons on std) -ool +ar are as follo/s Hfrom left to rig#tI1 Enter Co--and Field Sa3e Ba(0 E>it Can(el Print Find Find Ne>t Fir+t Pa'e Pre3io2+ Pa'e Ne>t Pa'e La+t Pa'e "elp All i'ons in %&" /indo/ appli'ation support B=CU$ propert() It means, if (ou pla'e 'ursor over an i'on, t#e s(stem /ill s#o/ t#e fun'tion of t#e i'on) Appli(ation tool 7ar= -#e neAt part of t#e s'reen 'ontains i'ons most 'ommonl( used in t#at parti'ular tas, or transa'tion) Stat2+ 7ar is t#e +ottom line of t#e s'reen and usuall( s#o/s errors or information messages to t#e user) It also in'ludes ot#er information su'# as s(stem id, session num+er, 'lient, server name and t#e response time) In 7et1een appli(ation tool 7ar and +tat2+ 7ar yo2 ,a3e 1or0in' area? 1,i(, i+ different for different s'reens)

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 7 of 57

ABAP BASICS
Intelligroup Asia Private Limited

Lo''in' Off
User 'an log off t#e %&" s(stem from an( s'reen) -#ere are t#ree /a(s of logging off t#e %&" s(stem, /#i'# are as follo/s1

Brom t#e 4enu +ar '#oose $8$-74 L=: =BB) In t#is 'ase, (ou get t#e log off dialog +oA, /#i'# informs t#e user t#at an( data not saved /ill +e lost if 'ontinuing /it# t#e log off pro'edure) Use&>7J transa'tion 'ode in t#e 'ommand field) -#is is dangerous, sin'e it does not as, if (ou /ant to save t#e data) Cli',ing on t#e 7JI- +utton on t#e %&" initial s'reen)

U+in' Tran+a(tion Code


-#e %&" s(stem provides an alternative and effi'ient /a( of sele'ting menu options for moving around t#e tas,s and fun'tions of t#e $AP s(stem +( using transa'tion 'ode dire'tl( in t#e 'ommand field) 5#en moving /it# transa'tion, (ou 'an go to an( part of t#e s(stem +( merel( t(ping a transa'tion 'ode in t#e 'ommand field, provided (ou #ave aut#oriFation for t#at) -#at transa'tion 'ode is t#e four-'#ara'ter 'ode asso'iated /it# an( tas,) 2( t(ping t#e transa'tion 'ode and pressing 7>-7% ,e(, t#e s(stem ta,es (ou dire'tl( to t#e initial s'reen for transa'tion) 5#enever an( transa'tion 'ode is entered in t#e 'ommand field, it gets stored in t#e +uffer memor() If (ou 'li', on drop do/n arro/, s(stem displa(s list of transa'tion 'ode alread( entered and (ou 'an sele't from t#is list or enter ne/ one) -#ere are almost t/elve t#ousand and ninet( four transa'tions in $AP) Bor ever( tas,, transa'tion 'ode is asso'iated and it 'an +e found +( S%STEM STATUS $tatus /indo/ is popped up /#i'# 'ontains t#e transa'tion 'ode in t#e trans field) -#roug# 5%NAMIC MENU) It gives t#e list of tas,s) If (ou 'li', on t#e top line of t#e appli'ation areas and pressing t#e sear'# and sear'# neAt +utton /ill give (ou t#e transa'tion 'ode) #N 1ill ta0e yo2 to initial +(reen of R#$

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page K of 57

ABAP BASICS
Intelligroup Asia Private Limited

Important transa'tion 'odes, /#i'# (ou /ill +e using often, are1 Editor+ $7"7 $7"K $741 $751 $771

Bun'tion 2uilder A2AP&4 7ditor 4enu Painter $'reen Painter Borm Painter

5i(tionary $711 Initial A2AP&4 di'tionar( maintain s'reen) Bro1+er+ $7K0 =+.e't +ro/ser) $71! ?ata +ro/ser) Te+tin' Tool+ $7"0 %untime Anal(sis $-05 $LL -ra'e
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page ; of 57

ABAP BASICS
Intelligroup Asia Private Limited

Gettin' ,elp in t,e R#$ +y+te%&" in'ludes man( possi+ilities to get online #elp for almost ever( element of t#e s(stem, users 'an get #elp for entire appli'ation, for spe'ifi' fun'tion, for definitions of various terms used in $AP, i)e), :lossar(, messages, s'reens, fields et') 8ou o+tain E7LP +( using an( of t#e follo/ing options1 "elp f2n(tion from t#e %&" /indo/, /#i'# is 'ompulsor( menu item of ever( %&" /indo/) @ I(on of standard tool +ar) F. f2n(tion 0ey) -#e $AP s(stem provides #elp on most fields t#at appear on t#e %&" s(stem) -o get #elp on parti'ular field, position t#e 'ursor over it and press #elp +utton or B1 fun'tion ,e() Anot#er /a( in /#i'# %&" s(stem provides #elp is /#en s(stem displa(s error messages in t#e status +ar) ?ou+le 'li',ing on t#e status +ar s#o/s additional information a+out t#e message)

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 10 of 57

ABAP BASICS
Intelligroup Asia Private Limited

or0in' 1it, R#$ 2+er +e++ion+


A ver( important feature provided +( $AP) In %&" s(stem (ou 'an /or, /it# more t#an one tas, at an( given point of time, +( means of opening sessions) 8ou 'an 'all sessions as independent %&" /indo/ /#ere (ou 'an perform ot#er tas,s) 2( default, a user 'an open NINE sessions simultaneousl( and 'an /or, or move around /it# all sessions at t#e same time) $essions 'an +e 'losed at an( time, /it#out #aving to log off t#e s(stem) User 'an 'reate ne/ sessions from an(/#ere as C%7A-7 $7$$I=> 'omes under $8$-74 menu /#i'# is availa+le in ever( %&" /indo/)
S%STEM CREATE SESSION =r #O in (o--and field -#is /ill open a ne/ session or /indo/ and /ill pla'e it in front of all ot#er /indo/s)

-o move among sessions ust mouse 'li', on an( part of t#e %&" /indo/ to ma,e t#at session a'tive) Com+ination of AL- M -A2 ,e()

R#$ Ar(,ite(t2re
-#e overall %&" s(stem in'ludes t#e follo/ing 'omponents1 2usiness Appli'ations

2asis $(stem =r 4iddle La(er

=perating $(stem

?ata 2ase

>et/or,

-#e UPPER la(er, t#e fun'tional la(er 'ontains t#e different +usiness appli'ation) -#e integration of all appli'ation depends upon +asis s(stem) Appli'ations are developed in A2AP&4 Lang) HAdvan'ed 2usiness Appli'ation 6 t#e 4t# generation languageI

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 11 of 57

ABAP BASICS
Intelligroup Asia Private Limited

-#e %&" +asis soft/are is t#e set of programs and tools, /#i'# interfa'es /it# t#e operating, s(stem, t#e underl(ing data+ase, proto'ols and t#e presentation interfa'e) -#is la(er ena+les all t#e appli'ation to /or, eAa'tl( t#e same /a( no matter /#at operating s(stem or data+ase, t#e s(stem is installed on) It is an independent la(er and ensures t#e integration of all modules) 2esides all t#ese spe'ifi' .o+s, 2A$I$ s(stem also 'ontains follo/ing 'omponents and t#us provides more additional features) A2AP&4 development /or,+en'#, /#i'# in turn in'ludes man( features li,e repositor(, data di'tionar(, /or,+en'# organiFer, /#i'# /ill +e dis'ussed in later part of t#e topi's) A2AP&4 language, s(stem administrative tools, all t#ese 'omponents are used to 'ontrol, tune t#e %&" s(stem) $pool s(stem manages t#e formatting of data for printing and passing it to t#e #ost spool s(stem) 4ail s(stem (ou 'an send and re'eive mail from t#e outside /orld HInternetI) Communi'ation interfa'e to eAternal s(stem from %&" s(stem1 4anages 'ommuni'ation at t#e =$ level H-CP&IPI, at t#e data+ase level * +et/een appli'ations too) H%BC, 7?I, and AL7I ?ata+ase interfa'e 6 -#is 'omponent supports different %elational data+ases from different vendors) -#e main tas, of data+ase interfa'e is to 'onvert t#e $LL re3uest from t#e $AP development environment to t#e data+ase<s o/n $LL environment) 2a',ground pro'essing /it# t#is fa'ilit( (ou 'an su+mit (our program for +a',ground eAe'ution) 2A$I$ s(stem 'ontains t#e la(ered 'omponents t#at fa'ilitate t#e development of 'lient&server ar'#ite'ture)

Client # Ser3er ar(,ite(t2re


Client&$erver ar'#ite'ture is mainl( a soft/are 'on'ept t#at in'ludes a set of servi'e providers and servi'e re3uesters) -#e set of 'omputers a'ts as servi'e providers and is 'alled as server) -#e sets of soft/are 'omponent, /#i'# a't as servi'e re3uester, are 'alled as 'lient) In t#e 'lient&server ar'#ite'ture, t#e data+ase a'ts li,e a li+rar( 'ler, retrieving +oo,s from t#e s#elf) -#e user programs #ave to re3uest data+ase for t#e data instead of sear'#ing for t#e data t#emselves) -#is /a( t#ere is no ris, of t#e users putting t#e data out of order) If t#e desired data is in use, t#e data+ase ma,es t#e user /ait until it is free) -#e ma.or advantage of t#e 'lient&server ar'#ite'ture is t#at t#e server is availa+le for a num+er of 'lients and t#ere is distri+ution of /or, +et/een t#e 'lients and t#e server) -#e user dire'ts t#e re3uest to t#e 'lientG t#e 'lient in turn understands t#e user<s re3uest and redire'ts t#e re3uest to t#e server) -#e server retrieves t#e data, gives it to 'lient)
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page 12 of 57

ABAP BASICS
Intelligroup Asia Private Limited

8ou 'an #ave 'lient and server on t#e same ma'#ine or on different ma'#ines) 7a'# 'lient #as a 'orresponding pro'ess inside t#e server) =ne of t#e most used 'lient&server 'onfigurations /it# t#e %&" s(stem is t#e " tiered ar'#ite'ture, /#i'# separates a s(stem<s 'omputer into " fun'tional groups1

T,ree tier ar(,ite(t2re of R#$


?ata+ase $erver Appli'ation $erver Presentation $erver HUnli,e normal Client&server ar'#ite'ture /#ere (ou #ave onl( t/o la(ers i)e), 'lient and server)I Communi'ation among t#e " tiers is a''omplis#ed +( standard proto'ol servi'es li,e -CP&IP or CPIC HCommon Programming Interfa'e Communi'ationI) Database Server

Application Server

Application Server

Application Server

Presentation Server

Presentation Server

Presentation Server

Presentation Server

Presentation Server

Presentation Server

In a+ove 'ase data+ase server stores t#e data 'entrall() 2asi'all( 'ontains data+ase engine and asso'iated pro'esses) -#e data+ase la(ers 'ontain t#e data+ase s(stem used +( all servers) Appli'ation server 'ontains soft/are 'omponents to run t#e program) It 'ontains a $AP ,ernel, /#i'# 'an run A2AP&4 program) -#e presentation server is (our 'lient t#roug# /#i'# (ou send (our re3uest to appli'ation server) It is also 'alled as $AP grap#i'al user interfa'es ,no/n as $AP:UI and is availa+le in /indo/s ")1, 5indo/s >-, 5indo/s ;5, and 4a'intos#) -#e( all loo, similar /#atever underl(ing s(stem t#e( are running on) -#e $AP:UI in'ludes all grap#i'al 'apa+ilities of /indo/ interfa'e /it# menu +ars, tool +ars, fo'us propert(, and t#e entire mouse 'li',ing operations) Updated on - Apr 20, 2004 Proprietary & Confidential Page 1" of 57
Created on - an 01, 200!

ABAP BASICS
Intelligroup Asia Private Limited

-#e %&" s(stem is open s(stem in t#e sense t#at it 'an run on an( operating s(stem or an( data+ase and an( 'ommuni'ation te'#nolog() It means t#at1 %&" s(stem 'an run on an( operating s(stem platform su'# as U>IJ, >-, ;5, A$&400) It supports various %?24$ su'# as $LL server, =ra'le, InformiA, ?22) $tandard :UIs supported +( %&" are 5indo/s ;5, >-, 5indo/s ")1, and 4a'intos#) $AP 'an use standard 'ommuni'ation proto'ols -CP&IP, CPIC, =$B&?C7&?47 for net/or,)

ABAP#4 5e3elop-ent

or07en(,

-#e development environment of $AP %&" s(stem is full( integrated set of various development tools, data di'tionar(, and programming language) Bull integration of all 'omponents means t#at '#anges in an( part #ave a dire't and immediate effe't on all appli'ation using t#ose 'omponents) -#e s'reen of A2AP&4 development /or,+en'# loo,s li,e

Tool+ of ABAP#4 1or07en(, For pro'ra--in'=


Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page 14 of 57

ABAP BASICS
Intelligroup Asia Private Limited

A2AP&4 di'tionar( ?efining, maintaining and storing t#e data di'tionar( of t#e $AP %&" s(stem stores all t#e di'tionar( o+.e'ts in'luding ta+les relations#ip and Eelp information) -ransa'tion 'ode for t#is is $711) A2AP&4 editor Creating and maintaining t#e A2AP&4 program, editing fun'tion modules, logi'al data+ase, and s'reens) -ransa'tion 'ode is $7"K) Bun'tion li+rar( ?efining and maintaining t#e A2AP&4 fun'tion modules) -ransa'tion 'ode is $7"7) $'reen painter ?esigning and maintaining t#e s'reens in transa'tion) -ransa'tion Code is $751) 4enu painter ?esigning and maintaining t#e means for grap#i'al user interfa'e) -ransa'tion 'ode $741) For Na3i'atin'= =+.e't +ro/ser 4anaging and organiFing t#e development o+.e't in a #ierar'#i'al form) -ransa'tion 'ode is $7K0) A2AP&4 repositor( information >avigating and sear'#ing for t#e di'tionar( =+.e'ts, development o+.e'ts and relations#ip o+.e'ts) -ransa'tion 'ode $7K4) ?ata +ro/ser >avigating in t#e data ta+les of t#e data+ase) -ransa'tion 'ode is $7 1!) For 5e72''in'= $=L tra'e tra',ing t#e data+ase 'alls from t#e s(stem transa'tion and programs) -ransa'tion 'ode is $-05) ?e+ugger $topping t#e program and anal(Fing t#e results of t#e eAe'ution of ever( program statement) %untime Anal(sis Anal(Fing t#e performan'e t#e s(stem 'alls -ransa'tion 'ode is $7"0 For Or'aniAin'= 5or,+en'# organiFer 'ontrolling and ,eeping tra', of development /or, and team related development pro.e'ts and managing versions of development o+.e'ts) -ransa'tion 'ode is $70;) -ransport s(stem performing and managing t#e transport of development o+.e't a'ross different s(stem) -ransa'tion 'ode is $701

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 15 of 57

ABAP BASICS
Intelligroup Asia Private Limited

5ata 5i(tionary -#e A2AP&4di'tionar( is 'entral /or,+en'# repositor( utilit( providing t#e data definition and t#e information relations#ip t#at are later used in all t#e +usiness appli'ation /it#in %&" -#e A2AP&4 di'tionar( 'an +e seen as a logi'al representation or a superior la(er over t#e p#(si'al underl(ing data+ase) -#is data+ase must support t#e relational data model) -#is model is stri'tl( follo/ed +( data di'tionar()

A7o2t 5ata 5i(tionary


A ?ata di'tionar( in 'omputing terms is t#e +o2r(e of infor-ation in 1,i(, +y+te- data i+ defined) -#e data di'tionar( is t#e (entraliAed and +tr2(t2red +o2r(e of infor-ation for 72+ine++ appli(ation+) 8ou 'an sa( t#at it is 'ore of a /ell-stru'tured development environment) -#e elements t#at ma,e up a di'tionar( are ,no/n as metadata) Metadata i+ t,e ter- for t,e data 1,o+e f2n(tion i+ to de+(ri7e ot,er data) ?ata in di'tionar( is not t#e a'tual data li,e emp) name or emp) address +ut rat#er a t(pe of data /#ose fun'tion is to define t#e properties of t#e data su'# as t(pe, lengt#, and relations#ip)

Ad3anta'e+
Advantage of using data di'tionar( is avoiding in'onsisten'ies /#en defining data t(pe t#at /ill later +e used in different appli'ations) -#is avoids redundan'ies) 5#en a t(pe is defined in t#e di'tionar(, it is availa+le to an( program in t#e appli'ation) A '#ange in t#e definition of a t(pe of data in t#e di'tionar( automati'all( affe'ts an( ot#er data or program, /#i'# #as t#is data) Again, data di'tionar( is a fast and effi'ient /a( to ans/er 3uestions su'# as /#i'# entries eAist in a ta+le of t#e data+ase, /#at t#e stru'ture of ta+le is)

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 1! of 57

ABAP BASICS
Intelligroup Asia Private Limited

A(ti3ation of di(tionary o7<e(t+ Bor a di'tionar( o+.e't to +e effe'tive at runtime, t#at is, for a di'tionar( o+.e't to +e availa+le for use /it#in a program, transa'tion, and so on, it must +e in a'tive status) Bor o+.e'ts to +e'ome a'tive, %&" in'ludes t#e AC-I0A-I=> fun'tion) 5#en a ta+le or aggregated o+.e't is a'tivated, it is pla'ed at t#e disposal of t#e s(stem as a runtime o+.e't in a /a( t#at ma,es it availa+le 3ui',l( for t#e appli'ation program to a''ess relevant information of ne/ a'tivated o+.e'ts) 5#en a di'tionar( o+.e't is modified, t#at means t#at t#e o+.e't previousl( eAisted and a'tivated) 8ou need to rea'tivate t#e o+.e't after modifi'ation) 5#en mass a'tivation is performed massivel(, it mig#t ta,e a 3uite a long time) -#en it s#ould +e in t#e +a',ground s(stem) -#is t(pe of a'tivation is ,no/n as +a',ground a'tivation) -#e A2AP&4 ?ata di'tionar( is t#e 'entral 'omponent of A2AP&4 repositor() A ?ata di'tionar( is 'entraliFed and stru'tured sour'e of information for +usiness appli'ation) -#e A2AP&4 di'tionar( is t#e 'ore of t#e %&" development s(stem) It is t#e sour'e of ever( definition, /it#in %&", from t#e ver( +asi' domain to t#e 'ompan( data model) It is totall( integrated /it# ot#er tools of t#e development environment li,e s'reen painter, menu painter, and editor) $ome of t#e main availa+le fun'tions in t#e A2AP&4 di'tionar( are as follo/s1 Add, delete, modif(, and manage t#e definition of t#e di'tionar( data) Preserve t#e data integrit() 2e t#e 'entral sour'e of information e)g) from t#e di'tionar( (ou get t#e information a+out t#e defined relations#ip +et/een t/o ta+les or even t#e dire'tor( tells /#et#er ta+le is a'tive or empt() It also permits do'umentation of s(stem data) In t#e %&" s(stem instead of /or,ing /it# original o+.e'ts, (ou /or, /it# internal representation of o+.e'ts) 5it# t#is t(pe of operation t#e s(stem performan'e is en#an'ed and #as t#e advantage t#at t#e development tools, s'reen interpreters al/a(s a''ess 'urrent data) 5#en an( of t#e data di'tionar( o+.e'ts are used in ot#er parts of t#e development /or,+en'# for eAample, in program, programmer onl( #as to enter a ta+le name or field name) -#e s(stem automati'all( ,no/s all t#e properties and information of t#e field)

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 17 of 57

ABAP BASICS
Intelligroup Asia Private Limited

-o 'all A2AP&4 di'tionar(, from t#e main menu, Tool+ ABAP#4 1or07en(, data di(tionary or enter tran+a(tion SE..)

5ata di(tionary o7<e(t+= Ta7le= is a 2? data matriA 'ontaining ro/s and 'olumns) %o/s 'ontain data /#ile 'olumn indi'ates fields) -a+le 'an 'ontain 0 or multiple ro/s) Str2(t2re1 is a s,eletal vie/ of a ta+le) It 'ontains t#e definition of 'olumns and don<t #ave an( 'ontents) $tru'ture is generall( a template +ased on /#i'# a ta+le is 'reated) -#e +asi' differen'e +et/een stru'ture and ta+le is t#at t#e stru'ture does not eAist at t#e underl(ing data+ase s(stem level) $tru'ture eAists as definition in t#e di'tionar() 6ie1+= A vie/ is an imaginar( ta+le) It 'ontains data, /#i'# is reall( stored in ot#er ta+les) -#e 'ontents for t#e vie/ are d(nami'all( generated /#en 'alled from program) 5ata ele-ent= is definition of t#e properties and t(pe for a ta+le field) It is an intermediate o+.e't +et/een t#e o+.e't t(pe domain and t#e ta+le field) A field in %&" s(stem is al/a(s asso'iated /it# a data element, /#i'# at t#e same time is related to domain)
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page 1K of 57

ABAP BASICS
Intelligroup Asia Private Limited

5o-ain= is formal definition of t#e data t(pe from a te'#ni'al point of vie/) It sets t#e attri+utes su'# as data t(pe, lengt#, possi+le value range and so on) Lo(0 o7<e(t+= -#ese t(pes of o+.e'ts are used for lo',ing t#e a''ess to data+ase re'ords in ta+le) -#is me'#anism is used to enfor'e data integrit( t#at is t/o users 'annot update t#e same data at t#e same time) 5it# lo', o+.e'ts (ou 'an lo', ta+le-field or /#ole ta+le) Sear(, "elp O7<e(t+= , /#i'# gives list of possi+le values for eit#er primar( ,e(s or nonprimar( ,e(s)

Ta7le+ in ABAP#4 di(tionary -a+les are t#e +asi' o+.e'ts in %&" appli'ation) -#ere are almost K000 ta+les in %&" s(stem) Bollo/ing t(pes of ta+les are availa+le -ransparent ta+les Pool ta+les Cluster ta+les

Brom user point of vie/, all ta+les are used to store data /#atever +e t#e t(pe of ta+le) -#ere is no differen'e in t#e +e#avior or operation of t#ese ta+les) All of t#em 'an +e managed +( using standard =P7> $LL) Eo/ever from an administrator point of vie/ transparent ta+le do eAists /it# t#e same stru'ture +ot# in t#e di'tionar( as /ell as in t#e data+ase, eAa'tl( /it# t#e same data and fields) 5#ile ot#er t/o are not transparent in t#e sense t#at t#e( are not managea+le dire'tl( using data+ase s(stem tools) 8ou 'an a''ess t#ese ta+les in %&" environment from t#e A2AP&4 di'tionar() 8ou 'annot use native $LL on t#ese ta+les) Pool or 'luster ta+les are logi'al ta+les, /#i'# are arranged as re'ords of transparent ta+le) A ta+le is made up of ro/s and 'olumns) 5#en t#e ta+le is 'reated, its 'olumns are namedG data t(pe is supplied for ea'# 'olumn) -#ere 'an +e onl( one data value in ea'# 'olumn of ea'# ro/ in a ta+le) %e'ord or as it is 'alled in different %?24$ is not#ing +ut group of fields) 5#ile a 'olumn is a field of a ta+le, a ta+le is an indeAed file) -#e main indeA is 'alled as primar( ,e(, /#i'# 'an +e a single field or 'om+ination of ,e(s or fields) A primar( ,e( 'an +e defined as a field, /#i'# indefinites a single uni3ue re'ord of t#e ta+le) A ta+le 'annot #ave re'ord /it# dupli'ate primar( ,e() In an( %?24$, ta+les are related to ea'# ot#er) 2ut to relate ta+le to ea'# ot#er it is ne'essar( t#at one of t#e ta+les 'ontain some information of ot#er ta+le) 4ostl( ta+les are related to ea'# ot#er t#roug# primar( ,e(s) -#e primar( ,e( of one ta+le, if it eAists in ot#er ta+le t#en it is 'alled foreign ,e() -#is t(pe of data+ase management s(stem means t#at t#ere is some redundan'( of data) 2ut using normaliFation pro'edures availa+le 'an minimiFe it) =ne of t#e most important fun'tions of foreign ,e( is to ensure data integrit() Bor eAample sa( (ou #ave Updated on - Apr 20, 2004 Proprietary & Confidential Page 1; of 57
Created on - an 01, 200!

ABAP BASICS
Intelligroup Asia Private Limited

74P ta+le, /#i'# #as fields1 emp) no), emp)name, dept)'ode, salar( and (ou #ave ?7P- ta+les, /#i'# #as dept)'ode and dept)des') -#en in ?7P- ta+le dept)'ode is primar( ,e( /#ile dept)'ode in 74P ta+le is foreign ,e() If (ou enter dept)'ode for parti'ular emplo(ee in 74P ta+le t#e dept)'ode s#ould eAist in ?7P- ta+le) $(stem /ill '#e', t#e value for dept)'ode in ?7P- ta+le, and if does not eAist t#en /ill flas# error) In t#is 'ase ?7P- is 'alled '#e', ta+le /#ile 74P is foreign ,e( ta+le)

Creation of ta7le $teps to 'reate a ta+le Create domain Create data element Create a'tual ta+le

Creatin' 5o-ain ?omain as alread( eAplained defines t#e te'#ni'al properties of a field su'# as t(pe and value range) A domain 'an +e 'reated from initial s'reen of data di'tionar( +( 'li',ing on 'reate and 'li',ing domain %adio+utton) Parameters to +e passed are1 ?ata t(pe1 5#ere (ou need to enter t#e data t(pe availa+le in $AP) Bield lengt#1 Bield lengt# is t#e num+er of valid position) 0alue ta+le1 >ame of a ta+le to +e entered) -#e fields referring to t#is domain ma( onl( assume values 'ontained in t#e value ta+le) =n'e t#e domain is 'reated, save and a'tivate it, so t#at it 'an +e used for furt#er o+.e'ts H+asi' rule of di'tionar(I)

Creatin' 5ata Ele-ent -#e se'ond step of ta+le 'reation is to 'reate data element) It assigns a 'ertain meaning to t#e ta+le field, /#i'# are defined using t#at data element) A ?ata element al/a(s needs to +e defined over a domain and field is al/a(s defined over a data element) -#is allo/s all fields /it# same te'#ni'al properties to use t#e same data element) Parameters to +e passed /#en 'reating a data element1 $#ort teAt1 4andator( field)
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page 20 of 57

ABAP BASICS
Intelligroup Asia Private Limited

?omain1

A mandator( field) If t#e domain does not eAist, $AP 'an ta,e (ou dire'tl( to domain definition s'reen) -eAt element1 8ou 'an enter des'ription is s#ort or long teAt for t#e field) -#is teAt is used /#en entering data for t#ese fields) $ave and a'tivate) Creation of a(t2al ta7le Parameters to +e passed for 'reation of ta+le1 $#ort des'ription1 ?eliver( 'lass1 -a+le fields1 element) ?ata 'lass1 $iFe 'ategor(1 4andator( field) As per User %e3uirement $pe'if( /#et#er primar( ,e() In t#is 'ase it is mandator( to enter data 7sta+lis#es t#e p#(si'al area of t#e data+ase) Allo/s (ou to spe'if( estimated spa'e re3uirement for t#e ta+le)

Burt#er do/n under +uffering s3uare +oA, t#e s(stem allo/s spe'if(ing /#et#er ta+le is going to +e +uffered) 5#en a ta+le is +uffered, it is loaded into t#e ta+le +uffer from t#e appli'ation server memor( and it /ill remain t#ere until (ou s/it'# off or re+oot s(stem) If t#e ta+le is to +e +uffered, (ou need to spe'if( t#e t(pe of +uffering) Bull is for entire ta+le /#ile partial is for onl( t#ose re'ords /#i'# are +eing a''essed) =n'e t#e ta+le is 'reated, it #as to +e generated or a'tivated to +e a+le to a''ess +( ot#er o+.e'ts li,e programs)

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 21 of 57

ABAP BASICS
Intelligroup Asia Private Limited

General Introd2(tion to ABAP#4 $AP originall( developed t#e programming language A2AP&4 HAdvan'ed 2usiness Appli'ation ProgrammingI for internal use to provide +est /or,ing 'onditions for developers) $AP 'onstantl( improves t#e language to adapt to t#e in'reasing re3uirements of t#e +usiness appli'ations) At present, A2AP&4 is t#e onl( tool for developing appli'ations at $AP) $AP 'ustomers use A2AP&4 for t#eir o/n developments) -#e A2AP&4 ?evelopment 5or,+en'# 'ontains all tools (ou need to 'reate and maintain A2AP&4 programs) A2AP&4 programs are not 'omplied +ut generated) ?uring generation, t#e s(stem 'reates a so-'alled runtime o+.e't from t#e sour'e 'ode and t#e program attri+utes) 5#en (ou start t#e program, t#e s(stem eAe'utes t#e runtime o+.e't) A2AP&4, a fourt# generation language, 'ontains all usual 'ontrol stru'tures and modulariFing 'on'epts for stru'tured programming) -#e t#ree parts of t#e A2AP&4 language are1 $tru'ture and eAe'ution of A2AP&4 programs 2asi' language elements Programming reports Programming dialogs Structure and execution of ABAP/4 programs are essentiall( different from entirel( se3uential programming languages su'# as B=%-%A>, PA$CAL, or C) A2AP&4 instead s#ares 'ertain similarities /it# modular, event-orient programming languages su'# as 0isual 2asi' or A0A) -#e t/o most important statements 'on'erning stru'ture and eAe'ution are1 An A2AP&4 program #as a modular stru'ture) Bor eAe'ution, (ou need a spe'ial runtime environment) -#is means, t#at A2AP&4 sour'e teAts al/a(s 'onsist of a 'olle'tion of program modules Hone single module in t#e easiest 'aseI or t#e se3uential set of statements) -#e individual program modules 'onsist of se3uential elements) -#e set of statements of a program module is also 'alled pro'essing +lo',) -#e runtime environment is responsi+le for 'alling t#e individual program modules one after t#e ot#er) -#e runtime environment is t#e ABAP/4 processor, /#i'# 'an 'ommuni'ate /it# t e list processor or t e dialog processor, depending on t#e program t(pe) Program flo/ /it#in t#e individual pro'essing +lo',s is se3uential, as (ou ,no/ it from ot#er se3uential programming languages Hfor eAample, B=%-%A>, PA$CAL and CI) 5it#in t#e pro'essing +lo',s, (ou 'an use t#e general 'ontrol statements for t#e program flo/, su'# as IB, ?=7$, 5EIL7, A2AP&4 does not 'ontain :=-= elements)
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page 22 of 57

ABAP BASICS
Intelligroup Asia Private Limited

5e mainl( use programs t#at 'onsist of a single pro'essing +lo', onl( and, t#erefore, +e#ave most li,el( li,e programs of ot#er se3uential programming languages) Bor programming appli'ations, t#e entirel( se3uential 'on'ept is not suffi'ient) $AP distinguis#es +et/een t/o general t(pes of appli'ation programs1 Report+= 8ou use reports to read data+ases and represent t#e results in lists) %eports are 'olle'tions of pro'essing +lo',s t#at t#e s(stem 'alls depending on events) 5ialo' pro'ra-+= 8ou 'an dialog programs to eAe'ute transa'tions, /#i'# usuall( read and '#ange data+ases) ?ialog programs are 'olle'tions of pro'essing +lo',s Hso-'alled module poolsI t#at are 'alled +( a s'reen flo/ logi') -#e t#ird part of t#e User<s :uide des'ri+es dialog programming in detail) Report+ (an (all dialo' pro'ra-+ and 3i(e 3er+a) In its easiest version, an A2AP&4 program 'ontains one single se3uential pie'e of 'oding and, t#us, one single pro'essing +lo',) C,ara(teri+ti(+ of t,e ABAP#4 pro'ra--in' lan'2a'e+ ?e'larative elements for de'laring data of different t(pe and stru'tures) =perational elements for manipulating data) Control elements to 'ontrol pro'essing flo/) A2AP&4 is multi-lingual) -eAt elements su'# as titles, #eadings, and teAt +od( are stored separatel(, independent of t#e program 'odes) -#us, (ou 'an '#ange, translate, and maintain teAt elements /it#out #aving no adapt t#e 'oding) A2AP&4 supports +usiness-related data t(pes and operations) 8ou 'an eAe'ute 'al'ulations using spe'ial data and time fields) -#e s(stem automati'all( eAe'utes all ne'essar( t(pe 'onversions) A2AP&4 provides a num+er of fun'tions for pro'essing '#ara'ter strings) A2AP&4 allo/s (ou to define and 'all su+routines) 8ou 'an even 'all su+routines of ot#er programs) -#ere are different /a(s of #o/ to pass parameters to and from t#e $u+routines) A2AP&4 'ontains a spe'ial t(pe of su+routine, 'alled fun'tion module) Bun'tion modules are stored and maintained in a 'entral li+rar() -#e( #ave 'learl( defined data interfa'es to t#e 'alling program) 8ou 'an test fun'tion modules in a stand-alone mode independent of t#e 'alling program) A2AP&4 'ontains an $LL su+set 'alled =P7> $LL) =P7> $LL allo/s (ou to read and '#ange data+ase ta+les independent of t#e underl(ing data+ase s(stem) A2AP&4 allo/s (ou to define and pro'ess internal ta+les t#at eAist onl( for t#e eAe'ution period of t#e program) Internal ta+les effi'ientl( support t#e usage of data+ase ta+les and allo/ (ou to implement 'ompleA data stru'tures in a program)
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page 2" of 57

ABAP BASICS
Intelligroup Asia Private Limited

A2AP&4 allo/s (ou to store data not onl( in data+ases +ut also as se3uential files on appli'ation and presentation servers)

REPORTS %eports are A2AP&4 programs) 8ou use reports to evaluation data from data+ase ta+les) -#e results of su'# an evaluation 'an +e displa(ed on t#e s'reen or printed form) %eports are stand-alone programs) -#e user 'an eAe'ute reports dire'tl( via t#e program name, for eAample, +( '#oosing $(stem @ Utilities @ %eporting) A report program 'ontains a 'olle'tion of pro'essing +lo',s for different events t#at are al/a(s triggered eAternall() In a report, (ou 'an rea't on events +( programming t#e 'orresponding pro'essing +lo',s or ignore t#e events +( not /riting t#e 'orresponding pro'essing +lo',s) A report itself never 'reates events) %eports 'an use logi'al data+ases or sele't statements defined +( developer) Bor ea'# appli'ation, $AP supplies logi'al data+ases) =r (ou 'an easil( 'reate logi'al data+ase (ourself) 7vent 'ontrol of a report 'orresponds to a 'ertain s'#eme1 5#en a report is eAe'uted, t#e A2AP&4 pro'essor 'reates toget#er /it# t#e logi'al data+ase used Hif an(I a se3uen'e of 'ertain events for /#i'# (ou 'an program pro'essing +lo',s) -#e '#ronolog( of t#e events is Hmore or lessI $teps involved in 'reating a %eport1 .) Pro(e++in' t,e +ele(tion +(reen After starting a report, t#e sele'tion s'reen allo/s t#e user to enter limits or 'ontrol values for furt#er report pro'essing) -#e report 'an 'ontain several pro'essing +lo',s for events during sele'tion s'reen pro'essing, for eAample, for '#e',ing t#e input values) 4) Readin' t,e data7a+e After sele'tion s'reen pro'essing 'ome t#e events for reading t#e data+ase) 7it#er t#e report reads data from relational data+ases it using t#e 'orresponding A2AP&4 statements Hopen $LLI or leaves t#is tas, to a logi'al data+ase) In t#e latter 'ase, t#e logi'al data+ase 'reates a se3uen'e of events to allo/ t#e report to 'op( t#e data) $) E3al2atin' data and (reatin' li+t+ ?uring or after reading t#e data+ase t#e report 'reates t#e output list) ?uring list 'reation, several events allo/ (ou to la(out t#e output list Hfor eAample, la(out t#e page #eaderI) 4) O2tp2ttin' a li+t
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page 24 of 57

ABAP BASICS
Intelligroup Asia Private Limited

-#e last part of t#e pro'essing se3uen'e 'ontrolled +( t#e A2AP&4 pro'essor is t#e list output on t#e s'reen or printer) 5#en displa(ing t#e list on t#e s'reen, user 'an trigger ot#er reports, t#at are intera'tive and are event driven) Bor eAample, +( 'li',ing t#e mouse) 2( programming pro'essing +lo',s for t#ese events, (ou '#ange a normal report to a so-'alled Intera(ti3e report) If a report does not 'ontain event ,e(/ords, t#e entire 'oding of t#e report +elongs to a single pro'essing +lo',, /#i'# is 'alled +( a standard event) -#is standard event is triggered dire'tl( after pro'essing t#e sele'tion s'reen)

5IALOG PROGRAMS 8ou use dialog programs to eAe'ute transa'tions) -#e users of dialog programs in dialog sessions read and '#ange data+ase ta+les) Apart from t#e a'tual data pro'essing H=pen $LLI, update and en3ueue 'on'epts are of great importan'e /#en programming dialogs) ?ialog programs are not stand- alone -o eAe'ute dialog programs, t#e( must +e lin,ed to at least one s'reen t#at itself is lin,ed to a transa'tion 'ode) -#e transa'tion 'ode determines t#e initial s'reen /it# /#i'# t#e dialog session starts) ?ialog programs are 'ontrolled +( s'reen flo/ logi' -#e a'tual A2AP&4 dialog program is a so-'alled module pool) A module pool 'ontains a 'olle'tion of dialog modules t#at are 'alled +( t#e s'reen flo/ logi') -o ea'# module pool, at least one, +ut usuall( several s'reens are allo'ated) 7a'# s'reen #as flo/ logi') -#e flo/ logi' 'onsists of P2= Hpro'ess 2efore outputI and PAI Hpro'ess After InputI +lo',s) -#is flo/ logi' does not use t#e A2AP&4 programming language and t#e A2AP&4 7ditor tool, +ut a spe'ial statement set and t#e $'reen Painter tool, /#i'# (ou also use to la(out s'reens) -#e flo/ logi' mainl( 'ontains t#e '#ronologi'all( ordered 'alls of t#e modules in t#e 'orresponding module pool) ! e collection of PB" flow logic, screen, and PA# flow logic is called $ynamic program %$ynpro&) A module pool must #ave at least one d(npro) 7a'# s'reen of a dialog session t#us is t#e visi+le part of a d(npro, to /#i'# also t#e flo/ logi' +elongs) -#e pro'essing logi' of a dialog session is stored in t#e 'orresponding module pool in t#e form of A2AP&4 modules) -#e A2AP&4 modules in t#e module pool are separated into P2= and PAI modules) -#e P2= or PAI +lo',s of t#e flo/ logi' of ea'# d(npro of a module pool 'an 'all ea'# P2= or PAI module of t#is module pool) 8ou 'an use A2AP&4 statements in t#e pro'essing logi' of t#e module pool to 'ontrol t#e '#ronolog( of t#e different d(npros) After starting a dialog session via t#e transa'tion 'ode, /#i'# is firml( 'onne'ted to a d(npro of t#e module pool, t#e s'reen flo/ logi' passes user entries to t#e pro'essing logi' in t#e A2AP&4 module pool) -#e pro'essing logi' pro'esses
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page 25 of 57

ABAP BASICS
Intelligroup Asia Private Limited

t#e user entries Hdata+ase a''essesI and, if re3uired, defines t#e appropriate su+se3uent s'reens)

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 2! of 57

ABAP BASICS
Intelligroup Asia Private Limited

5ata Type+ and 5ata O7<e(t+ ?ata t(pes and data o+.e'ts are essential 'omponents of t#e A2AP&4 t(pe 'on'epts) 2ot# 'an +e de'lared and maintained +( user) Unli,e ot#er programming languages in A2AP&4 (ou 'an 'reate ?A-A -8P7$ independentl() 5ata Type+ Are pure des'riptions >o memor( is asso'iated /it# data t(pes) ?es'ri+es t#e te'#ni'al properties of data o+.e'ts) $tru'ture and definition 'lassif( data t(pes) Can +e of1 1) 7lementar( or stru'tured 2) Predefined or user defined Predefined 7L747>-A%8 C, ?, B, I, >, P, -, J U+erBdefined 2ased upon elementar( ?ata t(pes) 7)g), -8P7$1 num+er t(pes I) Can<t allo'ate memor( to t(pes) User defined stru'tured t(pes are Bield $tring and internal ta+les)

8ou 'an use dire'tl(

$-%UC-U%7?

Predefined t(pes are -A2L7$

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 27 of 57

ABAP BASICS
Intelligroup Asia Private Limited

5ata O7<e(t+ ?ata o+.e'ts are units 'reated during runtime) ?ata o+.e't 'annot eAist /it#out data t(pe) =''upies memor( spa'e) !ind+ of 5ata O7<e(t+ .) INTERNAL 5ATA OB:ECTS

Literal A literal #as a fiAed value) 7A 5%I-71 C5=%9 EA%?D 6aria7le+ ?A-A statement is used to 'reate varia+les 7A ?A-A1 >U4 -8P7 I >U4 is a varia+le de'lared +( ?A-A statement) An( varia+le, /#i'# (ou use in program, need to +e de'lared +efore (ou use it and 'an +e done +( ?A-A statement) Eere varia+le is de'lared +( referring to eAisting data t(pe) 0aria+le 'an also +e de'lared +( referring eAisting data o+.e't) 7A) 5e #ave alread( de'lared >U4 +( ?A-A statement) ?A-A1 P%IC7 LI97 >U4) Eere varia+le is de'lared +( using LI97 parameter, /#i'# tells s(stem t#at pri'e #as all t#e attri+utes of data o+.e't >U4 i)e), P%IC7 is also of t(pe I) -#e main differen'e +et/een -8P7 and LI97 parameter /#en defining or de'laring t#e o+.e't is t#at -8P7 is used to refer eAisting ?A-A -8P7 Helementar( or stru'tured or user definedI /#ile LI97 is used to de'lare data o+.e'ts /it# referen'e to eAisting ?A-A =2 7C-$) Con+tant Constant is a data o+.e't, /#i'# 'ontains fiAed value t#roug# out t#e program) Constant 'an +e de'lared in program +( using C=>$-A>- statement) 7A) C=>$-A>-1 I>- -8P7 I 0ALU7 15)
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page 2K of 57

ABAP BASICS
Intelligroup Asia Private Limited

In program value of I>- 'annot +e '#anged) If (ou give a statement li,e I>- N 20) In t#is 'ase s(stem /ill give error) 4) ECTERNAL 5ATA OB:ECTS Are defined in ta+les i)e), in A2AP&4 di'tionar() 8ou 'an a''ess t#is data from ta+le) -A2L7$1 $BLI:E?A-A1 $7A-$ LI97 $BLI:E--$7A-$4AJ) $) S%STEMB5EFINE5 5ATA OB:ECTS $PAC7 * $8$-74 0A%IA2L7$ li,e s(-uname, s(-datum, * s(-repid) 4) SPECIAL 5ATA OB:ECTS PA%A47-7%$1 are varia+le, /#i'# 'an a''ept value from user) $7L7C-I=>$ C%I-7%IA1 are spe'ial internal ta+les to a''ept value range from user)

Need for 5ata type+= Consider t#e follo/ing eAample) ?A-A1 fnameH20I, mnameH20I, lnameH20I, add1H20I, add2H20I, add"H20I) If (ou #ave ?A-A statement li,e a+ove, and if (ou need to '#ange t#e lengt# of all t#e fields sa( from 20 to 25, t#en (ou need to '#ange all t#e fields i)e), going t#roug# ea'# and ever( statement) 2ut 'onsider t#e follo/ing 'ase /#ere -8P7$ #as +een used) -8P7$1strH20I ?A-A1fname t(pe str,
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page 2; of 57

ABAP BASICS
Intelligroup Asia Private Limited

4name t(pe str, Lname t(pe str, Add1 t(pe str, Add2 t(pe str, Add" t(pe str) In t#is 'ase if (ou need to '#ange t#e lengt# of all fields from 20 to 25) -#en .ust '#ange t#e lengt# of $-% and '#ange /ill +e refle'ted for all t#e fields) If (ou define all t#e t(pes in -8P7-P==L i)e), glo+al definition of all t#e t(pes, (ou 'an use t#ese t(pes an(/#ere and in an( program)

Para-eter+
Parameter statement is used to a''ept input from user) PA%A47-7% statement is used /#en (ou /ant user to enter data and depending upon /#at #e enters (ou need to ta,e a'tion) -#e parameter statement de'lares t#e varia+le and also allo/s s(stem to a''ept data into t#at varia+le) $(ntaA) Parameters1 num t(pe I) Eere parameter statement de'lares t#e varia+le and 'reates t#e sele'tion s'reen on /#i'# user enters t#e data i)e), in t#is 'ase num is de'lared of t(pe I and user 'an enter an( num+er) 7ntered value is stored in t#e same varia+le and 'an +e used in program) ?ata1 m t(pe I Parameters1 num t(pe I 4 N num 6 5 5rite1 & O-#e num+er is<, m) 8ou 'an define default values /it# parameter statement for eAample Parameter1 num t(pe I default 12) In t#is 'ase /#en sele'tion s'reen is displa(ed t#e default value is displa(ed) User 'an eit#er use same value or over/rite t#e value) Parameter of t(pe '#ara'ter and lengt# N 1, 'an +e displa(ed as C#e',+oA and %adio+utton) Parameter1 C1 as C#e',+oA, C2 as C#e',+oA) Parameter1 %1 %adio+utton group g1, %2 %adio+utton group g1) 5#en parameter is defined as %adio+utton, it needs to +e atta'#ed to one group) =nl( one %adio+utton of one group 'an +e 'li',ed)
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page "0 of 57

ABAP BASICS
Intelligroup Asia Private Limited

7ver( parameter 'an +e asso'iated /it# language dependent teAt t#at is displa(ed on t#e sele'tion s'reen) -#is 'an +e done /it# t#e #elp of teAt elements)

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page "1 of 57

ABAP BASICS
Intelligroup Asia Private Limited

RITE State-ent -#e +asi' APA2&4 statement for outputting data on t#e s'reen is 5%I-7) $(ntaA1 5%I-7 PfieldQ PoptionQ) -#is statement outputs t#e field PfQ to t#e 'urrent list in its standard output format) 2( default, t#e list is displa(ed on t#e s'reen) -#e field PfieldQ'an +e an( varia+le or ta+le field or .ust literal) P%=:%A4 R?74= 5%I-71 &OE7LL=<) 5#en (ou start t#is program, t#e s(stem leaves t#e 'urrent s'reen i)e), (our editor s'reen and +ran'#es to t#e output s'reen, /#i'# is also 'alled as list s'reen1 -#e list s'reen #as t#e same name as t#e title of t#e program spe'ified in t#e program attri+utes) Birst line on t#e s'reen 'ontains t#e list #eader) 2( default, t#e list #eader is t#e same as t#e title of t#e program) -#e 'urrent page num+er H1I appears on t#e rig#t) -#e list #eader is follo/ed +( one line and t#en t#e output is displa(ed) 5rite 1 OE7LL=<) 5rite 1 O5=%9 EA%?< =n t#e s'reen, t#e output is normall( left .ustified) 2ut in a+ove 'ase, +e'ause /e #ave used t/o 5%I-7 statements, t#e output fields are displa(ed one after t#e ot#er, ea'# separated +( one 'olumn Hi)e), one +lan,I) If t#ere is not enoug# spa'e for an output field on t#e 'urrent line, a ne/ line is started) Almost all s(stem-defined fields are rig#t .ustified eA'ept BL=A-, I>-7:7%, and PAC97? i)e), num+er field) -#e numeri' data t(pes B, P, and I are rig#t .ustified and padded /it# +lan,s on t#e left) If t#ere is suffi'ient spa'e, t#ousands of separators are also output) If a t(pe P field 'ontains de'imal pla'es, t#e default output lengt# is in'reased +( one) 5it# t#e data t(pe ?, t#e internal format of a date differs from its output format) 5#en (ou use t#e 5%I-7 statement for outputting data, t#e s(stem automati'all( outputs dates of t(pe ? in t#e format spe'ified in t#e user<s master re'ord He)g) ??&44&8888 or 44&??&8888I)

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page "2 of 57

ABAP BASICS
Intelligroup Asia Private Limited

For-attin' o2tp2t 8ou 'an position t#e output of a 5%I-7 statement on t#e s'reen +( ma,ing a format spe'ifi'ation +efore t#e field name as follo/s1 $(ntaA1 5%I-7 A- S&TSPposQTSHPlenQIT PfQ, 5#ere Ot#e slas#<&O denotes a ne/ line, PposQ is a num+er or varia+le denoting t#e position on t#e s'reen, PlenQ is a num+er or varia+le long denoting t#e output lengt#)

Bor varia+les (ou need to mention t#e A-, for dire't values it is not ne'essar() ?A-A1 L7> -8P7 I 0ALU7 10, P=$ -8P7 I 0ALU7 11, -7J- H10I 0ALU7 O12"45!7K;0< 5%I-7 A- P=$ HL7>I -7J-) -#is produ'es t#e follo/ing output on t#e s'reenG -#e teAt 6 12"45!7K;0 6 appears in t#e teAt) If t#e output lengt# PlenQ is too s#ort, fe/er '#ara'ters are displa(ed) >umeri' fields are trun'ated on t#e left and prefiAed /it# an asteris, HUI) All ot#er fields are trun'ated on t#e rig#t, +ut no indi'ation is given t#at t#e field is s#orter) ?A-A1 >U427% -8P7 I 0ALU7 12"45!7K;0, -7J- H10I 0ALU7 Oa+'defg#i.<) 5%I-71 H5I >U427%, &H5I -7J-) -#is produ'es t#e follo/ing output1 7K;0 a+'de In t#e default setting, (ou 'annot 'reate empt( lines /it# t#e 5%I-7 statement) 5%I-71 O=ne<, &O <, & O-/o<
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page "" of 57

ABAP BASICS
Intelligroup Asia Private Limited

-#e output loo,s as follo/s1 =ne -/o -#e s(stem suppresses lines t#at 'ontain not#ing +ut empt( spa'es) 8ou 'an use various formatting options /it# t#e 5%I-7 statement) $(ntaA 5%I-7VVVV PfieldQ PoptionQ For-attin' option+ for all data type+ "ption L7B-- U$-IBI7? C7>-7%7? %I:E-- U$-IBI7? >=-:AP >=-R7%= Purpose =utput is left .ustified) =utput is 'entered) =utput is rig#t .ustified) -#e +lan, after t#e field PfQ is omitted) If a field 'ontains onl( Feros, t#ese are repla'ed +( +lan,s) Bor t(pe C and > fields, leading Feros are repla'ed automati'all()

For-attin' option+ for n2-eri( field+ Option >=-$I:> ?7CI4AL$ PdQ 7JP=>7>- PeQ %=U>? PrQ CU%%7>C8 P'Q U>I- PuQ P2rpo+e -#e leading sign is not output) PdQ defines t#e num+er of digits after t#e de'imal point) In t(pe B fields, t#e eAponent is defined in PeQ -(pe P fields are multiplied +( 10UUH-rI and t#en rounded Bormat a''ording to 'urren'( P'Q in ta+le -CU%J) -#e num+er of de'imal pla'es is fiAed a''ording to t#e unit PuQ spe'ified in ta+le -00! for t(pe P fields)
Proprietary & Confidential

Updated on - Apr 20, 2004 Created on - an 01, 200!

Page "4 of 57

ABAP BASICS
Intelligroup Asia Private Limited

"oriAontal line+ 8ou 'an generate #oriFontal lines on t#e output s'reen +( using t#e follo/ing s(ntaA1 $(ntaA ULI>7 5ill dra/ a #oriFontal line) ULI>7 H10I 5ill start dra/ing #oriFontal line from 10t# 'olumn position) 5%I-7 at 10H40I $8-ULI>7 -#is statement dra/s a #oriFontal line from 10t# position) 6erti(al line+ 8ou generate verti'al lines one t#e output s'reen +( using t#e follo/ing s(ntaA1 $(ntaA 5%I-7 SA- S&T SPposQTT $8-0LI>7) Blan0 line+ 8ou 'an generate +lan, lines on t#e s'reen +( using t#e follo/ing s(ntaA 1 $(ntaA $9IP SPnum+erQT $tarting on t#e 'urrent line, t#is statement generates Pnum+erQ +lan, lines on t#e output s'reen) If no value is spe'ified for Pnum+erQ, one +lan, line is output) In t#e standard setting, (ou 'annot 'reate empt( lines /it# t#e 5%I-7 statement alone) -o position t#e output on a spe'ifi' line on t#e s'reen use1 $(ntaA $9IP -= LI>7 Pnum+erQ -#is statement allo/s (ou to move t#e output position up/ards or do/n/ards)

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page "5 of 57

ABAP BASICS
Intelligroup Asia Private Limited

Bran(,e+ Li,e ot#er #ig#er programming languages, A2AP&4 provides standard ,e(/ords to 'ontrol t#e flo/ of a program) Usuall( A2AP&4 programs get eAe'uted statement +( statement) 4an( times (ou need to s,ip fe/ statements depending upon 'ertain 'onditions i)e), (ou '#ange t#e flo/ of program) -#is 'an +e done +(1 7ran(,in' DIF? CASEE loopin' D5O? "ILEE Eo/ever, unli,e ot#er language /#ere (ou #ave onl( internal 'ontrol, ABAP#4 ,a+ internal (ontrol and e>ternal (ontrol of t,e pro'ra- flo1) -#e internal (ontrol is steered +( standard ,e(/ords as mentioned a+ove) 8ou define t#is in (our program 'ode) -#e e>ternal (ontrol is stored +( events) 7vents are generated eit#er from ot#er A2AP&4 programs or from intera'tive user input Hli,e, for eAample, using t#e mouse to 'li', on t#e s'reenI) -#e s(stem does not ne'essaril( pro'ess t#e statements in t#e same se3uen'e as t#e( are listed in an A2AP&4 program) -#is ma,es A2AP&4 an event-driven programming language) -#e eAternal 'ontrol pla(s an important role mainl( for report programs)

Bran(,in' 1it, IF +tate-ent


-#e IB statement allo/s (ou to di3ert t,e pro'ra- flo1 to a parti(2lar +tate-ent +lo',, depending on a 'ondition) -#is statement +lo', 'onsists of all t#e 'ommands /#i'# o''ur +et/een an IB statement and t#e neAt 7L$7IB, 7L$7, or 7>?IB statement) $(ntaA IBP'ondition1Q Pstatement +lo',Q 7L$7 Pstatement +lo',Q 7>?IB If t#e first 'ondition is true, t#e s(stem eAe'utes all t#e statements up to t#e end of t#e first statement +lo', and t#en 'ontinues pro'essing after t#e 7>?IB statement)

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page "! of 57

ABAP BASICS
Intelligroup Asia Private Limited

-o introdu'e alternative 'onditions, (ou 'an use 7L$7IB statements) If t#e first 'ondition is false, t#e s(stem pro'esses t#e follo/ing 7L$7IB statement in t#e same /a( as t#e IB statement) 7L$7 +egins a statement +lo', /#i'# is pro'essed if none of t#e IB and 7L$7IB 'onditions is true) -#e end of t#e last statement +lo', must al/a(s +e 'on'luded /it# 7>?IB) IB P'ondition1Q) Pstatement +lo',Q 7L$7IB P'ondition2Q) Pstatement +lo',Q 7L$7IB P'ondition"Q) Pstatement +lo',Q 7L$7) Pstatement +lo',Q 7>?IB) A2AP&4 allo/s unlimited nesting of IB 6 7>?IB statement +lo',s, +ut t#e( must terminate /it#in t#e same pro'essing +lo',) In ot#er /ords, an IB 6 7>?IB +lo', 'annot 'ontain an event ,e(/ord) Bran(,in' 1it, CASE +tate-ent -o eAe'ute different statement +lo',s depending on t#e 'ontents of parti'ular data fields, (ou 'an eit#er use IB statement or t#e CA$7 statement as follo/s1 $(ntaA CA$7 PfQ) 5E7> Pf1Q) Pstatement +lo',Q 5E7> Pf2Q) Pstatement +lo',Q 5E7> Pf"Q) Pstatement +lo',Q 5E7> =-E7%$) Pstatement +lo',Q 7>?CA$7) -#e s(stem eAe'utes t#e statement +lo', after t#e 5E7> statement if t#e 'ontents of PfQ e3uals t#e 'ontents of PfiQ, and 'ontinues pro'essing after t#e 7>?CA$7 statement) -#e statement +lo', after t#e optional 5E7> =-E7%$ statement is eAe'uted if t#e 'ontents of PfQ do not e3ual an( of t#e PfiQ 'ontents) -#e last statement +lo', must +e 'on'luded /it# 7>?CA$7) -#e 'onditional +ran'#ing using CA$7 is a s#orter and simpler form of similar pro'essing /it# IB) 5#en (ou #ave man( 'onditions IB +e'omes more 'ompli'ated in su'# 'ases CA$7 is used) Updated on - Apr 20, 2004 Proprietary & Confidential Page "7 of 57
Created on - an 01, 200!

ABAP BASICS
Intelligroup Asia Private Limited

LOOPING Loopin' 1it, 5O +tate-ent


If (ou /ant to /rite (our name sa( for 10 times, (ou need to /rite 5%I-7 statement for 10 times) 5#en (ou /ant to pro'ess a statement more t#an on'e, (ou 'an /rite t#is statement /it#in a loop /it# t#e ?= statement as follo/s1 $(ntaA ?= 5 times) 5rite 1 & name) 7>??=) -#e s(stem 'ontinues pro'essing t#e statement +lo', for 5 times introdu'ed +( ?= and 'on'luded +( 7>??=) -#e s(stem field $8-I>?7J 'ontains t#e num+er of times t#e loop #as +een pro'essed so in t#is 'ase /#en t#e loop is over value of s(-indeA /ill +e 5) In t#is 'ase (ou ,no/ t#at, (ou /ant to perform 5%I-7 statement for 5 times) 2ut t#at is not t#e 'ase al/a(s) 4an( times (ou need to terminate t#e loop depending upon 'ertain 'onditions) -#is 'an +e done, +( using ECIT or STOP statement) -#e important point to remem+er /#en (ou don<t (ou use -I47$ option, is to avoid endless loops /#en /or,ing /it# t#e ?= statement) If (ou do not use t#e -I47$ option, in'lude at least one 7JI-, $-=P statement so t#at t#e s(stem 'an leave t#e loop) 7JI- and $-=P ta,es (ou out of t#at loop) Loopin' 1it, "ILE State-ent

If (ou /ant to pro'ess a statement +lo', more t#an on'e as long as a 'ondition is true, (ou 'an program a loop /it# t#e 5EIL7 statement as follo/s1 $(ntaA ?A-A1 4 -8P7 I 0ALU7 0) 5EIL7 4 P 10) 5%I-71 & 4) 4 N 4 M 1)
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page "K of 57

ABAP BASICS
Intelligroup Asia Private Limited

7>?5EIL7) -#e s(stem 'ontinues pro'essing t#e statement +lo', introdu'ed +( 5EIL7 and 'on'luded +( 7>?5EIL7 statements as long as 4 is less t#an 10 or until t#e s(stem finds an 7JI-, $-=P) -#e s(stem field S%BIN5EC 'ontains t#e num+er of times t#e loop #as +een pro'essed) 8ou 'an nest 5EIL7 loops an( num+er of times and also 'om+ine t#em /it# ot#er loops) 5ifferen(e 7et1een 5O loop and "ILE is t#at in 5EIL7, 'ondition is '#e',ed first and if 'ondition is true t#en loop is eAe'uted /#ile in ?= loop, t#e loop gets eAe'uted first if (ou don<t #ave -I47$ option and t#en t#e 'ondition is '#e',ed Hif (ou #ave an(I) 8ou 'an #ave nested ?= and 5EIL7 or ?= and IB or IB and IB or an( possi+le situation)

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page "; of 57

ABAP BASICS
Intelligroup Asia Private Limited

Strin' Operation+ A2AP&4 provides several ,e(/ords for pro'essing data o+.e'ts of t(pe C, also ,no/n as '#ara'ter strings) S,ift (o--and -o s#ift t#e 'ontents of a field, +( one position or one '#ara'ter (ou 'an use t#e $EIBstatement) Using $EIB- allo/s (ou to s#ift field 'ontents, +(te-+(-+(te or '#ara'ter-+('#ara'ter) 5it# t#e $EIB- statement, (ou 'an eAe'ute t#e follo/ing1 $tring N OE7LL=<) $tring 1 N OALL =B 8=U<) $tring 2 N O5=%9 EA%?<) $#ift string $#ift string1 +( 2 pla'es) $#ift string2 rig#t) $#ift string1 +( 2 pla'es 'ir'ular) -#e output /ill +e 7LL= 6 2( default if not#ing is spe'ified t#en string is s#ifted +( one position) L =B 8=U 6 Eere t#e string is s#ifted +( 2 pla'es) W5=%9 EA%? 6 In t#is 'ase t#e string is s#ifted to rig#t +( one pla'e H/it# leading +lan,sI 9 EA%?5=% 6 In t#is 'ase t#e string is s#ifted to t#e left so t#at " '#ara'ters on t#e left appear on t#e rig#t) Repla(e (o--and 8ou use t#e %7PLAC7 statement) $(ntaA %7PLAC7PstrlQ5I-EPstr2QI>-=P'QSL7>:-EP1QT) A2AP&4 sear'#es t#e field P'Q for t#e first o''urren'e of t#e first, P1Q positions of t#e pattern Pstr1Q) If no lengt# is spe'ified, it sear'#es for t#e pattern Pstr1Q in its full lengt#) -#en, t#e statement repla'es t#e first o''urren'e of t#e pattern Pstr1Q in field P'Q/it# t#e string Pstr2Q) If a lengt# PlQ /as spe'ified, onl( t#e relevant part of t#e pattern is repla'ed) %7PLAC7 $-%1 5I-E $-%2 I>-= $-%I>:) Eere /#ole string is sear'#ed for string1 and is repla'es /it# str2) %7PLAC7 O*< 5I-E O4<
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page 40 of 57

ABAP BASICS
Intelligroup Asia Private Limited

Eere t#e s(stem sear'#es string for * and repla'es it /it# O4<) TRANSLATE (o--and $(ntaA -%A>$LA-7P'Q -= UPP7% CA$7) -%A>$LA-7P'Q -= L=57% CA$7) -#ese statements 'onvert all lo/er 'ase letters in t#e field P'Q to upper 'ase or vi'e versa) 8ou 'an use -%A>$LA-7 to su+stitute t#e '#ara'ters in a string li,e repla'e) 2ut t#e main differen'e +et/een -ranslate and %epla'e is t#at %epla'e statement repla'es onl( one o''urren'e of parti'ular '#ara'ter /#ile -ranslate repla'es all t#e o''urren'es of t#e '#ara'ter) 5#en using su+stitution rules, use t#e follo/ing s(ntaA1 $(ntaA -%A>$LA-7 P'Q U$I>: PrQ) STRLEN (o--and -o determine t#e lengt# of a '#ara'ter string up to t#e last '#ara'ter ot#er t#an $PAC7, use t#e +uilt-in fun'tion $-%L7> as follo/s1 $(ntaA > N $-%L7> H $-% I) Eere > is defined in ?A-A statement as t(pe i) $-%L7> pro'esses an( operand P'Q as a '#ara'ter data t(pe, regardless of its real t(pe) >o 'onversions are performed) CON5ENSE (o--and -o delete superfluous +lan,s in '#ara'ter fields, use t#e C=>?7>$7 statement1 $(ntaA C=>?7>$7 P'Q S>=-:AP$T) -#is statement removes an( leading +lan,s in t#e field P'Q and repla'es ot#er se3uen'es of +lan,s +( eAa'tl( one +lan,) -#e result is a left-.ustified se3uen'e of /ords, ea'# separated +( one +lan,) If t#e addition >=-:AP$ is spe'ified, all +lan,s are removed) CONCATENATE (o--and -o 'on'atenate separate '#ara'ter strings into one, use t#e C=>CA-7>A-7 statement1 $(ntaA C=>CA-7>A-7 P'1Q VP'nQ I>-= P'Q S$7PA%A-7? 28 PsQT) -#is statement 'on'atenates t#e '#ara'ter fields P'1Q to P'nQ and assigns t#e result to P'Q) -railing +lan,s are ignored during t#is operation)
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page 41 of 57

ABAP BASICS
Intelligroup Asia Private Limited

C=>CA-7>A-7 $-% O1< $-%2 I>-= $-%I>:) Eere str, str2 and O1< is 'on'atenated and result is stored in string) SPLIT (o--and -o split a '#ara'ter string into t/o or more smaller strings, use t#e $PLI- statement1 $(ntaA $PLI- P'Q A- PdelQ I>-= P'lQV)P'nQ) -#is statement sear'#es t#e '#ara'ter field P'Q for delimiter strings PdelQ and t#e parts +efore and after t#e delimiters are pla'ed in t#e target fields P'1QV)P'nQ) -o pla'e all fragments in different target fields, (ou must spe'if( enoug# target fields) =t#er/ise, t#e last target field is filled /it# t#e rest of t#e field P'Q and still 'ontains delimiters) $PLI- $-%I>: A- O,< I>-= P1 P2 P" P4) Eere t#e string is split at O,< and is put into strings p1, p2, p", p4) In ABAP#4? yo2 (an +pe(ify off+et 3al2e+ for ele-entary data o7<e(t+ in all +tate-ent+? 1,i(, pro(e++ t,e+e data o7<e(t+) -o do so, spe'if( t#e name of a data o+.e't in a statement as follo/s1 $(ntaA PfQSMPoQTSHPlQIT -#e operation of t#e statement is performed for t#e part of t#e field PfQ t#at +egins at position PoQM1 and #as a lengt# of PlQ) If t#e lengt# PlQ is not spe'ified, t#e field is pro'essed for all positions +et/een PoQ and t#e end of t#e field) $tring N string1M"H4I) Assuming t#at string1 N Oa+'defg.,<) Eere string /ill 'ontain Odefg<)

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 42 of 57

ABAP BASICS
Intelligroup Asia Private Limited

OPEN SFL In t#e %&" $(stem, long-life data is stored in relational data+ase ta+les) $tru'tured Luer( Language H$LLI /as 'reated for a''essing relational ?ata+ase) $LL #as t/o statement t(pes1 ?ata ?efinition Language H??LI statements and ?ata 4anipulation Language H?4LI statements) -= in'lude $LL statements in an A2AP&4 program, use >ative $LL) -o avoid in'ompati+ilities +et/een different data+ase ta+les and also to ma,e A2AP&4 program independent of t#e data+ase s(stem in use, $AP #as 'reated a set of separate $LL statements 'alled =pen $LL) =pen $LL 'ontains a su+set of standard $LL statements as /ell as some en#an'ements, /#i'# are spe'ifi' to $AP) Using =pen $LL ena+les (ou to a''ess an( data+ase ta+les availa+le to t#e $AP s(stem regardless of t#e manufa'turer +e it =ra'le, InformiA et') -#e differen'e +et/een =pen $LL and >ative $LL is as follo/s1 A data+ase interfa'e translates $AP<s =pen $LL statements into $LL 'ommands spe'ifi' to t#e data+ase in use) >ative $LL statements a''ess t#e data+ase dire'tl() =pen $LL ,e(/ords 9e(/ords Used for $7L7C-1 %eading ?ata from ?ata+ase -a+les I>$7%-1 Adding Lines to ?ata+ase -a+les UP?A-71 C#anging Lines in ?ata+ase -a+les 4=?IB81 Adding or C#anging Lines ?7L7-71 ?eleting Lines from ?ata+ase -a+les 5#en using =pen $LL statements in an A2AP&4 program, (ou must ensure t#e follo/ing1 1I -#e data+ase s(stem +eing addressed must +e supported +( $AP) 2I -#e data+ase ta+les +eing addressed must +e defined in t#e A2AP&4 ?i'tionar()

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 4" of 57

ABAP BASICS
Intelligroup Asia Private Limited

Sele(t +tate-ent -#e follo/ing s(stem fields pla( an important role in =pen $LL operations1 S%BSUBRC As /it# ot#er A2AP&4 statements, t#e return 'ode value in t#e s(stem field $8-$U2%C indi'ates after ea'# =pen $LL operation /#et#er or not t#e operation /as su''essful) If an operation is su''essful, $8-$U2%C N 0) If an operation is unsu''essful 6 $8-$U2%C PQ 0 S%B5BCNT -#e value in t#e $8-?2C>- field indi'ates #o/ man( lines /ere affe'ted +( t#e operation or #o/ man( lines #ave alread( +een pro'essed) -o read data from a data+ase ta+le, use t#e $7L7C- 'ommand) $(ntaA $7L7C-P/#atQ B%=4 Pta+le nameQ SI>-= Pvaria+le, anot#er ta+leQT S5E7%7 P'onditionQT) -#is statement #as several +asi' 'lauses) 7a'# 'lause is des'ri+ed in t#e follo/ing ta+le) $7L7C-P/#atQ B%=4 Pta+le nameQ I>-= Pvaria+les or anot#er ta+leQ 5E7%7 P'onditionQ -#e $7L7C- 'lause defines /#et#er t#e result of t#e sele'tion is a single line or a /#ole ta+le, or fe/ 'olumns) B%=4 Pta+le nameQ -#e B%=4 'lause spe'ifies t#e data+ase ta+le or vie/ Psour'eQ from /#i'# t#e data is to +e sele'ted) I>-= Pvaria+le, anot#er ta+leQ -#e I>-= 'lause determines t#e target area PtargetQ into /#i'# t#e sele'ted data is to +e read) It 'an also +e pla'ed +efore t#e B%=4 'lause) If (ou do not spe'if( an I>-= 'lause, t#e s(stem uses t#e ta+le /or, area) T,e ta7le 1or0 area i+ a ,eader line? 1,i(, i+ a2to-ati(ally (reated 7y t,e TABLES +tate-ent) 5E7%7 P'onditionQ
Updated on - Apr 20, 2004 Created on - an 01, 200! Proprietary & Confidential

Page 44 of 57

ABAP BASICS
Intelligroup Asia Private Limited

-#e 5E7%7 'lause spe'ifies /#i'# lines are to +e read +( spe'if(ing 'onditions for t#e sele'tion) C#oosing t#e Lines to +e %ead) Bor $ele'ting All data from ta+le1 i)e), read all 'olumns and all t#e ro/s from data+ase ta+le $(ntaA $7L7C- U B%=4 Pta+leQ) HEere (ou are not spe'if(ing 5E7%7 'onditionI $ele'ting All ?ata from a $ingle Line -o read all 'olumns of a single line from a data+ase ta+le, use t#e $7L7C- statement as follo/s 1 $(ntaA $7L7C- $I>:L7 U B%=4 Pta+leQ VV 5E7%7 P'onditionQ VV -#e result of t#is statement is a single line) -o ma,e sure (ou retrieve desired uni3ue single re'ord, (ou must lin, all t#e fields /#i'# form t#e primar( ,e( of t#e data+ase ta+le +( A>? in t#e 5E7%7 'ondition) Prere3uisite for $7L7C- $I>:L7 1) 2) ") Use all primar( ,e(s in 5E7%7 'ondition) Al/a(s '#e', for $8-$U2%C) Clear /or,-area for ta+le)

A''re'ate E>pre++ion+ 2( using aggregate eApressions, (ou 'an eAtra't '#ara'teristi' data from a 'olumn PaQ of t#e data+ase ta+le) )4AJ1 returns t#e maAimum value of t#e 'olumn )4I>1 returns t#e minimum value of t#e 'olumn )A0:1 returns t#e average value of t#e 'olumn )$U41 returns t#e sum value of t#e 'olumn Updated on - Apr 20, 2004 Proprietary & Confidential Page 45 of 57
Created on - an 01, 200!

ABAP BASICS
Intelligroup Asia Private Limited

)C=U>-1 'ounts values or lines as follo/s1 -C=U>-H U I returns t#e total num+er of lines in t#e sele'tion) 8ou must in'lude spa'es +et/een t#e parent#eses and t#e arguments) -#e arit#meti' operators A0: and $U4 'an onl( /or, /it# numeri' fields) $ometimes (ou retrieve fe/ 'olumns form data+ase ta+le i)e) (ou #ave list in t#e $7L7CClause and I>-= Clause) If t#ere is a list in t#e $7L7C- 'lause, (ou must use t#e I>-= 'lause /it# t#e $7L7Cstatement) 8ou 'an use eit#er a /or, area P/aQ or an internal ta+le Pita+Q or list of varia+les as an argument, $(ntaA -A2L7$1 $BLI:E-) ?A-A 1 CA%%I?I LI97 $BLI:E- -CA%%I?, C=>>I? LI97 $BLI:E- 6C=>>I?) $7L7C- CA%%I? C=>>I? B%=4 $BLI:E- I>-= HCA%%I?1, C=>>I?1I) 5%I-71 & CA%%I?l,C=>>I?1) 7>?$7L7C-) 4an( times (ou retrieve related data from t/o or more ta+les) In su'# 'ases (ou use nested sele'ts 7y lin0in' ta7le+ 1it, (o--on pri-ary 0ey+ ) 2ut as far as possi+le avoid using nested sele'ts as time re3uired to a''ess nested ta+le is ver( #ig#) $(ntaA -A2L7$1 $BLI:E-, $2==9) $7L7C- U B%=4 $BLI:E- 5E7%7 CA%%I? N XLEX) $7L7C- U B%=4 $2==9 5E7%7 CA%%I? N $BLI:E- -CA%%I? A>? C=>>I? N $BLI:E- -C=>>II?) 5%I-71 & $BL$I:E--CA%%I?,$BLI:E--C=>>I?,$2==9-2==9I?, 7>?$7L7C-) 7>?$7L7C-) $ome performan'e #ints for =pen $LL statements 9eep t#e sele'ted dataset small 9eep t#e num+er of sele'ted data as small as possi+le to avoid unne'essar( net/or, transports) Use t#e respe'tive =pen $LL statements al/a(s /it# t#e 5E7%7 'lause) Avoid Updated on - Apr 20, 2004 Proprietary & Confidential Page 4! of 57
Created on - an 01, 200!

ABAP BASICS
Intelligroup Asia Private Limited

'ompleA 5E7%7 'lauses) -#e s(stem must split up t#ose into single statements for t#e data+ase s(stem) ?o not use t#e logi'al >=- in 5E7%7 'lauses +ut inverted operators instead) -#e logi'al >=- is supported +( t#e data+ase indeAes) 9eep t#e transferred data small -ransfer onl( t#ose 'olumns of a data+ase ta+le t#at (ou reall( need) Avoid $7L7C-U if (ou do not /ant to read all 'olumns of a data+ase) Use a list in t#e $7L7C- 'lause instead) Use aggregate eApressions in t#e $7L7C- 'lause to perform 'al'ulations instead transporting great amounts of data and 'al'ulating t#ereafter) 9eep t#e num+er of data+ase a''esses small Use operations on pa',ages of data instead of operations on single data if (ou /ant to anal(Fe sele'ted data more t#an on'e) -o do so, transfer t#e data in a single operation +et/een ta+les and internal ta+les) Avoid nested $7L7C- loops) Instead, /or, /it# internal ta+les and $7L7C- statements using t#e B=% ALL 7>-%I7$ addition)

In+ert +tate-ent
I>$7%- statement inserts a single re'ord into t#e data+ase ta+le) $(ntaA -a+les1 sflig#t) $flig#t-'arrid N OLE<) $flig#t-'onnid N O2"4<) Insert sflig#t) -a+le sflig#t is inserted /it# t#e re'ord) -#e $8W$U2%C is returned for t#is statement) If t#e entr( alread( eAists t#en t#e $8W$U2%C is set to non-Fero value and (ou 'an do pro'essing for eAisting re'ord +( giving some error message)

Update +tate-ent

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 47 of 57

ABAP BASICS
Intelligroup Asia Private Limited

-o update data+ase ta+le UP?A-7 statement is used) -#is allo/s (ou to '#ange eit#er a single re'ord or several re'ords) 8ou 'an use UP?A-7 /#en (ou ,no/ /#i'# re'ord (ou /ant to '#ange) 2ut if (ou do not ,no/ /#et#er t#e primar( ,e( of t#e line (ou /ant to insert alread( eAists or not, (ou 'an use t#e 4=?IB8 statement) -#e 4=?IB8 statement '#anges eAisting lines and inserts lines /#i'# do not eAist) $flig#t-'arrid N O4><) $flig#t-'onnid N O454<) UP?A-7 $BLI:E- /#ere CA%%I? N OLE<) =r -A2L7$ $BLI:E-) UP?A-7 $BLI:E- $7- P%IC7 N 1100 5E7%7 CA%%I? N OLE<) Eere pri'e of sflig#t /ill get updated /it# ne/ pri'e 1100)

5elete +tate-ent
-o delete re'ords from a data+ase ta+le, (ou use t#e ?7L7-7 statement) ?7L7-7 B%=4 $BLI:E- 5E7%7 CA%%I? N OLE< A>? C=>>I? N O454<) 5ill delete t#e single re'ord /#ere 'onditions are met from $BLI:E-) 8ou 'an delete t#e multiple re'ords from data+ase ta+le +( putting all t#e re'ords, /#i'# (ou /ant to delete in internal ta+le) Bor eAample ?7L7-7 $BLI:E- B%=4 -A2L7 I-A2) In t#is 'ase /#atever (ou #ave in internal ta+le /ill +e deleted from $BLIE-) >ote1 append internal ta+le /it# all t#e entries, /#i'# (ou /ant to delete)

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 4K of 57

ABAP BASICS
Intelligroup Asia Private Limited

ECERCISES SIMPLE 1 RITE STATEMENTS

5rite a program, /#i'# generates t#e model list as s#o/n Use t#ese s(stem fields in (our program) $8-?A-U4, $8-UR7I-, $8-U>A47 4aintain t#e list #eadings

12&12&;7 BI%$- P%=:%A4 WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -#is list is generated on1 12&12&1;;7 at1 1"1401"5 +(1 A2AP 1 WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW 2 Create a list as s#o/n --------------------------------------------------------------------------------------------------J8R Co) Pvt) Ltd) ?ate1 -oda(<s date Page >o) 1 --------------------------------------------------------------------------------------------------Program name1 R?74=

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 4; of 57

ABAP BASICS
Intelligroup Asia Private Limited

S%MBOLS? ICONS AN5 FORMATTING 1 5rite a program to s#o/ t#e follo/ing using s(stem varia+les H#int1 use in'lude Ps(m+olQ and in'lude Pi'onQ $(m+ols1 I'ons1 -elep#one C#e',edG o,a(, BaA ma'#ine ?elete, Eand pointing left, Print Eand pointing rig#t, Caution, 7g 1 5rite s(mWp#one as s(m+ol, Otelep#one<) 2 5rite a program to s#o/ a string /it# different +a',ground 'olours) eg) /rite OE7A?7%< 'olor 'olW#eading) H'olW#eading is a+ap&4 name for gra(is# +lue 'olour) =t#er 'olours are 'olW,e( for +luis# green, 'olWnormal for +rig#t gra(, 'olW+a',ground for gra(, 'olWpositive for green, 'olWnegative for red, 'olWgroup for violet and 'olWtotal for (ello/I " Use Bormat intensified 6 format intensified off) Bormat 'olor P'olorWnameQ - format 'olor off) Bormat inverse 6 Bormat inverse off $#o/ 'urrent time and toda(<s date) $#o/ a value O12"45!< as 121"415! using Ousing edit mas,<) -a,e a num+er as O0000011<) $uppress all leading Feros) $uppress a sign +efore a num+er)

4 5 ! 7

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 50 of 57

ABAP BASICS
Intelligroup Asia Private Limited

GENERAL PROBLEMS 1 Create an adding ma'#ine for num+ers) -#e t/o values to +e added must +e entered on t#e sele'tion s'reen as parameters) =utput t#e result) Create t#e dividing ma'#ine for num+ers) -#e t/o values must +e entered on t#e sele'tion s'reen as parameters) =utput t#e result) Create (our output as s#o/n +elo/) ) ) ) ) ) 4 5

"

) ) ) ) ) ) ) ) ) )

5rite a program to a''ept t#e t/o num+ers from t#e user and s/ap t#e values) ?e'lare a string Oe'#o< and design (our output e e e e e e e

' ' # ' # o ' # '

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 51 of 57

ABAP BASICS
Intelligroup Asia Private Limited

5OBEN55O? IFBELSEIFBELSEBEN5IF? CASEBEN5CASE 1 5rite a program /it# ?o 6 7nddo loop) ?ispla( s3uares of num+ers 1 to 10 1 2 " 2 1 4 ;

5rite a program to a''ept a num+er Hsa( 2I from user and 'reate a multipli'ation ta+le) 2A1N2 2A2N4 VVVV 2 A 10 N 20

"

A''ept a num+er from user and find Ba'torial of t#e same) If t#e num+er is negative t#en displa( some message) 5rite a program /it# ?o 6 7nddo loop for first 20 num+ers) - =utput s#ould 'ontain onl( 7ven num+er - =dd num+ers s#ould not +e displa(ed A''ept num+ers and '#oi'e O707>< or O=??< from t#e user and displa( t#e num+ers in t#at range a''ording to user<s '#oi'e) 5rite a program /it# ?o 6 7nddo loop for first 20 num+ers) - =dd num+ers * 7ven num+ers s#ould +e displa(ed /it# alternate intensities) HUse Bormat intensified 6 on 6 offI Create a 'al'ulator, /#i'# performs t#e four +asi' t(pes of 'al'ulations on t/o /#ole num+ers) -#e t/o values and t#e option are to +e entered on t#e sele'tion s'reen as parameters) =utput t#e result /it# 2 de'imal pla'es) 5rite separate programs using OC=>-I>U7< and O7JI-< statements in ?=-L==P)

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 52 of 57

ABAP BASICS
Intelligroup Asia Private Limited

STRING OPERATIONS 1 2 " 4 5 ! 7 K ; 10 11 A''ept a string and determine its lengt# A''ept a string * num+er) 5rite t#e string t#at man( num+er of times) A''ept t/o strings and s/ap t#eir 'ontents) A''ept t/o strings and 'on'atenate into one string) A''ept one string /it# delimiter H , or G I and split it into t/o strings) A''ept a string Oa+'def< and use s#ift PstringQ, s#ift PstringQ rig#t, s#ift PstringQ up to Odef<) A''ept a string eg) Apple) C#ange first o''urren'e of Op< to O+<) Huse Orepla'e< 'ommandI A''ept a string eg) Apple) C#ange all o''urren'es of Op< to O+<) Huse Otranslate< 'ommandI A''ept t/o strings and 'ompare t#e t/o strings using O'o<, O'a<, O's< O'p< Hout put s#all +e Otrue< or Ofalse< for ea'# 'omparison)I A''ept a string OA2C?7B<) =utput onl( O?7B< using offset 'ommand) A''ept first name, last name and middle name eg) >andamuri -ara,a %amarao displa( as >)-)%amarao A''ept a string) C#ange all o''urren'es of a to +) A''ept a num+er and s/ap first and last digit of t#e same) A''ept a string and displa( t#e string in reverse order A''ept a string and '#e', for palindrome

12 1" 14 15

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 5" of 57

ABAP BASICS
Intelligroup Asia Private Limited

5ATE PROBLEMS 1 2 " 4 5 A''ept a date earlier to toda(<s date and find t#e differen'e in num+er of da(s) A''ept a date from user and displa( first da( of t#e mont# and last da( of t#e previous mont#) A''ept a date from user and add siA mont#s to t#e date) A''ept a date from user and 'onvert mont# part to O.an<, Ofe+< et'), and displa( t#is date) 5rite a program to a''ept mont#) ?ispla( num+er of da(s in total mont#) 4a,e use of - -eAt element for (our sele'tion s'reen +oA) - $ele'tion teAt A''ept +irt# date from user and output age in (ears, mont#s and da(s)

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 54 of 57

ABAP BASICS
Intelligroup Asia Private Limited

C"EC! BOCES AN5 RA5IO BUTTONS 1 5rite a program /it# - Parameter as '#e',+oAes - If '#e',+oA 1 is 'li',ed /rite ')+ 1 'li',ed else ')+ 1 not 'li',ed) - If '#e',+oA 2 is 'li',ed /rite ')+ 2 'li',ed else ')+ 2 not 'li',ed) - If '#e',+oAes 1 * 2 are 'li',ed /rite ')+ 1 * ')+) 2 are 'li',ed) - If '#e',+oAes 1 * 2 are not 'li',ed /rite ')+ 1 * ')+) 2 are not 'li',ed) 5rite a program /it# - Parameters as t/o groups of %adio+uttons Ht/o %adio+uttons in ea'# groupI) - :ive detailed 'oding as a+ove, to s#o/ t#e %adio+uttons and groups - sele'ted 5rite a program /it# - Parameter as '#e',+oA) - If (ou 'li', t#e '#e',+oA t#en displa( first da( of t#e neAt (ear) - If t#e '#e',+oA is not 'li',ed t#en displa( last da( of t#e 'urrent (ear) 5rite a program /it# - Parameter as group of " radio +uttons - If first radio +utton is 'li',ed, displa( last da( of t#e 'urrent mont#) - If se'ond radio +utton, displa( first da( of t#e neAt mont# - If t#ird radio +utton, displa( date after siA mont#s)

"

4)

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 55 of 57

ABAP BASICS
Intelligroup Asia Private Limited

SELECT STATEMENTS 1 2 " 4 5 ! 7 K ; 10 11 List all t#e ro/s from t#e ta+le 02A9) List single ro/ from t#e ta+le 29PB) List up to 5 ro/s from t#e ta+le 2$I$) List all 7%?A-s) Bor +etter reada+ilit( 'reate a 'olumn #eading in t#e list ?ispla( total amount for 'arrid OLE<) H-a+les1 $BLI:E-I List all t#e flig#ts for /#i'# +oo,ing date is greater t#an <01)0!)1;;5<) List all t#e flig#ts for /#i'# pa(ments 'urren'( is O?74<) List all t#e flig#ts /#ere 'arrid is +et/een OLE< and O$L<) $ele't a single re'ord /#ere 'arrid N OLE<, flig#t-no N O0400< and fldate N <2K)02)1;;K<) ?ispla( 'arrid, 'onnid, fldate and luggage /eig#t multiplied +( 2 List t#e maAimum 'apa'it(, o''upied seats and total of 'urrent +oo,ings for ea'# flig#t in t#e follo/ing format) Carrier id 12 4aA) 'apa'it( =''upied seats -otal of 'urrent +oo,ings

Brom t#e given from-'it( and to-'it(, list all t#e availa+le on t#is route1 Brom1 Pfrom-'it(Q -o1 Pto-'it(Q Hsa( from Bran,furt to 4adrasI H-a+les1 $PBL1I Carrier id ?eparture -ime $tart Airport ?estination Airport

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 5! of 57

ABAP BASICS
Intelligroup Asia Private Limited

OPEN SFL 1 A''ept do'ument no) from user and displa( parti'ulars of $ales do'ument) do'ument no) O00100000"1<I H-a+le1 02API Created on1AAAAA Created +(1 AAAAA -ime1 AAAAA 2 " 4 A''ept $ales ?o'ument num+er from user and displa( 'orresponding material no, des'ription of t#at material and item 'ategor( H-a+le 1 02API A''ept material no) * item 'ategor( +( default PP100 and 94> respe'tivel( ?ispla( 'orresponding details of sales do'ument H-a+le1 02API ?ispla( fields from 29PB) ?o'ument t(pe N OA2< and ?o'ument date N <05)02)1;;K<) Also displa( num+er of re'ords sele'ted) ?ispla( Co) 'ode, do')no), a'')t(pe, taA 'ode) 4a,e use of sele't-options to give range of do'ument t(pe) ?ispla( title of (our program at t#e end of program A''ept do') no from user) ?ispla( do')no), do')status, date of do'), do')t(pe) ?ispla( single re'ord for do'ument /#ere date N <05)02)1;;K<, t(pe ON OA2 and do'ument no) N O010000000!<) A''ept plant from user eg) PL-P) ?ispla( do'ument details for t#at plant li,e do')no), do')status, date of do'ument et'), H?efault

! 7 K

Updated on - Apr 20, 2004 Created on - an 01, 200!

Proprietary & Confidential

Page 57 of 57