Вы находитесь на странице: 1из 57

ABAP BASICS

Intelligroup Asia Private Limited

ABAP TRAINING MATERIAL

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

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 - Apr 20, 2004 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 - Apr 20, 2004

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 .endors -ere full& engaged to partner -it! "AP/ A+(+, 0ULL, Compa1, I02, "un !ave supported and %ertified #$ platform' "AP !as list of ma,or %onsultants all over t!e -orld li*e Anderson Consulting, Pri%e 3ater!ouse 4 Cooper ( L&)rand, 5rnst ( 6oung, 7P28 and man& more' +!e %ompan& )e!ind #$ is "AP A8, founded )& four former I02 emplo&ees in 1972' +!e %ompan&:s !ead1uarters are in 3alldorf, a small 8erman to-n' +!e %ompan& name, "AP stands for "6"+52", APPLICA+I;<" and P#;=UC+" in data pro%essing' In 1992 #$ -as introdu%ed and in 1995 "AP A8 -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 >9,700 installations of "AP? soft-are' 3it! su)sidiaries in more t!an 50 %ountries, t!e %ompan& is listed on several e@%!anges, in%luding t!e Aran*furt sto%* e@%!ange and <6"5 under t!e s&m)ol B"APC' "AP !as t-o main produ%ts in t!e )usiness soft-are mar*et, 2ainframe s&stem #$2 and Clientserver #$ ' 0ot! are targeted to )usiness appli%ation solutions' Dere # indi%ates #5AL +I25' #$2 is "AP A8 mainframe soft-are t!at runs on I02, "iemens and ot!er %ompati)le e1uipment' +!is t&pe of solution %annot )e open, )ut -it! AL5 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 %entraliEed industries' #$ is t!e produ%t t!at !as reall& pla%ed "AP A8 as t!e leader in t!e %ountr&' +!is %omple@ Client$server s&stem is %ore of our %ourse' +!e glo)al a%%eptan%e of #$ is not onl& )e%ause it %aters all %omple@ needs of )usiness )ut also t!is international a%%eptan%e is )e%ause of #$ :s international appli%a)ilit&' Aor "AP t!is does not mean !aving soft-are availa)le in different languages, )ut also %overing %urren%&, ta@es, Legal pra%ti%e %on%erning D#, Import$e@port regulations' "AP also values its %ustomers and it is s!o-n )& t!e %ompre!ensive set of 1ualit& 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 informationF training, installation and upgrade servi%e li*e/
Updated on - Apr 20, 2004 Created on - Apr 20, 2004 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' 3it! ;"", %ustomers %an sear%! t!e "AP information data)ase and find solutions for errors and pro)lems -it! #$ s&stems' 6ou %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 1uestions' 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 1uestions' 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 5arl& 3at%! "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&Ees 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 5arl& 3at%! 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 - Apr 20, 2004

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 -indoappli%ation and is also *no-n as "AP8UI' +!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 fields/ t!e %lient, t!e user, t!e pass-ord and t!e language'

Client= Dere &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 5<+5# *e& and s&stem -ill ta*e &ou to 2AI< 25<U s%reen'
Updated on - Apr 20, 2004 Created on - Apr 20, 2004 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 =5.5L;P5# 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 e@a%tl& t!e same, as an& ot!er standard -indoappli%ation -ould, li*e minimiEing a s%reen, setting t!e a%tive -indo- et%' Arom +;P to 0;++;2, #$ -indo- %an %ontain t&pi%al elements su%! as %!e%* )o@es, pus! )uttons, input fields and follo-ing elements/ 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 "6"+52 and D5LP are al-a&s present in ever& #$ -indo-' "6"+52 menu option %ontains all utilities and fun%tions, and is availa)le to user at all t!e times' +!e D5LP 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, e@it et%' +!e various i%ons on std' +ool )ar are as follo-s Gfrom left to rig!tH/ 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 A;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 ne@t 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 - Apr 20, 2004

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-s/

Arom t!e 2enu )ar %!oose "6"+52 L;8 ;AA' In t!is %ase, &ou get t!e log off dialog )o@, -!i%! informs t!e user t!at an& data not saved -ill )e lost if %ontinuing -it! t!e log off pro%edure' Use$<5I 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 5II+ )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' 3!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!oriEation for t!at' +!at transa%tion %ode is t!e four-%!ara%ter %ode asso%iated -it! an& tas*' 0& t&ping t!e transa%tion %ode and pressing 5<+5# *e&, t!e s&stem ta*es &ou dire%tl& to t!e initial s%reen for transa%tion' 3!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' Aor 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%! ne@t )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 - Apr 20, 2004

Proprietary & Confidential

Page J of 57

ABAP BASICS
Intelligroup Asia Private Limited

Important transa%tion %odes, -!i%! &ou -ill )e using often, are/ Editor+ "5 7 "5 J "541 "551 "571

Aun%tion 0uilder A0AP$4 5ditor 2enu Painter "%reen Painter Aorm Painter

5i(tionary "511 Initial A0AP$4 di%tionar& maintain s%reen' Bro1+er+ "5J0 ;),e%t )ro-ser' "51> =ata )ro-ser' Te+tin' Tool+ "5 0 #untime Anal&sis "+05 "KL +ra%e
Updated on - Apr 20, 2004 Created on - Apr 20, 2004 Proprietary & Confidential

Page 9 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', 8lossar&, messages, s%reens, fields et%' 6ou o)tain D5LP )& using an& of t!e follo-ing options/ "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 A1 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 - Apr 20, 2004

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' 6ou %an %all sessions as independent #$ -indo- -!ere &ou %an perform ot!er tas*s' 0& 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#5A+5 "5""I;< %omes under "6"+52 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 Lust mouse %li%* on an& part of t!e #$ -indo- to ma*e t!at session a%tive' Com)ination of AL+ M +A0 *e&'

R#$ Ar(,ite(t2re
+!e overall #$ s&stem in%ludes t!e follo-ing %omponents/ 0usiness Appli%ations

0asis "&stem ;r 2iddle La&er

;perating "&stem

=ata 0ase

<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 A0AP$4 Lang' GAdvan%ed 0usiness Appli%ation 4 t!e 4t! generation languageH

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

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* e@a%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' 0esides all t!ese spe%ifi% ,o)s, 0A"I" s&stem also %ontains follo-ing %omponents and t!us provides more additional features' A0AP$4 development -or*)en%!, -!i%! in turn in%ludes man& features li*e repositor&, data di%tionar&, -or*)en%! organiEer, -!i%! -ill )e dis%ussed in later part of t!e topi%s' A0AP$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' 2ail s&stem &ou %an send and re%eive mail from t!e outside -orld GInternetH' Communi%ation interfa%e to e@ternal s&stem from #$ s&stem/ 2anages %ommuni%ation at t!e ;" level G+CP$IPH, at t!e data)ase level ( )et-een appli%ations too' G#AC, 5=I, and AL5H =ata)ase interfa%e 4 +!is %omponent supports different #elational data)ases from different vendors' +!e main tas* of data)ase interfa%e is to %onvert t!e "KL re1uest from t!e "AP development environment to t!e data)ase:s o-n "KL environment' 0a%*ground pro%essing -it! t!is fa%ilit& &ou %an su)mit &our program for )a%*ground e@e%ution' 0A"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 re1uesters' +!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 re1uester, 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 re1uest 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 re1uest to t!e %lientF t!e %lient in turn understands t!e user:s re1uest and redire%ts t!e re1uest to t!e server' +!e server retrieves t!e data, gives it to %lient'
Updated on - Apr 20, 2004 Created on - Apr 20, 2004 Proprietary & Confidential

