festa te
Apap |4
SAP
Be = 3 4 ae
SYSTEMS — APPLICATIONS ~—PRapucTS IN. DATA pRocessinG
AcTORA? ACTOR 2!
SAP BASIS/ e.c/o.e/ oducts
SAP ADMIN. SMe] DE d
Role: 7
Atty. Fe.
Preveg.t = Methods]
= Behavtor
Aaarl,
AcTOR 3:
ABAP|G Tech, Conpultast
Role: Develobrrwest f obj\»
sie
Preveg. i Cduta
eq.) Edu ree
Ce ou, + Above NG
Dernate! Obttonal,
Aogieat ees crondtie
ABAP/G —5 Advanced Buniwar Abpkestion Peogtarorn [ots
Gorertlen Longuoge
Dvb. enact meors crechiog obi is from te pcrateh :
toolk like vyepert urrter, “Yebort pavster, eneou, poister,, “Arnal
forme, ABAP edctor, ‘2 builder | bereers ster “ete.
Enhanced > wileading the pla f erlsting ky» by
sing SAP Madibicattont Csmed), cust» Modi iecktons (cman),i Peinking — een | idea
ABAP 7 w a byt . ped log SAP- AG (Aetive
Globe), rq busines appine io SAP eoviraoment),
to the eo" \a42 by 4 jpronue TBM ernbloyerd.
Previously, ik te only © procedural * Nowa, ot i a0 obj
ertested! long. (ooABaP)
Qo SAP, ABAP im TR prymeing taterace do obp'n
perver ABAP( AS ABAP)
Most the onecbs on AS ABAP com be otgoni-
tad according bo ther take is the | th 4 = otter
chest perver Sorchitecture . Thabe -teers :
1. Prepectction |
oo
3. DB lager
doel
Prebectation layer (SAP GUI | sar frontend) : The brerestatton
\ ds distrbubd tb the workstotions & individual
user W rresesty — uber interface ¢ AS ABA] cals
brocner ( cel dgopee] wxel dyoorater)
pp lager Sus teokiged by 4 or nore oppo PEND.
ae es | contoinn ABAP runtime envixonmest uvitles
in cc WM c++ rare Xo edntch ~ABAP pram ove exeestted .
The abbie sewer + eo tfor lager 4 20 AS ABAP to
chtch apps prges’s ate cuecated:
Moeioly ck constitutes :
1. peice
2G betvice
3: Duspetehnr
4G. Wlotk procebts
Th combinction ut» called Kernel ( heart 4 the oppo Benes)
NiUr SAP-R]3 (OLTP), SAP-cRM, saP- Sem (OCTP), SAP- Bias
Cuar),SAY- BY F.0 (OLAV), SAP-NW-BW 423 moidtatas ABAP stac
(collection 4 Awar|s beget:
Go BLF0, BH F3, BH 3S ave integrated woth Web App
Sewer Wo bol poite cot appre ped £0 Tava Stace oxeb
oppiae clvped io Tava).
Ni Syp'b ove clanafied ist
I. Non —Unicede me
2. Unicode
Now- Unicade sys.) Thine ave traditional Apap yp tn chick
ene charader “Us ubuolly rerected 4A byte.
eq’ AScIl, EBCDIC ys Evteodd Ptoawy Code Decimal
Tatercloorg
Unicode Sp + These ove ABAP pape thal are based on
ae ee
w dB sphere cbesiting mye
B Unicede, SAP uned vaxtous, dil. codes yebrebeati
ee to a poreoae, buch os moc eect al
bin bgte code. page ot double byte code po .
ASCII, EBcDIC ancades every character astth 4 byte
Double byte code po equiva 2 leaften fer character
NiTo knew cchether Ge Byp Undcade or Nen- Unicade
Login to uxt
Select minw ~= Stotus
Unteode Sue + No —> € Neo- Unicode bye
od ‘
Qn SAP emitoonusle, every beteen molstairs beteen bigm,
gut pra » bexeen ournbur YW tranpaction code éte.
Sa eno othe rr yp
Select Sop mou—> StatonSAP Delo
Rebonictor dete,
Trorpadion | SESSION MANAGER
Peqeo (ners) | SRR SAPLSMTR_ NAN--- -
Scteen 00.) ph
Peano: (GUL)? SAPLSMTR NAV.-_-
GUT Stdlus! SESSION ADMIN
To view the fre code, OC on Pra ome
Obperve The ste code.
Obrenclion ! Every perce] deolog'» ove duped to
ABAP | 4-
Mecnory Orgenigction ds ABAP Prume
AS ABAP
1. DB 7
2. Apb‘'o Server
3. Shared Menor
4. User persion
S. SAP Memon:
IL. Mota Sepprion
t. ABAP Sepnion
3 Ioternal Sebrion
4. Dela. objects
S. Progtorn Colle
6. RES Cally
ABAR Stctennesby
AY atest.» thet ore — obened astth ABAP Keyport ote!
1 Tatroductory stadt Mp jer pig
CLASS - Pool.
FUNCTION- POOLSUNTERFACE — Pool
PROGRAM
REPORT
TYPE - Pool,
& Pole (Modulerigstion Sstast.'s)
V0 PUNCTION ~~... ENDFUNCTION —s To define o Ie ed.
&. METHOD ~____ END METHOD —> To dehine o. erat
3 Dichog Module (Screens)
MobuLé ____ ENDModULE ( INcLUDE rq
(@r) MobdULE Poot. Pagro
4. Evest - Blocks
At Line - Selection
At Uner~ Selection
at
Portialigetion
Tob- of - Por
stort “df - Selection ete
3. Source Code Maduler
DEFINE ____ END -~ oF - DEFINITION —> To define. Mactok
INCLUDE --__- 5 Ancluded an Include pra
6 Declarative stest.'s
A DedoTybue Dette objecty
Deltas To deline o vVettoble
CONSTANTS —» To declare a conttast
FIELD-SYMBois-5 To difine je pyrobel
INCLUDE ~> Includes a structure
NODES > Declares a Tole Work Avec
STATICS —> Declares a Stettc Vartoble
TABLES —> Declaves a Table Work Aveo
TYPES —> Declared o reperabe cite type (to defer user
dijned datctabes)
ed (ooABArB. Clabbeb UW Loder pace (40 OOARAP)
ALIASES
CLASS_ ~~ ENDCLASS
CLASS —DATA —> Static Attribute
CLASS — EVENT —> Static @vest
QNTERPACE —> Bocludek on Pater hace
ic. Object Creation
CREATE —DATA —> Creches on anonyrnous dota object
CREATE- OBJECT ~> Crete
D. Colkog ieee Block
CALL FUNCTION —> Calla
on object
ood -
CALL METHOD —> Callb a enithod
PERFORM —5 Callb a -Sub-voutine
RAISE-EVENT > Trtagerh on eveat
SET -HANDLER ~5 ister on evest
SET ~ USER me — COMMAND —> “Trtgger o lest event
é. es ABAP Prarct
CALL=TRANSAcTION
LEAVE To TRANSACTION
SUBMIT
LEAVE PROGRAM
REJECT — Extty
RETURN
STOP
4. Covstvolllt the Pram. Floss
A. Gatrol Structures
DO___ ENDDO —> Loop
CASE _ -_ WHEN —_ ENDCASE —> Bronch ptr.
TP__- ELSE F___ ELSE____ ENDIF —> Bronch stot
WHILE. ENDWHILE — Loop stast.©. Tegtarn -LOLeN peut)
WAIT-UP-TO —> Praca. Sotervablion her a catteio omous
4 tine
C+ Exesptten Handling
RAISE
RAISE — ExcePTION
TRY ___ CATCH ~-- CLEANUP. __
ENDTRY
RESUME EE
+ Valued — dsbigomeat
Move
MOVE .— CORRESPONDING
UNPACK —> Ub: Unbacks a backed oo.
ASSIGN —> Lortialiges a pela syeobel
GET — REFERENCE ~>
» Vnttioligckeon
CLEAR —> Tnittoliges 0 deta obj t
FREE —» ___ Do__-_
+ CALCULATION Stostl®
AbD
DINIDE
MULTIPLY
SUBTRACT
- Character String Byte Stiteg Procenbing
CONCATENATE SET-BIT
CONDENSE SHIFT
CONVERT -TEXT TRANSLATE
FIND WRITE—To
SET ~BIT SEARCH
OVERLAY TRANSLATE DATASET
REPLACE TRUNCATE 4
SPLITa
A6lernot ~ lobe Operations
APPEND
AT
READ TABLE ___
REPLACE IN TABLE
CoLLecT Sort
DELETE
FIND - IN- TABLE
INSERT
LooP - AT___ ENDLooP
Mepbiey
Unex D,
CALL ScREEN
CONTROLS
GET- CURSOR
SET — CURSOR
LEAVE To ScREEN ~-~
OPen SQL stmt's (DBD
SELECT __-- ENDSELEcT
CLOSE — cuRSOR
Decete
FETCH — NEXT-~ CURSOR
INSERT
MobiFy
OPEN — CURSOR
SELECT sina@le___
UPDATE ___
Nekive SQL Stost"s (DB)
EXEC SAL___ ENDeXxec~>
COMMIT — CONNECTION
CONNECTION
ROLLBACK
SUM ___
PelesVYOL® CIOKAALEYD
DELETE
EX PoRT
TmPorRT
ME MoRY
Pele Interface
CLOSE DATASET
DELETE DATASET
Get ‘
OPEN “
READ
SET ®
“TRANSFER 4
TRUNCATE 4
SAP— Memory Obercttowts
GET — PARAMETER
SET— PARAMETER
Débe WoT Faly
CONVERT_INTO_TIME_ STAMP —> Converts a debe y tiene
soho ‘time ston
CONVERT_TIME_STAMP —> Converts a tena stern ecto dato &
tiene
GET_TIME —> Soe doke & time
GET_TIME_stAMP —> Sp. time, Btoeob
N: BREAK-PoINT—5 “To define ow break pu fer deeageing “Pg
Siptiro Pelle ( predefined typ. var!s)
*SY— DATEUME —5 Cunvest yp. desta,
SY-UZEIT —> Curvert sy. tine
SY— BONLO—> Locol Tne Zone
SY-UNAME ~> Lo Uper Nome
SY- LANGU — Logon LanguageSY- MANDI —» Losin Cleo No-
SY- HosT —> Nloene of the app'o ewer
Y= DBSYS > Noma the Backeod DBMS package
ASY- SUBRC —s Return Code + ABAP stent.
£Q To $—> Kucceds
NoT £& To ¢-5 fodlave
SY— FOPOCS > Gaver ofpact 4 bubstre ater the
eneccition 4, “Search? Cararoond
ASY- INDEX —> Une inside Do __ ENDDO Btect. ond
WHILE ___ ENDWHILE Joobs
To at pequence 90. Ley 1,2,3, —
sy-tana® 5 Return curvent)
0. i ord no.
a 4
~*ASY —ABCDE _, ee
ee
Ni There are 2 main blocks to a pry
I. Declaration block — To declare vat.ls
2. Procebsing block —s Tf, perforce coleulationk UY data :
DaterTy pen - cram
Thase ave ured ker creaking | deforog | declaing olde]
Vor] date obj." | aoly.
Eq Data! feet Type Qu CHAR
Date ob). DatorTabe
DaterTybe fo sap-enifpt fer foley
1. For Chot.49 + There ore G
1 CHAR ( ron. 60) —> Character String (a. combinshion
its A-2, bectal characters $35 M,
lt git o-9 W underscore)
2. NUMe (character stog catth only depth (@-9))i Ni Select Create Tr
2 VAIS ( dole BYYYYMMDD Alored ab CHAKL BI)
q. Tims (time jjeld hhmroh stored os CHAR(s))
Creche a chor. To.
€q'- SMIDU
elect ux chor. to ect. ccm —5 Croke 20
Name > SMIDU
Solermnan ID el
DT:
! CHAR
lan) @
Creche tty.
relect otty.'y tab
NAME AGe
CHAR, Nume
20 2
Actiyake
. qrercts DDI obj'» ( tobles, table kiclde, dota clerner
e domaing » indies, viecos, PKs ate)
Dela Elemest | | BIcfotsmapu
OT ~» Tofodbject
D-c on dete chenus
Tt meratetas dots dormein
Domnoin | | ere} OSMI DU
D.C on the donoain
Gt netatatns tech. iefy. + the feld
Deke. T.
No. chavachers
Decimal Placer
O|p Length
Goverrion Routing
3
Routine Leon
st opw bie code2. For KBy! There ore 6 detartyber
WO Amount- corr (1,2)
ay Suocstite — QUAN (14,3)
WD Nonober— Dec (14,3)
OD Dateger — anT4 (16)
WS) Date pec(i#)
9 Time — pects)
Other Dette Typer Dect. omatvy (PDE)
(sea ea
Lage to sap-R/3, BA, cRM, af fap'n
Ester SELL
© DBT: ZTABLEL
pelect Crecte
Deve!
Delivery Clatab! A
Dota Browher
Fildo teb
cusTID
pdect Built-to Te
DatoT he L check co the browser
There ore 24 datatybee
ACCP Posttag Pecad YYYYMM
CHAR Character Sting
CLNT Clheest
CUKY Cosrtency Key, refptenced & CURR fields
CURR Cure \peld, plored ab DEC
DATS Date eld yyy mara) Blored at CHAR)
DEC — Coustter or ommoust [eld astth comma BW Aign
FLTP locking ft 00, accurelte to Skater
INTA A- byte westeger » ete
INTA
in th Date D
Dexpleq | Motttensnce allocsed
no: <=255"aN AY
LANG
LepR
LRAW
NomMc
PREC
QUAN
RAW
RAWSTRING
SSTRING
STRING
TIMS
VARC
UNIT
KF GO alee mneisteie date clement
[orc] ot PaTys
> KF nene
Dete Domino to RSKYP XxX pte U time
here xxx —> aA | Amo [swenum/ant| NOMp
Lt dabends bon “the datatype cde pelected
Everg 10 2 MATID caill
4 Jarc| matzo
ao 20
40. MaTID
be: [etc]oimatzp
D+ Dorn. : [Bate ]OMATID
Fedd | [aac] matap
Table» : [ate] Pmatzd
Jetcja matsp
[otc/S mataD
Jatc) xmATID
[atc }ymateD
[orc] MMaATID
letc|/tmatep
| 8ac/H matsp
Jase KMATID
be conveled into a eld
AMATERIAL — Feeld MATERIAL
Jere ]2 matzo
Joc] matzpOsreiipe wo ABAY]Y et
DebaTyfe Dene. De 2 Frittol Nelues
ie Text (choracter) ss ppace
N Nomerte Text A ‘$d.--p?
D Dete (YYYYMMDD) 8 bb4S4h46¢
ao Tene (HHMMSS) 6 “fbbooe?
X Heradactenal (Hex Code) a: Kgs?
ce Idleger . b
P Packed Nurober 8 d
e Flocking ppotst ourrber 9 4
Tobles % ABAP Pegro ube jeelde onl
To Toblr t
af tRe cube nome to Ic_HP
Jeac| Ftc_yP
Jorcletc_up
|oxc|Dac_nep
orc Jo&c_Her
Jere | DIrc_ HPU
Jere] pte _ HPL
po
gfe
T
k the ODS tase SODS_HP
| ®2c] Asons_nepé (AvT)
|Bic [ASoDS_Head (NDT
Jerc] Asovs_APSP (Rell back table)
[nic [Bd94.4445900( PsA tobl)16S) JBIC] Coxx DSNeme
C6: |arc}est6Neme
PSA table‘ |Bac] Bann — - bodiget
Nerotng Ceminstows to ABAPIY Praroding
There Sore 3 ate Camvenbs ons
1. SAP ce, SAP i obj.
Dn thie cane, obj. tech. “nena tails eat albbobts
A-2 wW degits g-9
Eqi- MARA —> Matercal Master Toole
Cus a cat defined obj bs
To thin cane, “the obk tech. names oust be prefined cout
letter Y or 2
eq:- ZPACK _ SONY, ZTABLEA, ZPREMA
SPAR ce (Pavtae cefirad obj
Operctowrs
1. Avethenatze opersttor a ue » MOD, DIV, %*
Ni Who Gu + working astth xitore A ceed te roaistes
one space. oo Lath Be i" chevatter. :
To csork with the operators, 2» Ww need to ure Cpetandy .
These ove cred jer peony actitmelic coleulotions.
8. Rlctrowal opexctory ) These ave ened hor compartnionts
The resutt oll be ohesaas true or foboe-
= (€@)
< (ir
> (6T)
>=(6e)
<=le)
<> (NE)
Ni De th cornbartiston thet Ww con une tyrabale oy
Lrteroly.3. Legteal obetdlorg : “these core, ned combining “the
Conditiony » Result w alco trae ot flee.
AND
oR
NoT
BETWEEN ete.
Develobenest Clos cov Package. (S28) (Rok: sAP_ Basis)
ar alt, SAP fyb'b mncidtoins g Pkq or dyp.enent clase
TMP.
Mears teenporaty pha Jhoced bea | dub. must clan.
The ae” wo 3 the Pea canadl be ‘banpbartoble
> 2 landax qe landocepe { dp ment, tubog, product-
To be tr ottoble , Ww med to pave th chy Lp ope
non-local P v ce, other thes $TP.
Ni Koous ur pka- ing to stovt ur cork.
Creckion 4
Pka. (SES fo ol a)
a ke: (S€28) (fo all sap a)
peect Edet object
" Np. enesit coordinction tole
Pk > ZPACK_HP
pelect Crecte
ST! Pls PACKAGE
sles ea Home.
Pha Type Nat a rete Pee 7
Moin pk
helect Sove
Pooratt yr Lecal Workbench Request (metre)
The Yequast fprenat & XXX KInannn
odhere XXX —> abo bp ID
K > cust vy} mest
qoonnn > 6 deat tateger po pepeed with dgt 9
nee byEver yegquest meisloins a Task.
Everg ‘tank tb abbignd ith objectn.
Ni U con creche a mun request
U con choone ony entoting [old tequest
To cect a cece yeqerent
Create
Shot Dene! HP'S REQUEST
oases i one seo
Heo te teach avd Asari
Ester ABAPDOCU —> ABAP Documedlation R Examble,
Exp. tthe -nodes —5 exp. datectipber BW dette. obj."
De oo le bya ore he ae the lp > F3
Read the pr. . — > omite the pra
Open ABAP editor —> T we 3 bYory
Se
Geto nd Pan elemesstany type > excite» ~~~
For docurnentetion on bagesorde
Ester ABAPHELP
Ester DATA coord > obrewe ‘the decumentote on
pelect wotd Search
Enter WRITe kageoord —> obberve the documustation.
E~
fn the ABAP edetor , exit “type ward
Eq: PARAMETERS > place “the cursor oo Fegvoovd ~
“pruse Fa
ABAP Edttor (S€32)
Esler SE38
ABAP Editor 3 Initial Screen
|
eT St ty Bh) Laat Vetodl] Nout
Progtacn | [Create]SUL objec
O Sour Code
O Voortonts
O Documactetion
O Atte.R
OTeit Elernactye
Derplag [change |
Prqm- te on obj extth | poalbobj'» lke eee ey
docurmstetion, oltre, teil elenserits , ete.
ABAP : Progtonn Attribaley
ee
Ongionl Lange:
Created Torzol. 200)
Lost Choad
Steotun | “at
Attr.'p
Type :
Stetus!
App ‘o!
Authortgstion Group:
D Editor lock,
Peed
powst acttth mnabic
OY Unicode checks active
Atty. toclude | tym, totus 4 5
nips ie oe rd bq +
( raed ant ob) YX authergation qeup
% B + taro» tocluder |
Ereciloble Fie
QNCLUDE
Module poolBees, pool
Trter foce pel
\
Clore
Status (parpore) ‘ | amie produclton bryce
adbtomet “ .
Sapiro pager (ost for appre)
Teast
egen. (dub. enurt saps. th tention map
cia (oaiane 1 pet
at
Cost HAccousts
Grob — Abb
Curtsmer branch
Pinenctol Accouste,
DASS (covtrol statsds)
Eaterprise Dats. Model
Obj Tae ler the Peqeo.
R3TR PROG
Prana, Nearne
R3TR > Real Tere 3 Ther
1. Preoedt ction Ter
2. WH Abbi ‘
3 DB "
TR Tronspoit Request
PROG —> obj ee
Obj ts trerpporteble
Tou pave the obj.'b under i
borer | $IMP, thes the obj's ove ofl
ABAP Editor
A ort Prano
w stabs att o kegusord REPORT
[ Nogaed gro nome «
Te Une termtoator te &,)
Place ‘the cutbor on REparT keywotd > predp PA.ee ee
in aoe 4 “the aeboit”
Typ er code tn the editor
Save —> Check, —> dretivote
(coropile the Py
Corapilstzon tp a proce 4 convertion] taterbretats on.
The » etl) convert the we code esto tbs ovo
enka stend oble cook.
Fert , ct ail heck “the raster iz, afore 4%
par ‘nq lang: ie, ruler wy Tequiations Wn & hang
26.09.12
ey Comparision Oberaitons
CA—> Geteiod Aci
New ie ees ‘steong The existance
ee + “the mala
8. CO—> Cocteiors al
Nex}ies noi ptt the existance. only sshecified
nae in ‘the ee F $ ¢ +
Eq STR = ‘HYDERABAD’,
STR cA
STR CA
$ omy om
‘MNO’ —> Fase
PAR? > TRUE
STR = ‘ABBAS’.
STR co ‘aR’? _s& False
STR co
Ni There ore 2 tapes 4 Debbi to ABAP
i | Detok are + Tt tecluder |
a Pre defined kt
Gd Uper dered
AQ Structured Datok ype
Ni Détat i 0 eal ured to define create
( Field
‘ABS’ —-» TRUEW) Structured
diy Internal Tedoles
r—> Fields
DATA—}—> Stradturos
> Tsternal Tables
DATA elds tape © Lerth so.
~ objet) Y ath
ars | dstatybe ae allocation
Keexjesore
Date Objecbs These axe erected jroo dekatgbes catth the
hel 4 2 kugosords,
|. Dada
2. PARAMETERS
DATA waord get declares. Variable
PARAMETERS daclores 9. Neste i a tokes Volos for
ct torn endiurer.
Ni We con pimulote thy ts Vortables in Bex sparing.
Types : ng ee kagoroed ured “to cline customer ckfined
dat per:
Bee yal type f voxtobln
BATA PNAME TYPE LENGTH 40.
DATA PNAME(40) Type c
DATA PNAME(40).
DATA cusTNo TYPE N LENGTH &
DATA SALES_DATE TYPE 5
DATA SN_TIME Type T.
DATA AGE Type 4.
DATA AMOUNT Type P DECIMALS 2.
*P > Packed Number
The kaguords ‘Type’, ‘LENGTH’, KDECIMALS? ave optional
Sapa dctetape Lor cae
Default Imgth th 4 charoster.pee MacinNod ANe ZY.
NiTthere ore 4 type Delo objects,
Detooby. | wo Varioble stores] olde dite. dt ocenwpiets
meroor:
1. Gstermol Dataobj? Ey! Letters, Constante
& External Deloob).: eg! Internol Table
3 stenn delirnd Dotwobj: Ey! SY-SuBRc, SY-anNDEx,
a ae d d SY- FDPos, ____
4 Specta Dato obj. : oa PARAMETERS , SELECT -— OPTIONS
Leteroby:
eg DATA: VARL TYPE T VALUE POdg.
Constants!
fa VARA TYPE 2 VALUE 4gs.
External Detaobj.'» :
&y Crection Btructure Yo wternol tabley.
Cedar Abr" al tshetnol tables)
Parameters | af u oat ts ‘prompt - -- her enduset
: PARAMETERS: VARA LIKE
oy
SELECT - OPTIONS |
MARA-—MATNR.
Eq SELECT-OPTIONS ; VARS Uke wank.
Ni Tt w& pormbl to define & Varvichle ubiog onather
eT
DATA! VARA(I0) TYPE Cc,
DATA. VAR2, LIKE VARA.
NARL = ‘Goop moRNING’.
NARZ = SHA’,
write :] vara
Weite:/ ‘varz vara,Mow do UW cYeole a char. IO ci Type PCALDAY LO t
Peeled) ay clbal TO) col eye Geta
Chat. | BXBEAK DATEX
Dede | Deke
Reference ob . Pcacvay et
Activote
A UNcix obj
coabb metadata. properties R shaved dato
Go sap ABAP|G , the eprence Sonia bay Hoe hago
“LiKe?
TE ue popnihle te declare var's or Ltelds 2, weld
= ta ee ey be
DATA! VAR Like MARA-MATNR,
hep w a bad practice.
The good
practice ob abe debe clemnust?
Logon te SAP ~R]3
Ester SEAL
ODBT! MARA
Dasplasy.
Feed De
MATNR MAINR
A! DATA. VARA TYPE MATNR.
VARA = ‘steeu,
WRite:] vara,
Bad Practice
DATA! vaga
LIKE MARA- MATNR,.
VARA = ‘GoLD>
write: | vara.
N: After covtking the bre code
I. Seve the
rt a aen~locol
Pea: with a gee TR.
2. Chuck the pry (compile ‘the bran),
be, bop cooverbs urer- lang. (Engh) tte ay.
undanitandeble long by using o corebiler / treo Ishey.Vor Lib process re toons of the Bic cade cou oe
vera
3. Adteveke
thun u odtivele the pare, an obj ea) be qr
A poypseel reenary oth” be allocated.
4. Crecube
The yp: al titerbrets the machine cade (bite & bytes)
converts isto unr andinttandable lag, uw providers “the
teosult:
ABA] G Practice | Dementtyattons
Banic Stast.\s Practice
Logon ‘to eng SAP saP- eh] er] R13, APO, BPC,cem-—
Enter SE3B —> ABAP Edttor
Pram. 2PRGEMA
© Src Coda
elect Creche
Tetle: PRACTICING ABAP{g
Type | Buccitable rao
Stator) Test pra
pelect Save —5 enter ux re —> J ath Te
Opens ABAP Edztor
REPORT 2PREM1.
¥* To dip on op atest.
write: ] © Go00pLuck’ ,
Save —> Check 5 Active 5 Execute
aN A ‘waite’ keqonord choy needs a result volue of a tg:
To commest “the [tne
Aelect th bic code —> tlt lich —s GsernmnestKK “Practice
% CONDENS
DATA! STR TYPE C LENGTA 40.
X Antticbige the Vorteble
Ste =* NAIK 15 A 90D
weie:} ste. (apive:] BEFORE CONDENISE - sR)
CONDENSE STR.
werte:| sta cover 4. (wrte:] SAPTER conDENSE’,
STR coLoR 4.)
sting Carornendy
B MAN?
[=> cee Nine
Gove —» Chick —» ABétivele fucube —» &3
CONDENSE STR NO~ GAPS
werite:] Sage AFTER No GAPS’, STR.
Pe ey ee Actoke ts eye de
ofp: BEFORE conPENSE NAIK 1S A GoOD MAN
ae APTER CONDENSE [NAIK IS A G90D MAN
AFTER No GAPS [NAIKIS A GooDMAN
NiTo deep! ryston » ubagey eg'n lor a waord ,
© pler tbe curbor om CONDENSE he ef prose FA
Obes ABAP kageoord documentation.
Ni Gromest “the ste code
pelect the Bie cade —s CM —5 Gromer
% RRANSEATE
CCONDENSE? th ubed to Yeroove only leading pbacelp end
blanktg in “th beginning + the jest word and last coor
CONDENSE STR NO-GAPS is ured ts Yemove leadin.
abacus ob well ok the sbaces bto the coords a
XE TRANSLATE
boo wasord to converL wppercane letters be lowercase
Setter ( albhabets) end vice verb.DATA!
STR TYPE ¢ LENG SO.
STR =
i
© RAMALINGESWARA RAO’.
WRITE:] ‘ BEFORE TRANSLATION’ , STR COLOR Y
FRANSLATE STR ‘To
write: | ‘Arter
Seve —» Check -» Activate 5 Creceite
Obperve “the olp —> €3
NoxSTo
LOWER CASE
TRANSLATION’, STR CoLoR S
veblace Recut deget ‘2 SM) cath digits?
ae an eee . fa TO UPPER CASE,
TRANSLATE STR USING ‘R2am55q’,
WRIT e:) TRANSLATE USING), sTR.
Sove —» Chick —» Aetivele 5 Execute
Obrerwe the ofp
TRANSLATE STR USING ¢ .
Write: | s1R cotor 2,
Ni Genmest the sie code
KR CONCATENAIE
(Seas wsord abed to combing the bretal ste teto
oe bio Bhre c
DATA! U TYPE
G LENGTH 40,
Ve Pee CeCenG thio:
Wl TYPE <¢ LENGTH 20,,
STR TYPE oc LENGTH go.
U= * HYDERABAD’.
Vi= “metrRo’.
W =
“PeLYToN city?
) © BEFORE CONCATENATE’, Y CoLoR g,
write: ] Vv coor 3,
WRITE: ] W covoR 2CONCASENAIE U VW INTO STR.
Write :} “COMBINED STRING? , STR coLoR S.
Seve —» Cheek —» Activate — Crecote
olp: BEFORE CONCATENATE HYDERABAD,
METRO
POLYTON City
COMBINED STRING ‘]HYDERABADMETROPOLYTON CITY
CoNCATENATE UV IW INTO STR SEPARATED BY SPACE
wene:) “WITH Stace’, s1Q cotor 2.
olp: WITH SPACE |KYDERABAD METRO PoLYTON city
N: Separcted Abactb, comnrnah, ong Apectall chor acter
ete. epee
CONCATENATE VU VW ONTO
STR SEPARATED BY Sx xy),
*%% SPLIT COMMAND
Dt Y obbontte to SCoNCATENATE commaAND
TH divides a stye isto ult she ot “the
reed chewed tN ES As
SPLIT STR AT Sx%X? ONTO vo VW.
weite:]/ uv.
waite: ] v
WRITE? J W
BF.091B
** * SEARCH COMMAND
For documedtetion , type SEARCH —> pres Fa
D.c on the Search
To kes ~ pabsstring in ow main hing, ese Ube ‘SEARCH’
Covornend:
Alter the ection 4 th commend, olonerve te veluws
the bypd- field SY-SuBRC, SY-FOPS
The Poy ucld SY-SuBRC rroisteim® § fy the recently exces
ABAP Btet. ib puccedrbal on correct
a te ABAP Alt. Up poled, then tt ill meiddetn 0 Etre
volue.seld SY- FDPOS = moinloi? pret $ “The ore ene
ime .
to the rool Btsing -
ie fl Weer
& STR = ‘HYDERABAD. yi
SEARCH FoR ‘BAD. ete
SY- SUBRE =O
SY- FOPOS = 6
k%* SEARCH COMMAND DEMO
DATA! STR TYPE C LeN@Tit NVALUE UWYDERABAD.
SEARCH STR FoR ‘Good’.
ae Sy-suerc = ¢. ;
Werte:/ ‘THe wWorD 1s nls® FOUND,
ELSE
Weite:] “THE WoRD 15, FOUND
Enbae,
Sove > Check —> Adtivcle 5 Emecale 5 Obreve 5 FS
SEARCH STR FOR ‘BAD’.
ae sy-soare = g.
werte:] THE Word 48 Found’.
eLse
werte:] ‘THE WoRD 46 Not FouND?.
Enver.
Weite:] S¥-Fppos.
% TRANSLATE ComMMAND
%* WRITE A PROGRAM To TAKE A PERSON NAME FROM
ENDUSER AND ConNERT THE 45T pet LeTIER Into
UPPERCASE AND keeP REMAINING LETTERS IN LOWERCASE,
PARAMETERS! PNAME TYPE C LENGTH 50.
Write:) ‘user ENTERED Name 25:’, PNAME.
TRANSLATE PNAME TO LOWER cASE.
TRANSLATE PNAME+ $(4) To UPPER CASE.
weite:] “TRANSLATED Name 26:", PNAME COLOR S-Sone —5 Check — Adlivale —> Execute wp Obbearve The ole
F3
d() ! gr ofr Velue
A» Lengtts
Blip: SAP BUSINESS INFORMATION WAREHOUSE
dp: USER ENTERED NAME 15: SAP BUSINESS TNFORMATION
i WAREHOUSE
wortchow:
TRANSLATED NAME 45: Sab bubinebs inferno:
ols
XH Proqtone to heteo the phercut ame with &
fee 2 ge came
PARAMETERS! PNAME TYPE ¢ LENGTH 5$,
DATA! INIT_NAME TYPE C LENeTH Id.
DATA a7A@ TYPE TABLE OF gm cHARZP. “ aternal Table
DATA WA Type cHARZd. “ Work Aveo
SPLIT PNAME AT SPACE INTO TABLE TTAB.
LooP AT ITAB ANTO WA.
CoNCATENATE SNIT_NAME WA+¢(4) ANTO INTT_ NAME,
ENDLooP,
WwRite:} PNAME.
Weite:) INIT_NAME.
Sove —>
ae: PNAME — bop buntawss tojorenakion warehouse,
o]p: SAP Business
= seaw
%% Witte oe pign to count the occurance 4 alphobet ‘A’ &
& qe Aeslenee.
PARAMETERS! SENT TYPE C LENGTH 24¢.
cp DATA LA TYPE
; DATA] C27 are
PATA N TPE L
© CoNDENSE SENT NO-GAPS,
a.
AyTRANSLATE SENT USING “BE YA
CONDENSE SENT NO-GAPS
L2= STRLEN( SENT).
Nie te oe
write:] “No. oF TIMES THE LETTER A occuRED IN THE
STRING To ty cot ap a.
Soe —> Check —» Activote 5 Cuaite
ap: RAMARA® VENKaTRAO
olp: No. oF TIMES THE LETTER A OccURED IN THE
= STRING Is: 5
KX Werte ao programs to take a pectence deen enduser
aod divide this restence
ecto GY pobstre oot
equol leojths. Ratko Nexoller
PARAMETERS! SENT TYPE ¢ LENGTH LSP
TYPES INFooRtect
TYPE C LENGTH of,
DATA: Goes ‘TYPE INFOOBTEcT,
4To@BI2z TYPE INfooBTEcT,
ToBIS TYPE INFooRtecT,
ToBTG TYPE AINFooGrTECT,
ToBI4 = SenT+ b(6).
TOBTZA = SENT+64$(64).
1oBTZ = SENT + 129(e0d).
ToBTG = SENT + 194(6¢),
WRITE:] DoBT4 coror 2.
WRiTe:/ ToBT2Z coor 3,
WRITE:] doBt3 covoR 4,
WRITE:] DoBTq cocoR s,
Seve —y Check —> Activate —> Execute
Tn th by, wo won SPLIT commend ue broken theAlepl: ialD ouloSDe of Atpovale, VoriaHee.
net “Types” kegeoord Ga con creche ub ar oom dostectgpes
Cunet~ defined dct styper).
*% Write o pra: to very the cosrest logoo abet name
and check —eshether tt contetns a digit of nat.
WRite:/ “Your User aD, SY-ONAME, | “t
Sf SY-UNAME cA “PA 234So4Rq.
WRITE:] ‘Your UseR 2D CONTAINS DIGIT,
ELSE.
WRiTE:! “Your USER 4D CONTAINS No pigit”
ENDTE,
Seve ~> Check 5 Activcke 5 execcte
lp: YOUR USER 2D sppuser.
_ YOUR USER 2D CONTAINS No DIGIT
*% CONTAINS ANY (cA)
DATA STR TYPE c LENGTH 24.
STR = “HYDERABAD’,
SF STR cA 6 Goon?
write:| “THE word ts founD?,
Else.
Weire:] THE Word 256 Not FouND.
ENbaP.
Save—> Check > dctivte 5 Create
UG cey cts oe coviteins ‘D?,
“Tet 'D to anotleble
ox bebbence.
XX CONTAINS ONLY (co)
DATA: STR TYPE ¢C LENGTH 2g.
STR = ‘HYDERABAD,
GP STR co ‘HYBAD?,
waite:/] ‘TRVe,
ELSE.
twRite:| ‘PALSE?,
ENDIF.To eK
28.09.18
** Pr
** DO_ __- ENDDO
DATA N TYPE £,
DO 2G TIMES.
N = SY-InDex - 4.
4
weite:] s¥-aacpe+n(8)
ENDDO
tie to dexplag. all appercane alphabet in pepav ate
lonw..
Seve —5 Check —> Aeativate > Crecute
al
Wino we>
F3
%*X Duh
DATA N TYPE
Do AG TIMES.
£.
waite :] 5¥-aacve +4(sy-tnved
ENDDO.
Sove ~> Check —> Activete —> Execute
olp? A
= AB
ABC
ABCD
F3
DATA N TYPE f.
BO as TIMES.
weire:} sy-aBcpeE+ SY-INDEX(4).
ENDDO.
obphobets op A AB ABC ABCD ____nr 1b prot tne pyralum dete WwW Lum.
Write:] © system DATE! , SY-DATUM
WRiTe:] * s¥stem time:’, s¥- UZeIT.
All sp elds tekes the Vvaluos fiero te saptero
*x% Progtarn to toke 3 better month nome BR alas) [yor
enduser ond conveil the rare uite ments oundoes on
cerplag the molly number
PARAMETERS MONTH TYPE Cc LENGTH 3.
DATA M TYPE &.
DATA STR TYPE C LENGTH 36 VAWE “TANFEBMARAPR
MAYTYN TUL AUG SEP OCT Nov DEC.
SEARCH STR FoR MonTH.
Te sy-suBre = ¢.
M= SY-FoPos |2+4.
WRITE? / © MonTH NUMBER TS’, M coLoR S
Else
WRite:] © INVALTD monTH?,
ENDIF
Reeve Chet the ea
ap : MoNTH : APR
olp:MonTH NuUmeer Isig
%* Programs to convert a gwen date wo the ereoet 20- 00T-
2010 © isle Sap horenak YYYYMMDD.
PARAMETERS UDATE TYPE c LENGTH 44.
DATA CDATE eee
DATA =D TYPE Cc LENGTH 2,
DATA M TYPE c LENGTH @g.
DATA Ves bee Chena TH Gq:
DATA DAY TYPE N LENGTH 2
DATA MoNTH TYPE N CENGTH ae
DATA YEAR TYPE N LENGTH G
DATA STR TYPE ¢ LENGTH 36 VALUE ‘saANFEsmMARAPR
MAY TUNTULAUGSEP OCT Nov DEC’,SPLIT SAK ULAIE AL ‘—* GNTo DM Y,
DAs 2D:
YEAR = VY.
SEARCH STR FoR ™,
MonNTH = SY-FDpes}] 3 +2.
CONCATENATE YEAR MoNTH BAY SANTO cpATE.
WRITE:] ‘GIVEN DATE 35:7, UDATE coLOR 3
WRITE: / ‘ CONVERTED pate IS: , CDATE coLoR +.
Save —» Check —» dclivote —, Execcite
a)p: UDATE: 10-ocT- 2oz,
** Progtocns on dete obevalions
The isternel lero df, the date os YYYymmop.
Wnt carn age dole yeloa ony foro, th e@ coll be
comvetted “isto YYYYMMDD pprenst outtornctically.
The fpllocsing ote the dabe operslions “that wel can
perfyree on dake Valu
Fo dak
foe ote oon be cernpoved bg 7 el adaaral:
oberatorh like <)>, <2, 55, <>
2.A lower date volus con be subtracted ,rewe hegher
dete value no. 4
The vesult is displayed tn 4 bto the given dates
The higher date const be pubtracted keen lower dafe..
3. A nurnher tebresedti n° dk oo
md aa EH pe nt
The veoult will be a ure dete,
G. A number vebreneste Ne. dow con be subtracted
sord a dake volue 7 4 t
The teow th w past dete.KKK far “Lo Cees a dole THM) ewdubet and To
repos che ck ‘to dogs moth, get Vober fre th aod
dem pleg then
PARAMETERS GDATE TYPE D.
DATA: DAY TYPE N LENGTH 4,
MONTH TYPE N LENGTH A,
YeaR TYPE N LENGTH G,
DAY= GDATE +6(2).
MoNTH = GDATE +4(2).
YEAR = GoATE+ (4).
weite:] “pay as2, DAY coLoe 2.
WRITE:] ‘MontH 18:, MontH coLoR 3
WRITE: / “YEAR as:?, YEAR cover 4.
10.04. 2010 cunweited to 2513 8915 “Wet volowr
%% Programm to take & deters rove endurer ond vex},
cdicther bongs sto bare costenny or oct. t
PARAMETERS GDATEA TYPE D.
PARAMETERS GpDATED TYPE D.
Te Spates + (2) = GoaATe2+ 42).
Wigs) ley ee one CENTURY. COLOR 4G,
ELSE.
Rites] ©
ae THEY ARE Nol SN SAME cenTuRY? Cotor 3,
TP: GPATEL: 10.0% 2010
= GDAIEZ lo. 1. 2ole
ole: THEY ARE IN SAME CENTURY
+% Rego to od ovat dog dete y fast doy dote, 4
mon + & given month
PARAMETERS GDATE TYPE Dp,
DATA FDATE TYPE p,
DATA LDATE TYPE p,
FDATE = GDATE.FDATE +6( 2) =
LDATE = GDATE
Loate +6(2)=
LDATE =
LDATE+ (2) = ‘64.
LDATE — 4.
write:] ‘User GIVEN DATE:*,
WRITE: | “FIRST DATE CP THE GIVEN
LDATE =
INRITE :| “LAST DATE
t/p? spate
olp: IS\O2010
oa ©4110 2010
31102,010
(pa.
“pa.
LDATE + 33.
G@DATE covor 3.
MONTH 2,
COLOR G,
oF THE GIVEN MoNTH?’, LDATE
COLOR S.
Fpare
IS. 10. 2010
Xx Progroro to fod the ast dog + Pevtours monte ond
oust ea 4, real ent
PARAMETERS GpDATE
DATA FDATE TYPE
he a i date.
TYPED.
D.
DATA LDATE TYPE D.
FDATE = GDATE.
FDATE+6(2) = ‘f1?,
FDaTE = FpATE ~ A.
FDMIE+6(2) = 41’,
LDATE = GD~ATE,
LDATE+6(2) = ‘gad’,
LDATE = LpATE + 64.
LDATE+6(2) = (ga?.
LDATE = LDaTE - 4,
WRITE:] “GWEN DATE? , GATE coLoR 2.
WRITE:] FIRST DAY OF PREVIOUS. MonTH:?, FDATE coveR 3,—
WrITE:] * LAST DAY of NEXT MoNTH:, LDATE covoR 4,4IP+ 049,04. 2010
olp: Ol, 08. 2olo
3. 10. 2010
XX Progracn to os fibe | aa 4 dag toa
PARAMETERS: YEAR TYPE N LENGTH G,_
DATA FADATE TYPE D,.
DATA FADATE TYPE D.
DATA N ‘TYPE T.
FADATE+4(4) = YEAR.
PADATE +4(2,) = A’.
FADATE +6(2) = ‘da’,
YEAR = YeaR +4.
CONCATENATE YEAR ‘44? 6 ¢4) anito
a to
F2.DATE,
N= F2DATE — PApaTE.
WRITE:] “No. of pays IN THE Given Year’, Year
COoLoR Cte
alp: YEAR} 2010
“ofp: 36s"
** Progtars to jo the day boo er roost + ‘aa
PARAMETERS YEAR TYPE N CeENGTH £G.
PARAMETERS MonNTH TYPE N LENGTH 2.
DATA FADATE TYPE Db,
DATA F2DATE TYPE D.
DATA N TYPE &.
Fipate+d(q) = Year.
FADATE +402) = MoNTH.
FADATE +6(2) = (41,
FZDATE = FADATE + 33.
F2DATE+6(%) = \ ga,
N= F4DATE — FADATE.
WRITE:] “No. of DAYS IN A GIVEN MoNTH oF A yeaR
g6:”, N covor 3.ap. YEAR 2010 2012
MoNTH gr d2
ofp: 2% 24
01.10.12,
xxx P,
Yogtom to eon
4 bith 4. peter fron end
ure and dup
hus ae Yeon, ae w dogp:
PARAMETERS poB TYPE Dp.
DATA N TYPE GT.
DATA YEARS TypE FT
DATA MoNTHS TYPE T.
DATA DAYS TYPE @.
N = SY—patum — pos,
YEARS =
MoNTHS
DAYS =
Weite:]
N DI 365.
(N Mop 365) pw 30
CN men 305) mop zo.
“YEARS?” YEARS color 3, 30(10) ‘MontHs?,
MONTHS COLOR Sag (a) DAYS? , DAYS coLoR 6G.
Save —> Check 5 Aclivake — Execute,
ap: Dow : 1$.\0.1980
Pe Nene a oe eG
A*K Struckuve Type Aod Stracture
Naxicbler
* Creche Vertcbler |
DATA = RNo TYPE
DATA NAME
ic
TYPE C LENGTH 20.
DATA FEES TYPE Pp pecimacs
* Credle a stractuve type:
TYPES: BEGIN of Ty¥_sTRUL
RNo TYPE I,
NAME TYPE © LENGTH 20,
FEES TYPE Pp DECIMALS, 24,
END of TY_sTRU.4p 10 Call o AUruclute
% To cote a trac. Vor
ae pATA KL TYPE TY_STRU.
Ram (Pegeo. Mernord)
RNO Cr)
keg Nort Wh
NAME (Cc) ther enemnorg albecelion
ke 20 I
Kk 9,2-3
Structure Vertoble
Ordinary Vow'g ove ured rr holding one Volue ct o time,
cshete oy Struc: Vow! are bed pe holding cou.ttople Volt
to ay. cocopesiLenersbo eb tea
To ctecte o struc. Vor , brat we dake o Abrus.
cstth the help 4 Kapa TYPES, BEGIN of, END OF
Sy 7 the ve
Vatp ob we cad
eye eitl| be mnastoined ier struc. ‘types buh crunx
call be anatdtained strac. vara,
he todividucl elemuite 4 o Htrac: type ate celled Cambor
ot Lields.
Gr ‘the obow eg!
RNo, NAME, FEES —> Consponerits | folds 4 the Hewes tye
a TY_STRU.
TY_STRUC —> Struc. Type
pe use can crecke ab coon reaKA > Struc. Vet (Strac'p)
KX Pram on Structure Taber
¥ Prebsse o blu. tape ecoth book ditaila [tke eae of the
bok, petce the book.
Crocte 2 Brace vot, ror tt BR moictein bere daha to
hero
it book.
Froebbey cespley the tern 4 the consttter
*x* Deine Struc. “Type
TYPES: BEGIN OF “TY_BOOK,
NAME ‘TYPE C LENGTH 20,
PRice TYPE P DECIMALS 2,
END OF TY BOOK
%% Creste struc. Vow :
DATA: SA TYPE TY Book.
DATA! S2 TYPE TY-BOOK.
%% Ester debe
S4-Name = ‘MATHEMATICS?
SA - PRICE = S00.
SL-NAME = ‘SociAL stuplEs’
S2-PRICE = 400.
Te SA-PRICE > S2L-PRICE
weie:| ‘THE cosTitest Book 1S, S4-PRICE CoLoR &:
ELSE.
waite:| ‘TRE cosTLiest Book 1:1, SL-PRICE CoLoR 6.
ENDIF. RAM
Struc. Type
cambonest
Si
Line.
4 Struc: | Struc. Vox. | Header] Mork dvea/
Record
SOciALSTYDIESbieaces Lemus | nuimuntea SEEPS :
Thassgpot “the ABAP prgming, oF caork catty only atyfe 4
ek}: * bd
ls “Tables ( DB Trex)
2 4 “Teblon ( App'o Ther)
Tedividual yecords a teble cannat be pro by the,
ABAP brqro devectly,
pprocenns boy -the ABAP Pear tequired vecords f the b
ae phould be taken isto o crorkarea
ABAP pear con orotk ostth the data anothble to the cork
oxen.
Work Ar
© UW wy
a © Stractuxe| Record
ar
LOB Recordsy
ae
ABAP Fagen. Nat possible “Sea | tater “Table
(RAM) (Row) (Ram)
We con crecte 2 types 4 header liner
\. Seopleect header line
a. Expect Theader line.
Genbliett Header Line 1 Gb the come, 4 The toble (DBT of Inter
nel Table) Wo come + ‘the header line ts ome then it bo
colled Teoplecct Header
a “the narcs ore oth theo ib us colled Explect Header Line
ee oar | WA | Headey
POOLE Wn] tear
Table: DB
VBAK
(Rom) AnopleettWhe wootd “TABLES N DAIA ote abed yr ea
Soph eck Explicct Header Lined bye pet :
RAM
T— Wa] Header Line,
aa
Toble: DB
VBAK
(Rom)
How dou dekine Stitin Sibhcet Header Lines ?
TABLES VBRAK
ahorocticadbey bap: crches on under [tae esth came ear.
How do define Explett Header Liner ?
& DATA: S4 TYPE VBAK.
Ni Gt ts vecorperunded | “to caork cstth expert header Kaus
oly. (for best ferfornneos Yeahars)
Fetehe dato. freee DB Table
The banric obetations hel we con perboren en a DR Tebl,
ante! | Lope sting ao record (Crecte — ¢)
2. ‘ (R) ( Secect)
3. Update i Cv)
4 Dan! : (>)
There ove called ‘crud’ oberctions
Among all there operctcons roost 4 the temas use crork estth
“SELECT? commend i.e. Yeading a tecord
SELECT xtedt. && uned her ptebing the dete rere DB tobles
to th yr + tecorda,
Dif. Cloube 9 SELECT Stet
(Refer Saterral Table tape for ore fo")
1. SELECT —> To apecp "eq: heldx AN Relay
fields, pielde --- 9 foe eq. pede ook
FROM —> To Pobecihy the sxe table
Rom
fyi VBAK.
INTO —> To ppectha the destination
Ey) VARL Who ook one geld we tore
( VARA, VAR2, VAR3) —5 chun rang te field> owe there
Waorkdivea 5 cthen on. bre, [ele ore there Y bo poker
dete procenning
WHERE
_5 Te ther the vYecords bared on
chien
Formock 2 DB Rteld obercitor Vortable
eq: Ales crag:
NAME = (paty?,
Dib. Ferns gf Sevect Stect.
\. S€LEcT SINGLE__ 5 qy fre ont one record form
DB toble .
&. SELECT
= To ketch record by stecord from DB
ae teble U to bethovmn some. ober
eo eache record.
Ni SaP—en]eT 1B constiteters collection fo Ae tolls de
feat tebls, dino. tbls, DSO tibWes wh MD tobler,
Creche a Char. 90 to Ba.
actions
Select To's 5 exp ee elect ton ely gg ae
crvecte to
chor. + SMIDE
Desc 2 SALESMAN 3D d
p.€:] atc) orsmape
DT! cHAR
len! 4ReleckL MD] lets too
A with mp (ette'd
pelect Ath tab
NAMEF
AGEF
ADDRF 2
NAMEF AGEF
CHAR Nome,
ee oF
Activette
TI Weth Text
ADDRE
CHAR
40
Sop. arerebe data duc. token
[oac[Psmape
D.c en the ‘P’ tobe
Feelds
[etc] smaveF
[atc | NAmEr
Jere] Acer
|ete] AppRE
Eoter date ian vd
bdect ‘Metatoin a” —> erecuke _5 creck.
pasu KIRAN
2S 26 24
GoNTUR WARANGAL VIZAG
Seve —y F232
Check dota to th tobe
D.c on the SP? toble
Obperve the tobe struc:
Costedtrs > Erecuitedb = nome addret
gi. “ee O AlYUc, b eit o >
Ctecte 2 blue. varle fore the struc. ‘tape x cksplog th
heghest aged petaon.
* Define Struc. Type
TYPES! BEGIN OF ee eae]
NAME TYPE [oac]smipe — Namer,
Ager type |aec} erniok tAGer,
ADDR TYPE | wae /fmine 7 Sone
ENDe@ OF TY smaNn.
% Creche Struc. Voor Up
DATA: SA TYPE TY_sman,
DATA. $2 TyPE TY sman.
S€LecT SINGLE /pac/Namer
From — Jai} Psmipe
INTO SA
WHeRe /aicfsmipe = 54?
JerclAaee oicfavpre
SELEcT SINGLE
Joic] Namer ] Bic] acer | BicfappRe
FRomM |eic] Psmipe
INTO Sp,
WHere /Bicfsmine = (sp)
GP si -faisfacer + 52- acer.
writer] sa _Namer
oe
Weite:/ S2-Namer, S2-AGEP, so_
ENbae.
» SA-AGEF , SA- ADDRE COLOR Gg,
ADDRE coor 8.XKK Defining Vewtabolas using Dato Elemests tn saP- at
TYPES: BEGIN oF TY SMAN,
NAMEF TYPE | Btc}oINAmeEs,
AGEF TYPE /atcloraces,
ADDRE TYPE /at<]otappee,
END OF TY_sman,
% Geoke shrac. ver.ly
DATA: S4 PE TY_sman,,
DATA: S2 TYPE TY Sman,
SELECT SINGLE Jeicfyamer | Bac|ngee | stare
FROM — aic/rsmipe
INTO SA
WHere |pac/smipe = tsa,
SELECT SINGLE Joic{wamer |orc}acer [sacfappee
FROM |Bic}psmipe
INTO SZ
Where |etclsmipf = ‘52?
TF SA-AGEF > S2-AGCE.
WRITE: ] S4-Namer , SA-AGEF, S4-ADDRE coroR 4.
ELSE.
Weite:} S2-Namer, S2-AGEF, 57 ADDRE covor &
ENDIE
te possible to work oo Ic tables M DSO tables.
Ni Check the coatests $ an fc
Ester LIistcuBe
oe Heol Ge eeP
x
y
Enecute,peect he bel kr lp > req, jew > erecule
wf Disphy SAL query
gq " Erection pln
exocube
Obperve the quer
ead th ‘secect’ stat. 4 corte the ‘cevecr stat.
Une thih cade in ur ABAP Pra:
Geto SQL prompt No covite thes pert:
Obnerve the result.
CID, PID data is vetvieved from curt. dees. ML prod. dim.
end ther stp tables and
PcALDAY , dcALMontH -_-
toble MW STD table
CORRENCY , UNIT
thir SID tebk.
KPa(te. date) dete w
frore nov. attr. tebles
Us corning hore time dim.
Voluss as coming frem unt dim. y
ebréeved reno fact tables (RE
aa wo ob
NiSt o& posible to cred ABAP teborts om DSO tobe
UW PSA table
Sf eee ee [BicfAxxxdd
REAP Peyreme 22 SAP R/a Dizteornty “Tebley
Logen ‘to SAP-R/2 Ecce.o
Esty SEt14
Oo Vea i Data Table
Draplay
VBELN > ket chay 40
ERDAT dato 8
NETWR core 18 Net vole
VK ORG
char | G Soles OrgonigetionAeleck “lech. Settin:
Dele clabb } APPLL ~s Tr. deta, “Herspoxert toble
Adlecd Corterdte —s no. 4 enter —> J
Mar: no. 4, hike + “200000
Execeibe
Obverve the VBELN (tales doc: 0.14) Veluwe
Padoppaacg
bbb bagsago
Se
Make sure thet o Phe or vp ment clabs exists
Enter “SE 3%
Paro} 2ZPRGEA
@ Ste Code
pelect a
Toth! ABAP]G Promoting Practice
Type ! Cxecctabte bat vt
Stotus! Test ro
poe —> edter ur kg —s JV uxth Te
Opes ABAP editor
KKK eqt Grecke a struc. type estth elds VBELN ERDAT
NETWR VKORG 4 table: VBAK
% Creche 2 poles tecardy jer “this gbruc. typ w cpl
the poles order no, + highott soley tronbactten
x Abbume the bales order olen! Gags
xx Defer. Bhruc. type
TYPES: BEGIN oF TY_SALES,
VGELN TYPE VBAK—VBELN,
ERDAT TYPE VGAK- ERDAT,
NETWR TYPE VGAK~ NeTWR,
th 4980VROK@ LYrE VIBAK- VRURKM,
END OF TY_SALES.
% Create struc.» | phrac. voor | work oxea| header kine] veeod
DATA: S4 TYPE TY_saLes.
DATA: S52 TYPE TY_SALES.
% Fete data from DB “Table
SELECT SINGLE VBELN ERDAT NETWR vioRG
FRomM VBAK
INTO s4
WHERE VBELN = ' 66dbdddqazs”
SELECT SINGLE VBELN ERDAT NETWR \nKoRG
FROM vaAk
INTO sy,
WHERE VGELN = 'hoddddaase.
TF S4- Nee > SL-NETWR.
Wee: / SausBoe Gage ‘sales Doc
G94) cotor S
ie SI-VBELN coloR 2, SA-ERDAT coLoR 3
(se. SA-NETHR cou.
OR Gy SA-NKEORG coLop 6.
Wirive :/ Peo ee ee G, SA-VGELN coror 2,
S2-ERDAT color 3 S2-NETWR corok 4,
ENDIF SL-VKoRG COLOR, é.
Ni do thin Pare (SCALES oa a te
S4, S52 one struc" |
header kine
VBELN, ERDAT, NEWR
Bhrac. voor! cook oxea.| vecords/
2 VKORG ave cormbonenty 4 trac
For veconciliction dite, arte SE41, eriter ur toble
VBAK , chsblag , covitests
VBELN : bddddhqa4
eek
NETWR
1 3a.448,00 _, #3
VBELN ! $$64$h4980 > exscte
NeTHIR | 14.2330, 00 —» FRope oe
Soler doe, ot okt GIS hor more faled value.
Enter SE44
© DBT: KNAL —» Cust Masher Debs Toble
Despl
elect Tech. Sette
Dota Class: APPLA —» MD, trompborest tole
F3
Gostests 5 90. fi cabin 1 ssp05-
Pot eq. enter KUNNR ! 1200 —5 execcte
obpernve the data
ORTH: Horobuvg a eS
KUNNR chor = 10 Cust. no.
LANDA! court
NAMES Noes,
orTga Ca
STRAS t
Houre oo, W street
* % White prgen. to disbla the MD tbh detaily 4, the
frome toble KNALCcust. mp table)
¥ Define bruce. type
TYPes: BEGIN of TY_cust,
KUNNR TYPE KNA1 — KUNNR,
NAMEL* TYPE KNAA— NAMES,
LANDA ab lass KNA1 — LAND4,
oRTd4 TYPE KNA4 - orTd4,
STRAS TYPE KNA1-s7RAS,
END OF TY_ cusT,
* Deine Phra. / Istruc. Vest.
DATA: S_cuST TYPE TY_cUST.
cusstorner 12.00Cee Cae pie Nat dep
SELECT SINGLE KUNNR NAME’ LAND’ opTd1 sTRAS
FROM KNAL
Into Ss_cyusr
HIHERE KUNNR = ‘ddddddirpe
weine:| Is_cust—KUNNR Covop 2,
IS_cusT— NAME4 Coton 2,
TS_cuST- LAND’ cotog 4Q,
TSs_cusT— ORT PA coro 5,
IS_cusT- stRas COLOR 6,
Obpene the op combate “the vesutt estth table deh.
*** Wicte a brgm. to ctobleg motertal ‘tape & debscxebtior
io English for rnatertal
¥* a AD - 2383 using MARA ond T4347 toblep
Ecler sea
ODBT ! MARA —5 Metewtal mop
Dusblacy
feiss?
MATNR
MTART
ded Tech. Sette,
Delo Clabs ! APPL A ~5 mp
P3
Costerty —»
For ‘this cnclettal Ap 3a, clenplou cochertol tye yu
deserption.
OUR eG aah for Matertol type ckiscxtptions
Owsplag.
Fields
TART =
MTGEe Dere. rion tapeNi MTAKT Uo Ue Cowomon he's in Ue & lobber-
MARA
J TABYT
MATNR! Matetal code / no. MTART
ee MTBE2 — Material dene
a eseg)
re SpRras = ‘en
DATA! VUMTART TYPE = MARA- MTART.
DATA! V -MTBEX TYPE TA34T~ MIBE2.
SELECT SINGLE MART FRoM MARA SANTO V-MTART
WHERE MATNR = ‘AD-32@’.
SELECT SINGLE MT BER FROM TAZ4T INTO V_ MTBEZ
WHERE MTART = V_MTART AND SPRAS = ‘En’.
weiter] “MATERIAL TYPE!?, Vi mTART cook 4,
“MATERIAL DESCRIPTION!, V-MTBEX cotoR SF.
Sled stet cotth tuo kelde
DATA: V-MATNR TYPE MARA-MATNR.
DATA! VMTART TYPE MARA- MITART.
DATA! V-MTGE2 TYPE TAaqT—- MTBE2.
SELECT SINGLE MATNR MTART FROM MARA
ENTO (Vv MATNR, V-MTART)
WHERE MATNR = ‘AD-332”.
SELECT SINGLE MIBEX FROM TA3ZGT INTO V_MTREA
WHERE MEBES F mTART = Vo MTART AND SPRAS =‘en.
wire: | “MATERIAL NUMBER 95:?, Y_MATNR coLoR 2,
“MATERIAL TYPE 7, NEMTART coLoR 3,
“MATERIAL DESCRIPTION’, V-MTBER COLOR 4e,Am WiteLe oF fete: Lo ered Maletiok Uhh aes
meterol fore MARA toble
DATA} V_MATNR TYPE MARA- MATNR,
V-MTART ‘TYPE MARA-MTART,
V_MTBE2 TYPE TAZ4T-mTeE2,
SELECT SwWGKE =MATNR MTART FROM MARA
INTO (V-MATNR, VeMTART).
SELECT SINGLE MTBEz FROM TA349T INTO V_mTBEX
WHERE MTART =
= V-MTART AND SPRAS = ‘EN,
waive: / “MATERIAL cope? covop 3
“MATERIAL TYPE? coLoR G
“MATERIAL DESCRIPTION’ Corog F,
ULINE,
Write:! V-MATNR coor 2
V_MTART COLoR 3,
ee y
ENDSELEcT,
03.10.12,
Paternal Tables
Io ABaP pram Drtetral Tellers axe aned lpr ‘pereasing the
ie oppo AUNEt ond DB berver.
obro te “edu the problems invelved to afes [the
jpttare Ro bentted bandatdtby.
Paternal Tool axe cers ran hich are praistatnad t
the ‘teporan ary 4 Wo hetver,
Wert po nO ister nod os tr locol to the Barly br,
Fetebing +the reconds from DB tables
one ky ont i a tine,
: rrocebss.
8 rr $ titeroal tabled, co corr fitch alt thy
oe 4 e@ DB teblee ot once and Loter thone yer
Mance,
ofaAReOLaD Car be precebhed one ot ore.
After igh al) the records DB table toto internal teller
tac one sof step, the record> con be procenred bf ABAP4
pe co ow ont cstth the help 4 “Header Line ov Work
Arta on Stvadtuve of Shrus Record.
Tipe 4 Vatereol Tablus (2:7)
These ote 3 .
1. Standaord IT ( defo typo
2. Sorted Ff:
3. Hoshed 2.
A. Steoderd 2.7
Whe we search ee yecord to “these tebles, the rearch-
ing time Varted a the bopttion “the yecord
cS Cale = vt a P +
The peavey tiene o particular vecord estll be move
coroperred eatth — ther types 4 9:T'n.
These tobl uned LINEAR SeaRcH’ olgorttheo he ‘peasching
the tecordy.
4
4
a Sorted OT
Ate the tecords cuitornattc i oa ported order
eae ae cee
There tobles ures‘ BINARY SEARCH’ olgertther hor Peat.
a a Yecord.
Th orth tokes lesb tee to search a Tecord
comnposted| with LINEAR SEARCH or SEQUENTIAL SEARCH.
3. Hashed 9:7
There tables ones ‘HASHING ALGORITHM? astih reavehio:
o record, a
Thi ortthes requires —reme tine to earch ier ong record
to “the “tobl.- 7
Te, pearch taw downtt voy extth positon 4 the recordUx Leow: :
at Sovted ctoblys allows APPEND, INS T coromoands but tt
“expect the Yerords in The abande ot eve + a unique
nl, - yield coast be dp type coor Nor DoT bat
ost GF ov P.
Ni Hoshed ‘tables doesst allo APPEND, INSERT carnrnand
chile adda yecord.
The table phould be billed orth pe table directly.
Coe a Oe ino se a create 2, types 4 Header Liane
1. Len i Header Line
2. Eplictt Header line
&) Appanw tht TY cusT te on existing ptrucs tape
+ Untexnol Table osith Gonblictt Header Line
DATA! ITAB TYPE TABLE oF
Cr)
TY_cuST WITH HEADER LINt
DATA! TAB TYPE STANDARD TABLE oF Ty_cUST WITH
HEADER LINE.
Co)
DATA: ITAB TYPE TY_cUST occuRS A WITH HEADER LINE.
@. Daterenl Table esith Exblictt Header Line
DATA! WA TYPE ‘TNcusT (Work Area of Header Line
Demme Us WA)
TIAB TYPE TABLE OF TY CuST. (Maternal Table)
Cor)
DATA: TIAS TYPE STANDARD TABLE OF TY. CUusT.
(st)
DATA: ITAB TYPE TY_cuST OCCURS 4.
= DATA._npp-9 pervert UCANY
Tcternal Table
ITAG
<1 — Header Line|
Work Ate |
Structure] Record
ae Prqen Aten
Aer Toole
aparla code
~ow
LT with Enpltctk Header Une
Fsternal Tele. Cocnmrends (10 Commands)
delete oS the +ecordr 4 Qe,
}. REFRESH: To
eq REFRESH STAB
Delete atl tecords de 2-7
Ni Fer caork area, oe ae “CLEAR WA’.
Q. DELETE: To delete fpoo yecotds 4 wT
& dalle ard +ecord 4a.
DELETE ATAB ANDEX 3vecore TAK WHEKE SALAKY < 30000 —> deletes
oll vecords chore poaleny Jess than 30000
3. SoRT ! To oxtvorat the yecotdes ts an order.
, SORT GTAB BY SALARY DESCENDING] ASCENDING
. Arran ctecovds io oneanting| denciesling order bared
4. DESCRIBE TABLE! To count the no. f, tecards to on LT.
i DESCRIBE TABLE ATAB
UNE N—> The var
counl vi
N covitew
SE. APPEND! To add header line.
end ¢ ee
Eq: APPEND WA To IAB,
tecords an ceo Yecord ot th
G@. INSERT: To add headerline vecord ob recs record ot th
pbeeified ‘porition to the = DT.
Eq: INSERT WA GNT0 STAG INDEX 3.~5 Gopeit the
need yecord ot portion a
(efter aod tea)
He COLLECT: Before adds the header line veeord to the 2:7
tt looks. a codtching vecord ceenperiag the char.
held ee “" “ “t
N: Sf a mndtching Yecord & bound the corre
N rpowdte
» thee oll KE] KF field” velues ove “Added oh carob
Beds to the enitttng Yecord.
Ni ay a0 cottching record us there , theo a neo ctecard asl’
be ctected ond Sbbended ct the end 2 east
tecotdy: “th = [3 ood
Ey COLLECT WA SINTo ATAR.
: 8.MoDIFY: Vo replace on ontstrog teeord utth the covtets
= x eee al the RR porttion,eq MoDIFY @TAB FROM WA SNDEX S —> Std Yeoord
coll be veplaced cith WA vecord
one tecosd free 4.7 tote
4. READ TABLE! ‘To vead oot
Reader Linc.
Ey READ TABLE @TAB INTO WA ANDEX 3S.
Readeng a record bored on ttn ponttion
READ TABLE TTAB INTO WA WITH KEY ROlLNO = 20
ese
Reading 0 Yeeord bared on porne reld Veliwet
Gn thi cobe, only ‘Equal? obendter can be uned and
keg pride rowst — be oraled by * Space? ooly
Do not ure AND, OR operatorg
Bt ow tke ‘SELECT SINGLE ~-__? atest.
NN. Seop:
lo. LooP AT_-_ ENDLOOP
To vead all vecords on the other into WA and
to perlerro ome, pet 4 opercttions on each vtecord:
ENDSELECT Ata.
i te Wee ectec e
10.4 Syrtor !
Loop AT QTAB SANTO WA
= oberatsons
ENDLooP,
Feist vecord coil be. iprecenred ond then pecond Yecord
end bo om ate
Til) the lost vecord 4 sae
[O12 Syston |
Loo? AT STAB asntTO WA FROM 3 To 4,
= obetsttions
ENDLooP
Rode w_ procens the teotds blo 3 24 only:
éSerene ee QLOK,
LooP AT GTAB INTO WA WHERE SALARY < aa000
= operetion
ENDLooP
Procedper all yYecords othich pabifies the here condition
10.4 Systex:
LooP AT ITAB ASSIGNING .
= operations oy Field Syrobalsy
Field Symbol con be ured on coork area, ohile
procebting ‘the deta. & the eld ayrbale.
Actually keld pycrbools ave address veletencery to yecardys
th: ‘scr
- baqrobels ore wed only her medi yiog the records
Adding near tecovds ot deleting the vecordy 4 the OT te
not poortble by eld symbole.
Bn the cone etdtonty coor k oven. coneapt , the yecord
phould be moved to ‘the cork ote [pest
Alter barlorming the rnodibications, the vecords phould be.
we fee walk to au
hr token lot fa tine.
Go the core icld mboly 4 there os o0 2
coomestt pe ia eee
ABAP. Pr ™ con dtrectl v tee Gey con
prea] modifies the a'T tecord.
Ni In SAP~NW- aT 5.0,
© Stoxt Roukines, End Rockin wy Expeit Routines
4, Bt tranbleranetions 5 cluseuyo une © Fteld Syrnbele? to
roodfy the cee dates.MSL gf Unt Lene, we wee tet Geum ERpHASE Teevaia ost aes
KKK Unteroal Table Progracne
xX Weeke of qr to vead a ptedtence Lom endubet and
“to desley the word eshich comm to tat ponttion to
alphabetical order.
‘PARAMETERS: SENT TYPE GC LENGTH 200.
DATA: WA TYPE C LENGTH 20.
DATA: STAB TYPE TABLE oF cHAR20,
SPLIT SENT AT SPACE SNTO TABLE TTAB
SokT ITAB ASCENDING.
READ TABLE STAB ANTO
WRITE: WA color $.
WA INDEX A.
04.1012
KKK AML Daternal Tele Gromends to One Progtoann.
%& Procerbt Studest Dato. T
* Define a” Structure Type
TABEES: BEGIN oF TY_sTU,
RNO TYPE N_ LENGTH y
NAME TYPE C LENGTH 20,
Gees tre a)
END OF 7y_stu.
* Deftnw Header Line of Work dea
DATA: WA TYPE TY_sTU.
¥ Defgne on Internal Toble.
DATA! STAG TYPE TABLE of 1Y_STuU.
x Ester deta into 2.7
% Fost ester data Yecord by record isto WA and thes
load tote ST
WA-RNo = 12).
WA-NAME = SLAXMS’.
WA- FEES = 4p00. .
APPEND WA 70 STAG.
CLEAR WA.
TYPESWA-KNO = 1242,
WA-NAME = ‘RAFI’
WA- FEES = S000.
APPEND WA To STAB.
CLEAR WA.
WA-RNO = 123,
WA - Name = ©RaATU?,
WA— FEES= Zoo,
APPEND WA To STAB.
CLEAR WA.
WA-RNO = 124.
WA- NAME = ‘manasa’.
WA-PeEs= S500.
APPEND WA TO STAB,
*% Display deta.
SURE LooP AT STAB aNTO WA.
WRite:/ WA-RNO coLoR 2B,
WA-PEES coLor Ge
ENDLOoopP.
ole: faz. Laxm Go0o
ee
$123 Ratu
$424 wanasa
ae ee
WA-RNO = 128
WA-NAME = CKRisuna?
WA-FEES = BQ 00.
INSERT WA fNI0 ATABR INDEX 3,
CLEAR WA.
LooP AT TTAB SNTO Wa,
Write: ] WA-RNO coLoR 2, WA-NAME coor 3
WA-FEES CoLor 4G.
ENDLooP.
WA-NAME coLroR 3,op: prra
= PAZ
PIS KRISHNA = F000
fr23
$124
F3
* Colle? Genmand
WA-RNo = 426.
WA-NAME = ‘Gopt’
WaA- FEES = qooo,
COLLECT WA INTO @TAB.
CLEAR WA.
LooP AT TTAB INTO WA
Weite:] WA-RNo cotor 2,
WA-FEES corer y
END LooP.
Record uo appended beog there i 10 madtehing vecord.
WA-RNO = back 129
WA-NAmME = SLAxme.
WA-NAaME coon 3,
WA-Fees = 12000,
CoLLecT WA SNTO OTAB.
CLEAR WA.
olp: oh LAXME 16000
> Modify! Command
* Modehy RAFI» ecard by adding 2000 taper to the
eee her:
READ TABLE TAB anTo WA WITH KEY NAMe= ‘RAR?
mF sy¥-suere = 4,
WA-FEES = WA-FEES + 20008.
MODEFY TAB FRM WA INDEX SY-TABIX.