Page 12 of 57

ABAP BASICS
Intelligroup Asia Private Limited

6ou %an !ave %lient and server on t!e same ma%!ine or on different ma%!ines' 5a%! %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 -!i%! separates a s&stem:s %omputer into fun%tional groups/ tiered ar%!ite%ture,

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


=ata)ase "erver Appli%ation "erver Presentation "erver GUnli*e normal Client$server ar%!ite%ture -!ere &ou !ave onl& t-o la&ers i'e', %lient and server'H Communi%ation among t!e tiers is a%%omplis!ed )& standard proto%ol servi%es li*e +CP$IP or CPIC GCommon Programming Interfa%e Communi%ationH' 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&' 0asi%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 A0AP$4 program' +!e presentation server is &our %lient t!roug! -!i%! &ou send &our re1uest to appli%ation server' It is also %alled as "AP grap!i%al user interfa%es *no-n as "AP8UI and is availa)le in -indo-s '1, 3indo-s <+, 3indo-s 95, and 2a%intos!' +!e& all loo* similar -!atever underl&ing s&stem t!e& are running on' +!e "AP8UI 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 - Apr 20, 2004

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!at/ #$ s&stem %an run on an& operating s&stem platform su%! as U<II, <+, 95, A"$400' It supports various #=02" su%! as "KL server, ;ra%le, Informi@, =02' "tandard 8UIs supported )& #$ are 3indo-s 95, <+, 3indo-s '1, and 2a%intos!' "AP %an use standard %ommuni%ation proto%ols +CP$IP, CPIC, ;"A$=C5$=25 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' Aull 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 A0AP$4 development -or*)en%! loo*s li*e

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


Updated on - Apr 20, 2004 Created on - Apr 20, 2004 Proprietary & Confidential

Page 14 of 57

ABAP BASICS
Intelligroup Asia Private Limited

A0AP$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 Delp information' +ransa%tion %ode for t!is is "511' A0AP$4 editor Creating and maintaining t!e A0AP$4 program, editing fun%tion modules, logi%al data)ase, and s%reens' +ransa%tion %ode is "5 J' Aun%tion li)rar& =efining and maintaining t!e A0AP$4 fun%tion modules' +ransa%tion %ode is "5 7' "%reen painter =esigning and maintaining t!e s%reens in transa%tion' +ransa%tion Code is "551' 2enu painter =esigning and maintaining t!e means for grap!i%al user interfa%e' +ransa%tion %ode "541' For Na3i'atin'= ;),e%t )ro-ser 2anaging and organiEing t!e development o),e%t in a !ierar%!i%al form' +ransa%tion %ode is "5J0' A0AP$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 "5J4' =ata )ro-ser <avigating in t!e data ta)les of t!e data)ase' +ransa%tion %ode is "5 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&Eing t!e results of t!e e@e%ution of ever& program statement' #untime Anal&sis Anal&Eing t!e performan%e t!e s&stem %alls +ransa%tion %ode is "5 0 For Or'aniAin'= 3or*)en%! organiEer %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 "509' +ransport s&stem performing and managing t!e transport of development o),e%t a%ross different s&stem' +ransa%tion %ode is "501

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

Proprietary & Confidential

Page 15 of 57

ABAP BASICS
Intelligroup Asia Private Limited

5ata 5i(tionary +!e A0AP$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 A0AP$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+) 6ou %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' 3!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 1uestions su%! as -!i%! entries e@ist 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 - Apr 20, 2004

Proprietary & Confidential

Page 1> of 57

ABAP BASICS
Intelligroup Asia Private Limited

A(ti3ation of di(tionary o7<e(t+ Aor 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' Aor o),e%ts to )e%ome a%tive, #$ in%ludes t!e AC+I.A+I;< fun%tion' 3!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 1ui%*l& for t!e appli%ation program to a%%ess relevant information of ne- a%tivated o),e%ts' 3!en a di%tionar& o),e%t is modified, t!at means t!at t!e o),e%t previousl& e@isted and a%tivated' 6ou need to rea%tivate t!e o),e%t after modifi%ation' 3!en mass a%tivation is performed massivel&, it mig!t ta*e a 1uite 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 A0AP$4 =ata di%tionar& is t!e %entral %omponent of A0AP$4 repositor&' A =ata di%tionar& is %entraliEed and stru%tured sour%e of information for )usiness appli%ation' +!e A0AP$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 A0AP$4 di%tionar& are as follo-s/ Add, delete, modif&, and manage t!e definition of t!e di%tionar& data' Preserve t!e data integrit&' 0e 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' 3it! 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' 3!en an& of t!e data di%tionar& o),e%ts are used in ot!er parts of t!e development -or*)en%! for e@ample, 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 - Apr 20, 2004

Proprietary & Confidential

Page 17 of 57

ABAP BASICS
Intelligroup Asia Private Limited

+o %all A0AP$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 matri@ %ontaining ro-s and %olumns' #o-s %ontain data -!ile %olumn indi%ates fields' +a)le %an %ontain 0 or multiple ro-s' Str2(t2re/ 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 e@ist at t!e underl&ing data)ase s&stem level' "tru%ture e@ists 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 - Apr 20, 2004 Proprietary & Confidential

Page 1J 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' 3it! 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 J000 ta)les in #$ s&stem' Aollo-ing t&pes of ta)les are availa)le +ransparent ta)les Pool ta)les Cluster ta)les

Arom 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 ;P5< "KL' Do-ever from an administrator point of vie- transparent ta)le do e@ists -it! t!e same stru%ture )ot! in t!e di%tionar& as -ell as in t!e data)ase, e@a%tl& -it! t!e same data and fields' 3!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' 6ou %an a%%ess t!ese ta)les in #$ environment from t!e A0AP$4 di%tionar&' 6ou %annot use native "KL 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' 3!en t!e ta)le is %reated, its %olumns are namedF data t&pe is supplied for ea%! %olumn' +!ere %an )e onl& one data value in ea%! %olumn of ea%! roin a ta)le' #e%ord or as it is %alled in different #=02" is not!ing )ut group of fields' 3!ile a %olumn is a field of a ta)le, a ta)le is an inde@ed file' +!e main inde@ 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 uni1ue re%ord of t!e ta)le' A ta)le %annot !ave re%ord -it! dupli%ate primar& *e&' In an& #=02", ta)les are related to ea%! ot!er' 0ut 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' 2ostl& ta)les are related to ea%! ot!er t!roug! primar& *e&s' +!e primar& *e& of one ta)le, if it e@ists 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' 0ut using normaliEation pro%edures availa)le %an minimiEe it' ;ne of t!e most important fun%tions of foreign *e& is to ensure data integrit&' Aor e@ample sa& &ou !ave Updated on - Apr 20, 2004 Proprietary & Confidential Page 19 of 57
Created on - Apr 20, 2004

ABAP BASICS
Intelligroup Asia Private Limited

52P ta)le, -!i%! !as fields/ emp' no', emp'name, dept'%ode, salar& and &ou !ave =5P+ ta)les, -!i%! !as dept'%ode and dept'des%' +!en in =5P+ ta)le dept'%ode is primar& *e& -!ile dept'%ode in 52P ta)le is foreign *e&' If &ou enter dept'%ode for parti%ular emplo&ee in 52P ta)le t!e dept'%ode s!ould e@ist in =5P+ ta)le' "&stem -ill %!e%* t!e value for dept'%ode in =5P+ ta)le, and if does not e@ist t!en -ill flas! error' In t!is %ase =5P+ is %alled %!e%* ta)le -!ile 52P 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& e@plained 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 are/ =ata t&pe/ 3!ere &ou need to enter t!e data t&pe availa)le in "AP' Aield lengt!/ Aield lengt! is t!e num)er of valid position' .alue ta)le/ <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 G)asi% rule of di%tionar&H'

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 element/ "!ort te@t/ 2andator& field'
Updated on - Apr 20, 2004 Created on - Apr 20, 2004 Proprietary & Confidential

Page 20 of 57

ABAP BASICS
Intelligroup Asia Private Limited

=omain/

A mandator& field' If t!e domain does not e@ist, "AP %an ta*e &ou dire%tl& to domain definition s%reen' +e@t element/ 6ou %an enter des%ription is s!ort or long te@t for t!e field' +!is te@t 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)le/ "!ort des%ription/ =eliver& %lass/ +a)le fields/ element' =ata %lass/ "iEe %ategor&/ 2andator& field' As per User #e1uirement "pe%if& -!et!er primar& *e&' In t!is %ase it is mandator& to enter data 5sta)lis!es t!e p!&si%al area of t!e data)ase' Allo-s &ou to spe%if& estimated spa%e re1uirement for t!e ta)le'

Aurt!er do-n under )uffering s1uare )o@, t!e s&stem allo-s spe%if&ing -!et!er ta)le is going to )e )uffered' 3!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' Aull 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 - Apr 20, 2004

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 A0AP$4 GAdvan%ed 0usiness Appli%ation ProgrammingH for internal use to provide )est -or*ing %onditions for developers' "AP %onstantl& improves t!e language to adapt to t!e in%reasing re1uirements of t!e )usiness appli%ations' At present, A0AP$4 is t!e onl& tool for developing appli%ations at "AP' "AP %ustomers use A0AP$4 for t!eir o-n developments' +!e A0AP$4 =evelopment 3or*)en%! %ontains all tools &ou need to %reate and maintain A0AP$4 programs' A0AP$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' 3!en &ou start t!e program, t!e s&stem e@e%utes t!e runtime o),e%t' A0AP$4, a fourt! generation language, %ontains all usual %ontrol stru%tures and modulariEing %on%epts for stru%tured programming' +!e t!ree parts of t!e A0AP$4 language are/ "tru%ture and e@e%ution of A0AP$4 programs 0asi% language elements Programming reports Programming dialogs Structure and execution of ABAP/4 programs are essentiall& different from entirel& se1uential programming languages su%! as A;#+#A<, PA"CAL, or C' A0AP$4 instead s!ares %ertain similarities -it! modular, event-orient programming languages su%! as .isual 0asi% or LA.A' +!e t-o most important statements %on%erning stru%ture and e@e%ution are/ An A0AP$4 program !as a modular stru%ture' Aor e@e%ution, &ou need a spe%ial runtime environment' +!is means, t!at A0AP$4 sour%e te@ts al-a&s %onsist of a %olle%tion of program modules Gone single module in t!e easiest %aseH or t!e se1uential set of statements' +!e individual program modules %onsist of se1uential 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 se1uential, as &ou *no- it from ot!er se1uential programming languages Gfor e@ample, A;#+#A<, PA"CAL and CH' 3it!in t!e pro%essing )lo%*s, &ou %an use t!e general %ontrol statements for t!e program flo-, su%! as IA, =;5", 3DIL5, A0AP$4 does not %ontain 8;+; elements'
Updated on - Apr 20, 2004 Created on - Apr 20, 2004 Proprietary & Confidential

Page 22 of 57

ABAP BASICS
Intelligroup Asia Private Limited

3e 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 se1uential programming languages' Aor programming appli%ations, t!e entirel& se1uential %on%ept is not suffi%ient' "AP distinguis!es )et-een t-o general t&pes of appli%ation programs/ Report+= 6ou 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-+= 6ou %an dialog programs to e@e%ute transa%tions, -!i%! usuall& read and %!ange data)ases' =ialog programs are %olle%tions of pro%essing )lo%*s Gso-%alled module poolsH t!at are %alled )& a s%reen flo- logi%' +!e t!ird part of t!e User:s 8uide des%ri)es dialog programming in detail' Report+ (an (all dialo' pro'ra-+ and 3i(e 3er+a) In its easiest version, an A0AP$4 program %ontains one single se1uential 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-' A0AP$4 is multi-lingual' +e@t elements su%! as titles, !eadings, and te@t )od& are stored separatel&, independent of t!e program %odes' +!us, &ou %an %!ange, translate, and maintain te@t elements -it!out !aving no adapt t!e %oding' A0AP$4 supports )usiness-related data t&pes and operations' 6ou %an e@e%ute %al%ulations using spe%ial data and time fields' +!e s&stem automati%all& e@e%utes all ne%essar& t&pe %onversions' A0AP$4 provides a num)er of fun%tions for pro%essing %!ara%ter strings' A0AP$4 allo-s &ou to define and %all su)routines' 6ou %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' A0AP$4 %ontains a spe%ial t&pe of su)routine, %alled fun%tion module' Aun%tion modules are stored and maintained in a %entral li)rar&' +!e& !ave %learl& defined data interfa%es to t!e %alling program' 6ou %an test fun%tion modules in a stand-alone mode independent of t!e %alling program' A0AP$4 %ontains an "KL su)set %alled ;P5< "KL' ;P5< "KL allo-s &ou to read and %!ange data)ase ta)les independent of t!e underl&ing data)ase s&stem' A0AP$4 allo-s &ou to define and pro%ess internal ta)les t!at e@ist onl& for t!e e@e%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 %omple@ data stru%tures in a program'
Updated on - Apr 20, 2004 Created on - Apr 20, 2004 Proprietary & Confidential

Page 2 of 57

ABAP BASICS
Intelligroup Asia Private Limited

A0AP$4 allo-s &ou to store data not onl& in data)ases )ut also as se1uential files on appli%ation and presentation servers'

REPORTS #eports are A0AP$4 programs' 6ou 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 e@e%ute reports dire%tl& via t!e program name, for e@ample, )& %!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 e@ternall&' 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' Aor ea%! appli%ation, "AP supplies logi%al data)ases' ;r &ou %an easil& %reate logi%al data)ase &ourself' 5vent %ontrol of a report %orresponds to a %ertain s%!eme/ 3!en a report is e@e%uted, t!e A0AP$4 pro%essor %reates toget!er -it! t!e logi%al data)ase used Gif an&H a se1uen%e of %ertain events for -!i%! &ou %an program pro%essing )lo%*s' +!e %!ronolog& of t!e events is Gmore or lessH "teps involved in %reating a #eport/ .) 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 e@ample, 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' 5it!er t!e report reads data from relational data)ases it using t!e %orresponding A0AP$4 statements Gopen "KLH or leaves t!is tas* to a logi%al data)ase' In t!e latter %ase, t!e logi%al data)ase %reates a se1uen%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 Gfor e@ample, la&out t!e page !eaderH' 4) O2tp2ttin' a li+t
Updated on - Apr 20, 2004 Created on - Apr 20, 2004 Proprietary & Confidential

Page 24 of 57

ABAP BASICS
Intelligroup Asia Private Limited

+!e last part of t!e pro%essing se1uen%e %ontrolled )& t!e A0AP$4 pro%essor is t!e list output on t!e s%reen or printer' 3!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' Aor e@ample, )& %li%*ing t!e mouse' 0& 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 6ou use dialog programs to e@e%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 G;pen "KLH, update and en1ueue %on%epts are of great importan%e -!en programming dialogs' =ialog programs are not stand- alone +o e@e%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 A0AP$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' 5a%! s%reen !as flo- logi%' +!e flo- logi% %onsists of P0; Gpro%ess 0efore outputH and PAI Gpro%ess After InputH )lo%*s' +!is flo- logi% does not use t!e A0AP$4 programming language and t!e A0AP$4 5ditor 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' 5a%! 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 A0AP$4 modules' +!e A0AP$4 modules in t!e module pool are separated into P0; and PAI modules' +!e P0; or PAI )lo%*s of t!e flo- logi% of ea%! d&npro of a module pool %an %all ea%! P0; or PAI module of t!is module pool' 6ou %an use A0AP$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 A0AP$4 module pool' +!e pro%essing logi% pro%esses
Updated on - Apr 20, 2004 Created on - Apr 20, 2004 Proprietary & Confidential

Page 25 of 57

ABAP BASICS
Intelligroup Asia Private Limited

t!e user entries Gdata)ase a%%essesH and, if re1uired, defines t!e appropriate su)se1uent s%reens'

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

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 A0AP$4 t&pe %on%epts' 0ot! %an )e de%lared and maintained )& user' Unli*e ot!er programming languages in A0AP$4 &ou %an %reate =A+A +6P5" 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 of/ 1' 5lementar& or stru%tured 2' Predefined or user defined Predefined 5L525<+A#6 C, =, A, I, <, P, +, I U+erBdefined 0ased upon elementar& =ata t&pes' 5'g', +6P5"/ num)er t&pes I' Can:t allo%ate memor& to t&pes' User defined stru%tured t&pes are Aield "tring and internal ta)les'

6ou %an use dire%tl&

"+#UC+U#5=

Predefined t&pes are +A0L5"

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

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 e@ist -it!out data t&pe' ;%%upies memor& spa%e' !ind+ of 5ata O7<e(t+ .) INTERNAL 5ATA OB:ECTS

Literal A literal !as a fi@ed value' 5@ 3#I+5/ B3;#7 DA#=C 6aria7le+ =A+A statement is used to %reate varia)les 5@ =A+A/ <U2 +6P5 I <U2 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' Dere varia)le is de%lared )& referring to e@isting data t&pe' .aria)le %an also )e de%lared )& referring e@isting data o),e%t' 5@' 3e !ave alread& de%lared <U2 )& =A+A statement' =A+A/ P#IC5 LI75 <U2' Dere varia)le is de%lared )& using LI75 parameter, -!i%! tells s&stem t!at pri%e !as all t!e attri)utes of data o),e%t <U2 i'e', P#IC5 is also of t&pe I' +!e main differen%e )et-een +6P5 and LI75 parameter -!en defining or de%laring t!e o),e%t is t!at +6P5 is used to refer e@isting =A+A +6P5 Gelementar& or stru%tured or user definedH -!ile LI75 is used to de%lare data o),e%ts -it! referen%e to e@isting =A+A ;0L5C+"' Con+tant Constant is a data o),e%t, -!i%! %ontains fi@ed value t!roug! out t!e program' Constant %an )e de%lared in program )& using C;<"+A<+ statement' 5@' C;<"+A<+/ I<+ +6P5 I .ALU5 15'
Updated on - Apr 20, 2004 Created on - Apr 20, 2004 Proprietary & Confidential

Page 2J 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 A0AP$4 di%tionar&' 6ou %an a%%ess t!is data from ta)le' +A0L5"/ "ALI8D+ =A+A/ "5A+" LI75 "ALI8D+-"5A+"2AI' $) S%STEMB5EFINE5 5ATA OB:ECTS "PAC5 ( "6"+52 .A#IA0L5" li*e s&-uname, s&-datum, ( s&-repid' 4) SPECIAL 5ATA OB:ECTS PA#A25+5#"/ are varia)le, -!i%! %an a%%ept value from user' "5L5C+I;<" C#I+5#IA/ are spe%ial internal ta)les to a%%ept value range from user'

Need for 5ata type+= Consider t!e follo-ing e@ample' =A+A/ fnameG20H, mnameG20H, lnameG20H, add1G20H, add2G20H, add G20H' 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' 0ut %onsider t!e follo-ing %ase -!ere +6P5" !as )een used' +6P5"/strG20H =A+A/fname t&pe str,
Updated on - Apr 20, 2004 Created on - Apr 20, 2004 Proprietary & Confidential

Page 29 of 57

ABAP BASICS
Intelligroup Asia Private Limited

2name 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 +6P5-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#A25+5# 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' "&nta@' Parameters/ num t&pe I' Dere 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' 5ntered value is stored in t!e same varia)le and %an )e used in program' =ata/ m t&pe I Parameters/ num t&pe I 2 N num 4 5 3rite/ $ O+!e num)er is:, m' 6ou %an define default values -it! parameter statement for e@ample Parameter/ 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%*)o@ and #adio)utton' Parameter/ C1 as C!e%*)o@, C2 as C!e%*)o@' Parameter/ #1 #adio)utton group g1, #2 #adio)utton group g1' 3!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 - Apr 20, 2004 Proprietary & Confidential

Page 0 of 57

ABAP BASICS
Intelligroup Asia Private Limited

5ver& parameter %an )e asso%iated -it! language dependent te@t t!at is displa&ed on t!e sele%tion s%reen' +!is %an )e done -it! t!e !elp of te@t elements'

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

Proprietary & Confidential

Page 1 of 57

ABAP BASICS
Intelligroup Asia Private Limited

RITE State-ent +!e )asi% APA0$4 statement for outputting data on t!e s%reen is 3#I+5' "&nta@/ 3#I+5 PfieldQ PoptionQ' +!is statement outputs t!e field PfQ to t!e %urrent list in its standard output format' 0& 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#;8#A2 R=52; 3#I+5/ $OD5LL;:' 3!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%reen/ +!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' Airst line on t!e s%reen %ontains t!e list !eader' 0& default, t!e list !eader is t!e same as t!e title of t!e program' +!e %urrent page num)er G1H appears on t!e rig!t' +!e list !eader is follo-ed )& one line and t!en t!e output is displa&ed' 3rite / OD5LL;:' 3rite / O3;#7 DA#=: ;n t!e s%reen, t!e output is normall& left ,ustified' 0ut in a)ove %ase, )e%ause -e !ave used t-o 3#I+5 statements, t!e output fields are displa&ed one after t!e ot!er, ea%! separated )& one %olumn Gi'e', one )lan*H' 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 e@%ept AL;A+, I<+585#, and PAC75= i'e', num)er field' +!e numeri% data t&pes A, 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' 3it! t!e data t&pe =, t!e internal format of a date differs from its output format' 3!en &ou use t!e 3#I+5 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 Ge'g' ==$22$6666 or 22$==$6666H'

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

Proprietary & Confidential

Page 2 of 57

ABAP BASICS
Intelligroup Asia Private Limited

For-attin' o2tp2t 6ou %an position t!e output of a 3#I+5 statement on t!e s%reen )& ma*ing a format spe%ifi%ation )efore t!e field name as follo-s/ "&nta@/ 3#I+5 A+ S$TSPposQTSGPlenQHT PfQ, 3!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!'

Aor varia)les &ou need to mention t!e A+, for dire%t values it is not ne%essar&' =A+A/ L5< +6P5 I .ALU5 10, P;" +6P5 I .ALU5 11, +5I+ G10H .ALU5 O12 45>7J90: 3#I+5 A+ P;" GL5<H +5I+' +!is produ%es t!e follo-ing output on t!e s%reenF +!e te@t 4 12 45>7J90 4 appears in t!e te@t' 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 prefi@ed -it! an asteris* GUH' 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+A/ <U205# +6P5 I .ALU5 12 45>7J90, +5I+ G10H .ALU5 Oa)%defg!i,:' 3#I+5/ G5H <U205#, $G5H +5I+' +!is produ%es t!e follo-ing output/ 7J90 a)%de In t!e default setting, &ou %annot %reate empt& lines -it! t!e 3#I+5 statement' 3#I+5/ O;ne:, $O :, $ O+-o:
Updated on - Apr 20, 2004 Created on - Apr 20, 2004 Proprietary & Confidential

Page

of 57

ABAP BASICS
Intelligroup Asia Private Limited

+!e output loo*s as follo-s/ ;ne +-o +!e s&stem suppresses lines t!at %ontain not!ing )ut empt& spa%es' 6ou %an use various formatting options -it! t!e 3#I+5 statement' "&nta@ 3#I+5VVVV PfieldQ PoptionQ For-attin' option+ for all data type+ "ption L5A+-LU"+IAI5= C5<+5#5= #I8D+-LU"+IAI5= <;-8AP <;-R5#; 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& Eeros, t!ese are repla%ed )& )lan*s' Aor t&pe C and < fields, leading Eeros are repla%ed automati%all&'

For-attin' option+ for n2-eri( field+ Option <;-"I8< =5CI2AL" PdQ 5IP;<5<+ PeQ #;U<= PrQ CU##5<C6 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 A fields, t!e e@ponent is defined in PeQ +&pe P fields are multiplied )& 10UUG-rH and t!en rounded Aormat a%%ording to %urren%& P%Q in ta)le +CU#I' +!e num)er of de%imal pla%es is fi@ed 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 - Apr 20, 2004

Page 4 of 57

ABAP BASICS
Intelligroup Asia Private Limited

"oriAontal line+ 6ou %an generate !oriEontal lines on t!e output s%reen )& using t!e follo-ing s&nta@/ "&nta@ ULI<5 3ill dra- a !oriEontal line' ULI<5 G10H 3ill start dra-ing !oriEontal line from 10t! %olumn position' 3#I+5 at 10G40H "6-ULI<5 +!is statement dra-s a !oriEontal line from 10t! position' 6erti(al line+ 6ou generate verti%al lines one t!e output s%reen )& using t!e follo-ing s&nta@/ "&nta@ 3#I+5 SA+ S$T SPposQTT "6-.LI<5' Blan0 line+ 6ou %an generate )lan* lines on t!e s%reen )& using t!e follo-ing s&nta@ / "&nta@ "7IP 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 3#I+5 statement alone' +o position t!e output on a spe%ifi% line on t!e s%reen use/ "&nta@ "7IP +; LI<5 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 - Apr 20, 2004

Proprietary & Confidential

Page 5 of 57

ABAP BASICS
Intelligroup Asia Private Limited

Bran(,e+ Li*e ot!er !ig!er programming languages, A0AP$4 provides standard *e&-ords to %ontrol t!e flo- of a program' Usuall& A0AP$4 programs get e@e%uted statement )& statement' 2an& 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 )&/ 7ran(,in' DIF? CASEE loopin' D5O? "ILEE Do-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' 6ou define t!is in &our program %ode' +!e e>ternal (ontrol is stored )& events' 5vents are generated eit!er from ot!er A0AP$4 programs or from intera%tive user input Gli*e, for e@ample, using t!e mouse to %li%* on t!e s%reenH' +!e s&stem does not ne%essaril& pro%ess t!e statements in t!e same se1uen%e as t!e& are listed in an A0AP$4 program' +!is ma*es A0AP$4 an event-driven programming language' +!e e@ternal %ontrol pla&s an important role mainl& for report programs'

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


+!e IA 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 IA statement and t!e ne@t 5L"5IA, 5L"5, or 5<=IA statement' "&nta@ IAP%ondition1Q Pstatement )lo%*Q 5L"5 Pstatement )lo%*Q 5<=IA If t!e first %ondition is true, t!e s&stem e@e%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 5<=IA statement'

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

Proprietary & Confidential

Page > of 57

ABAP BASICS
Intelligroup Asia Private Limited

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

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 3#I+5 statement for 10 times' 3!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-s/ "&nta@ =; 5 times' 3rite / $ name' 5<==;' +!e s&stem %ontinues pro%essing t!e statement )lo%* for 5 times introdu%ed )& =; and %on%luded )& 5<==;' +!e s&stem field "6-I<=5I %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&-inde@ -ill )e 5' In t!is %ase &ou *no- t!at, &ou -ant to perform 3#I+5 statement for 5 times' 0ut t!at is not t!e %ase al-a&s' 2an& 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 +I25" option, is to avoid endless loops -!en -or*ing -it! t!e =; statement' If &ou do not use t!e +I25" option, in%lude at least one 5II+, "+;P statement so t!at t!e s&stem %an leave t!e loop' 5II+ 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 3DIL5 statement as follo-s/ "&nta@ =A+A/ 2 +6P5 I .ALU5 0' 3DIL5 2 P 10' 3#I+5/ $ 2' 2 N 2 M 1'
Updated on - Apr 20, 2004 Created on - Apr 20, 2004 Proprietary & Confidential

Page J of 57

ABAP BASICS
Intelligroup Asia Private Limited

5<=3DIL5' +!e s&stem %ontinues pro%essing t!e statement )lo%* introdu%ed )& 3DIL5 and %on%luded )& 5<=3DIL5 statements as long as 2 is less t!an 10 or until t!e s&stem finds an 5II+, "+;P' +!e s&stem field S%BIN5EC %ontains t!e num)er of times t!e loop !as )een pro%essed' 6ou %an nest 3DIL5 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 3DIL5, %ondition is %!e%*ed first and if %ondition is true t!en loop is e@e%uted -!ile in =; loop, t!e loop gets e@e%uted first if &ou don:t !ave +I25" option and t!en t!e %ondition is %!e%*ed Gif &ou !ave an&H' 6ou %an !ave nested =; and 3DIL5 or =; and IA or IA and IA or an& possi)le situation'

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

Proprietary & Confidential

Page 9 of 57

ABAP BASICS
Intelligroup Asia Private Limited

Strin' Operation+ A0AP$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 "DIA+ statement' Using "DIA+ allo-s &ou to s!ift field %ontents, )&te-)&-)&te or %!ara%ter-)&%!ara%ter' 3it! t!e "DIA+ statement, &ou %an e@e%ute t!e follo-ing/ "tring N OD5LL;:' "tring 1 N OALL ;A 6;U:' "tring 2 N O3;#7 DA#=:' "!ift string "!ift string1 )& 2 pla%es' "!ift string2 rig!t' "!ift string1 )& 2 pla%es %ir%ular' +!e output -ill )e 5LL; 4 0& default if not!ing is spe%ified t!en string is s!ifted )& one position' L ;A 6;U 4 Dere t!e string is s!ifted )& 2 pla%es' W3;#7 DA#= 4 In t!is %ase t!e string is s!ifted to rig!t )& one pla%e G-it! leading )lan*sH 7 DA#=3;# 4 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 6ou use t!e #5PLAC5 statement' "&nta@ #5PLAC5PstrlQ3I+DPstr2QI<+;P%QSL5<8+DP1QT' A0AP$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' #5PLAC5 "+#1 3I+D "+#2 I<+; "+#I<8' Dere -!ole string is sear%!ed for string1 and is repla%es -it! str2' #5PLAC5 O(: 3I+D O2:
Updated on - Apr 20, 2004 Created on - Apr 20, 2004 Proprietary & Confidential

Page 40 of 57

ABAP BASICS
Intelligroup Asia Private Limited

Dere t!e s&stem sear%!es string for ( and repla%es it -it! O2:' TRANSLATE (o--and "&nta@ +#A<"LA+5P%Q +; UPP5# CA"5' +#A<"LA+5P%Q +; L;35# CA"5' +!ese statements %onvert all lo-er %ase letters in t!e field P%Q to upper %ase or vi%e versa' 6ou %an use +#A<"LA+5 to su)stitute t!e %!ara%ters in a string li*e repla%e' 0ut 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' 3!en using su)stitution rules, use t!e follo-ing s&nta@/ "&nta@ +#A<"LA+5 P%Q U"I<8 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 "PAC5, use t!e )uilt-in fun%tion "+#L5< as follo-s/ "&nta@ < N "+#L5< G "+# H' Dere < is defined in =A+A statement as t&pe i' "+#L5< 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;<=5<"5 statement/ "&nta@ C;<=5<"5 P%Q S<;-8AP"T' +!is statement removes an& leading )lan*s in t!e field P%Q and repla%es ot!er se1uen%es of )lan*s )& e@a%tl& one )lan*' +!e result is a left-,ustified se1uen%e of -ords, ea%! separated )& one )lan*' If t!e addition <;-8AP" 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+5<A+5 statement/ "&nta@ C;<CA+5<A+5 P%1Q VP%nQ I<+; P%Q S"5PA#A+5= 06 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 - Apr 20, 2004 Proprietary & Confidential

Page 41 of 57

ABAP BASICS
Intelligroup Asia Private Limited

C;<CA+5<A+5 "+# O/: "+#2 I<+; "+#I<8' Dere str, str2 and O/: 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+ statement/ "&nta@ "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<8 A+ O,: I<+; P1 P2 P P4' Dere 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-s/ "&nta@ PfQSMPoQTSGPlQHT +!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 G4H' Assuming t!at string1 N Oa)%defg,*:' Dere string -ill %ontain Odefg:'

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

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 Kuer& Language G"KLH -as %reated for a%%essing relational =ata)ase' "KL !as t-o statement t&pes/ =ata =efinition Language G==LH statements and =ata 2anipulation Language G=2LH statements' +; in%lude "KL statements in an A0AP$4 program, use <ative "KL' +o avoid in%ompati)ilities )et-een different data)ase ta)les and also to ma*e A0AP$4 program independent of t!e data)ase s&stem in use, "AP !as %reated a set of separate "KL statements %alled ;pen "KL' ;pen "KL %ontains a su)set of standard "KL statements as -ell as some en!an%ements, -!i%! are spe%ifi% to "AP' Using ;pen "KL 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, Informi@ et%' +!e differen%e )et-een ;pen "KL and <ative "KL is as follo-s/ A data)ase interfa%e translates "AP:s ;pen "KL statements into "KL %ommands spe%ifi% to t!e data)ase in use' <ative "KL statements a%%ess t!e data)ase dire%tl&' ;pen "KL *e&-ords 7e&-ords Used for "5L5C+/ #eading =ata from =ata)ase +a)les I<"5#+/ Adding Lines to =ata)ase +a)les UP=A+5/ C!anging Lines in =ata)ase +a)les 2;=IA6/ Adding or C!anging Lines =5L5+5/ =eleting Lines from =ata)ase +a)les 3!en using ;pen "KL statements in an A0AP$4 program, &ou must ensure t!e follo-ing/ 1H +!e data)ase s&stem )eing addressed must )e supported )& "AP' 2H +!e data)ase ta)les )eing addressed must )e defined in t!e A0AP$4 =i%tionar&'

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

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 "KL operations/ S%BSUBRC As -it! ot!er A0AP$4 statements, t!e return %ode value in t!e s&stem field "6-"U0#C indi%ates after ea%! ;pen "KL operation -!et!er or not t!e operation -as su%%essful' If an operation is su%%essful, "6-"U0#C N 0' If an operation is unsu%%essful 4 "6-"U0#C PQ 0 S%B5BCNT +!e value in t!e "6-=0C<+ 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 "5L5C+ %ommand' "&nta@ "5L5C+P-!atQ A#;2 Pta)le nameQ SI<+; Pvaria)le, anot!er ta)leQT S3D5#5 P%onditionQT' +!is statement !as several )asi% %lauses' 5a%! %lause is des%ri)ed in t!e follo-ing ta)le' "5L5C+P-!atQ A#;2 Pta)le nameQ I<+; Pvaria)les or anot!er ta)leQ 3D5#5 P%onditionQ +!e "5L5C+ %lause defines -!et!er t!e result of t!e sele%tion is a single line or a -!ole ta)le, or fe- %olumns' A#;2 Pta)le nameQ +!e A#;2 %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 A#;2 %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) 3D5#5 P%onditionQ
Updated on - Apr 20, 2004 Created on - Apr 20, 2004 Proprietary & Confidential

Page 44 of 57

ABAP BASICS
Intelligroup Asia Private Limited

+!e 3D5#5 %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' Aor "ele%ting All data from ta)le/ i'e', read all %olumns and all t!e ro-s from data)ase ta)le "&nta@ "5L5C+ U A#;2 Pta)leQ' GDere &ou are not spe%if&ing 3D5#5 %onditionH "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 "5L5C+ statement as follo-s / "&nta@ "5L5C+ "I<8L5 U A#;2 Pta)leQ VV 3D5#5 P%onditionQ VV +!e result of t!is statement is a single line' +o ma*e sure &ou retrieve desired uni1ue 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 3D5#5 %ondition' Prere1uisite for "5L5C+ "I<8L5 1' 2' ' Use all primar& *e&s in 3D5#5 %ondition' Al-a&s %!e%* for "6-"U0#C' Clear -or*-area for ta)le'

A''re'ate E>pre++ion+ 0& using aggregate e@pressions, &ou %an e@tra%t %!ara%teristi% data from a %olumn PaQ of t!e data)ase ta)le' '2AI/ returns t!e ma@imum value of t!e %olumn '2I</ returns t!e minimum value of t!e %olumn 'A.8/ returns t!e average value of t!e %olumn '"U2/ returns t!e sum value of t!e %olumn Updated on - Apr 20, 2004 Proprietary & Confidential Page 45 of 57
Created on - Apr 20, 2004

ABAP BASICS
Intelligroup Asia Private Limited

'C;U<+/ %ounts values or lines as follo-s/ -C;U<+G U H returns t!e total num)er of lines in t!e sele%tion' 6ou must in%lude spa%es )et-een t!e parent!eses and t!e arguments' +!e arit!meti% operators A.8 and "U2 %an onl& -or* -it! numeri% fields' "ometimes &ou retrieve fe- %olumns form data)ase ta)le i'e' &ou !ave list in t!e "5L5C+ Clause and I<+; Clause' If t!ere is a list in t!e "5L5C+ %lause, &ou must use t!e I<+; %lause -it! t!e "5L5C+ statement' 6ou %an use eit!er a -or* area P-aQ or an internal ta)le Pita)Q or list of varia)les as an argument, "&nta@ +A0L5"/ "ALI8D+' =A+A / CA##I=I LI75 "ALI8D+ -CA##I=, C;<<I= LI75 "ALI8D+ 4C;<<I=' "5L5C+ CA##I= C;<<I= A#;2 "ALI8D+ I<+; GCA##I=1, C;<<I=1H' 3#I+5/ $ CA##I=l,C;<<I=1' 5<="5L5C+' 2an& 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+ ' 0ut as far as possi)le avoid using nested sele%ts as time re1uired to a%%ess nested ta)le is ver& !ig!' "&nta@ +A0L5"/ "ALI8D+, "0;;7' "5L5C+ U A#;2 "ALI8D+ 3D5#5 CA##I= N XLDX' "5L5C+ U A#;2 "0;;7 3D5#5 CA##I= N "ALI8D+ -CA##I= A<= C;<<I= N "ALI8D+ -C;<<II=' 3#I+5/ $ "AL"I8D+-CA##I=,"ALI8D+-C;<<I=,"0;;7-0;;7I=, 5<="5L5C+' 5<="5L5C+' "ome performan%e !ints for ;pen "KL statements 7eep t!e sele%ted dataset small 7eep 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 "KL statements al-a&s -it! t!e 3D5#5 %lause' Avoid Updated on - Apr 20, 2004 Proprietary & Confidential Page 4> of 57
Created on - Apr 20, 2004

ABAP BASICS
Intelligroup Asia Private Limited

%omple@ 3D5#5 %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 3D5#5 %lauses )ut inverted operators instead' +!e logi%al <;+ is supported )& t!e data)ase inde@es' 7eep t!e transferred data small +ransfer onl& t!ose %olumns of a data)ase ta)le t!at &ou reall& need' Avoid "5L5C+U if &ou do not -ant to read all %olumns of a data)ase' Use a list in t!e "5L5C+ %lause instead' Use aggregate e@pressions in t!e "5L5C+ %lause to perform %al%ulations instead transporting great amounts of data and %al%ulating t!ereafter' 7eep 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&Ee 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 "5L5C+ loops' Instead, -or* -it! internal ta)les and "5L5C+ statements using t!e A;# ALL 5<+#I5" addition'

In+ert +tate-ent
I<"5#+ statement inserts a single re%ord into t!e data)ase ta)le' "&nta@ +a)les/ sflig!t' "flig!t-%arrid N OLD:' "flig!t-%onnid N O2 4:' Insert sflig!t' +a)le sflig!t is inserted -it! t!e re%ord' +!e "6W"U0#C is returned for t!is statement' If t!e entr& alread& e@ists t!en t!e "6W"U0#C is set to non-Eero value and &ou %an do pro%essing for e@isting re%ord )& giving some error message'

Update +tate-ent

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

Proprietary & Confidential

Page 47 of 57

ABAP BASICS
Intelligroup Asia Private Limited

+o update data)ase ta)le UP=A+5 statement is used' +!is allo-s &ou to %!ange eit!er a single re%ord or several re%ords' 6ou %an use UP=A+5 -!en &ou *no- -!i%! re%ord &ou -ant to %!ange' 0ut if &ou do not *no- -!et!er t!e primar& *e& of t!e line &ou -ant to insert alread& e@ists or not, &ou %an use t!e 2;=IA6 statement' +!e 2;=IA6 statement %!anges e@isting lines and inserts lines -!i%! do not e@ist' "flig!t-%arrid N O2<:' "flig!t-%onnid N O454:' UP=A+5 "ALI8D+ -!ere CA##I= N OLD:' ;r +A0L5" "ALI8D+' UP=A+5 "ALI8D+ "5+ P#IC5 N 1100 3D5#5 CA##I= N OLD:' Dere 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 =5L5+5 statement' =5L5+5 A#;2 "ALI8D+ 3D5#5 CA##I= N OLD: A<= C;<<I= N O454:' 3ill delete t!e single re%ord -!ere %onditions are met from "ALI8D+' 6ou %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' Aor e@ample =5L5+5 "ALI8D+ A#;2 +A0L5 I+A0' In t!is %ase -!atever &ou !ave in internal ta)le -ill )e deleted from "ALID+' <ote/ append internal ta)le -it! all t!e entries, -!i%! &ou -ant to delete'

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

Proprietary & Confidential

Page 4J of 57

ABAP BASICS
Intelligroup Asia Private Limited

ECERCISES SIMPLE 1 RITE STATEMENTS

3rite a program, -!i%! generates t!e model list as s!o-n Use t!ese s&stem fields in &our program' "6-=A+U2, "6-UR5I+, "6-U<A25 2aintain t!e list !eadings

12$12$97 AI#"+ P#;8#A2 WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +!is list is generated on/ 12$12$1997 at/ 1 /40/ 5 )&/ A0AP 1 WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW 2 Create a list as s!o-n --------------------------------------------------------------------------------------------------I6R Co' Pvt' Ltd' =ate/ +oda&:s date Page <o' 1 --------------------------------------------------------------------------------------------------Program name/ R=52;

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

Proprietary & Confidential

Page 49 of 57

ABAP BASICS
Intelligroup Asia Private Limited

S%MBOLS? ICONS AN5 FORMATTING 1 3rite a program to s!o- t!e follo-ing using s&stem varia)les G!int/ use in%lude Ps&m)olQ and in%lude Pi%onQ "&m)ols/ I%ons/ +elep!one C!e%*edF o*a&, Aa@ ma%!ine =elete, Dand pointing left, Print Dand pointing rig!t, Caution, 5g / 3rite s&mWp!one as s&m)ol, Otelep!one:' 2 3rite a program to s!o- a string -it! different )a%*ground %olours' eg' -rite OD5A=5#: %olor %olW!eading' G%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-H Use Aormat intensified 4 format intensified off' Aormat %olor P%olorWnameQ - format %olor off' Aormat inverse 4 Aormat inverse off 4 5 > 7 "!o- %urrent time and toda&:s date' "!o- a value O12 45>: as 12/ 4/5> using Ousing edit mas*:' +a*e a num)er as O0000011:' "uppress all leading Eeros' "uppress a sign )efore a num)er'

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

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

) ) ) ) ) ) ) ) ) )

3rite 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 - Apr 20, 2004

Proprietary & Confidential

Page 51 of 57

ABAP BASICS
Intelligroup Asia Private Limited

5OBEN55O? IFBELSEIFBELSEBEN5IF? CASEBEN5CASE 1 3rite a program -it! =o 4 5nddo loop' =ispla& s1uares of num)ers 1 to 10 1 2 1 4 9

3rite a program to a%%ept a num)er Gsa& 2H from user and %reate a multipli%ation ta)le' 2@1N2 2@2N4 VVVV 2 @ 10 N 20 A%%ept a num)er from user and find Aa%torial of t!e same' If t!e num)er is negative t!en displa& some message'

3rite a program -it! =o 4 5nddo loop for first 20 num)ers' - ;utput s!ould %ontain onl& 5ven num)er - ;dd num)ers s!ould not )e displa&ed A%%ept num)ers and %!oi%e O5.5<: or O;==: from t!e user and displa& t!e num)ers in t!at range a%%ording to user:s %!oi%e' 3rite a program -it! =o 4 5nddo loop for first 20 num)ers' - ;dd num)ers ( 5ven num)ers s!ould )e displa&ed -it! alternate intensities' GUse Aormat intensified 4 on 4 offH 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' 3rite separate programs using OC;<+I<U5: and O5II+: statements in =;-L;;P'

>

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

Proprietary & Confidential

Page 52 of 57

ABAP BASICS
Intelligroup Asia Private Limited

STRING OPERATIONS 1 2 A%%ept a string and determine its lengt! A%%ept a string ( num)er' 3rite t!e string t!at man& num)er of times' A%%ept t-o strings and s-ap t!eir %ontents' 4 5 > 7 J 9 10 11 A%%ept t-o strings and %on%atenate into one string' A%%ept one string -it! delimiter G , or F H 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):' Guse Orepla%e: %ommandH A%%ept a string eg' Apple' C!ange all o%%urren%es of Op: to O):' Guse Otranslate: %ommandH A%%ept t-o strings and %ompare t!e t-o strings using O%o:, O%a:, O%s: O%p: Gout put s!all )e Otrue: or Ofalse: for ea%! %omparison'H A%%ept a string OA0C=5A:' ;utput onl& O=5A: 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 - Apr 20, 2004

Proprietary & Confidential

Page 5 of 57

ABAP BASICS
Intelligroup Asia Private Limited

5ATE PROBLEMS 1 2 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 si@ mont!s to t!e date' 4 5 A%%ept a date from user and %onvert mont! part to O,an:, Ofe): et%', and displa& t!is date' 3rite a program to a%%ept mont!' =ispla& num)er of da&s in total mont!' 2a*e use of - +e@t element for &our sele%tion s%reen )o@' - "ele%tion te@t A%%ept )irt! date from user and output age in &ears, mont!s and da&s'

>

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

Proprietary & Confidential

Page 54 of 57

ABAP BASICS
Intelligroup Asia Private Limited

C"EC! BOCES AN5 RA5IO BUTTONS 1 3rite a program -it! - Parameter as %!e%*)o@es - If %!e%*)o@ 1 is %li%*ed -rite %') 1 %li%*ed else %') 1 not %li%*ed' - If %!e%*)o@ 2 is %li%*ed -rite %') 2 %li%*ed else %') 2 not %li%*ed' - If %!e%*)o@es 1 ( 2 are %li%*ed -rite %') 1 ( %')' 2 are %li%*ed' - If %!e%*)o@es 1 ( 2 are not %li%*ed -rite %') 1 ( %')' 2 are not %li%*ed' 3rite a program -it! - Parameters as t-o groups of #adio)uttons Gt-o #adio)uttons in ea%! groupH' - 8ive detailed %oding as a)ove, to s!o- t!e #adio)uttons and groups - sele%ted 3rite a program -it! - Parameter as %!e%*)o@' - If &ou %li%* t!e %!e%*)o@ t!en displa& first da& of t!e ne@t &ear' - If t!e %!e%*)o@ is not %li%*ed t!en displa& last da& of t!e %urrent &ear' 4' 3rite 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 ne@t mont! - If t!ird radio )utton, displa& date after si@ mont!s'

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

Proprietary & Confidential

Page 55 of 57

ABAP BASICS
Intelligroup Asia Private Limited

SELECT STATEMENTS 1 2 List all t!e ro-s from t!e ta)le .0A7' List single ro- from t!e ta)le 07PA' List up to 5 ro-s from t!e ta)le 0"I"' 4 5 > 7 J 9 10 11 List all 5#=A+s' Aor )etter reada)ilit& %reate a %olumn !eading in t!e list =ispla& total amount for %arrid OLD:' G+a)les/ "ALI8D+H List all t!e flig!ts for -!i%! )oo*ing date is greater t!an :01'0>'1995:' List all t!e flig!ts for -!i%! pa&ments %urren%& is O=52:' List all t!e flig!ts -!ere %arrid is )et-een OLD: and O"K:' "ele%t a single re%ord -!ere %arrid N OLD:, flig!t-no N O0400: and fldate N :2J'02'199J:' =ispla& %arrid, %onnid, fldate and luggage -eig!t multiplied )& 2 List t!e ma@imum %apa%it&, o%%upied seats and total of %urrent )oo*ings for ea%! flig!t in t!e follo-ing format' Carrier id 12 2a@' %apa%it& ;%%upied seats +otal of %urrent )oo*ings

Arom t!e given from-%it& and to-%it&, list all t!e availa)le on t!is route/ Arom/ Pfrom-%it&Q +o/ Pto-%it&Q Gsa& from Aran*furt to 2adrasH G+a)les/ "PAL1H Carrier id =eparture +ime "tart Airport =estination Airport

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

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:H G+a)le/ .0APH Created on/@@@@@ Created )&/ @@@@@ +ime/ @@@@@ 2 A%%ept "ales =o%ument num)er from user and displa& %orresponding material no, des%ription of t!at material and item %ategor& G+a)le / .0APH A%%ept material no' ( item %ategor& )& default PP100 and 72< respe%tivel& =ispla& %orresponding details of sales do%ument G+a)le/ .0APH 4 =ispla& fields from 07PA' =o%ument t&pe N OA0: and =o%ument date N :05'02'199J:' Also displa& num)er of re%ords sele%ted' =ispla& Co' %ode, do%'no', a%%'t&pe, ta@ %ode' 2a*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'199J:, t&pe ON OA0 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%', G=efault

> 7 J

Updated on - Apr 20, 2004 Created on - Apr 20, 2004

Proprietary & Confidential

Page 57 of 57

Вам также может понравиться