0% found this document useful (0 votes)
258 views15 pages

ABAP in BI 1.0

This document discusses the usage of ABAP in SAP BI 7.0 for various objects like routines, statements, and variables. ABAP can be used to write complex logic and transformations that are not possible using standard functions. Common ABAP statements used include SELECT, LOOP, READ, SORT, and FIELD-SYMBOLS. Routines like start, end, and expert routines allow triggering logic before, after, and during the transformation process. Characteristics routines also allow defining custom logic within a transformation.

Uploaded by

Saravana Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
258 views15 pages

ABAP in BI 1.0

This document discusses the usage of ABAP in SAP BI 7.0 for various objects like routines, statements, and variables. ABAP can be used to write complex logic and transformations that are not possible using standard functions. Common ABAP statements used include SELECT, LOOP, READ, SORT, and FIELD-SYMBOLS. Routines like start, end, and expert routines allow triggering logic before, after, and during the transformation process. Characteristics routines also allow defining custom logic within a transformation.

Uploaded by

Saravana Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 15

Usage of ABAP in SAP BI 7.

0
Version: v1.0
By
Anweshi Pagadala
[email protected]
And
Jayalakshmi Velama
[email protected]
Wipro Technologies
29-Dec-2008
Abstract: This document discusses the usage of ABAP in BI in various objects.
CONFIDENTIAIT!
his do!"men# is in#ernal #o $i%ro and sho"ld no# &e !ir!"la#ed o"#side $i%ro.
Document History
" #ersion A$thor Date Description
1 0.1 Anweshi
Pagadala &
Jayalakshmi
Velama
01-Apr-2010 Initial Draft
2 0.9 Anweshi
Pagadala &
Jayalakshmi
Velama
9-Apr-2010 eleased f!r e"iew
# 1.0 Anweshi
Pagadala &
Jayalakshmi
Velama
1$-Apr-2010 In%!rp!rated e"iew &!mments
TA%E OF CONTENT&
1 INTRODUCTION......................................................................................................................... 4
2 ABAP Statements generay use! in BI ................................................................................... 4
" Usage o# Routines in BI............................................................................................................. $
#.1 '(A( )*(I+, I+ (A+'-).A(I)+...................................................................................... /
#.2 ,+D )*(I+, I+ (A+'-).A(I)+......................................................................................... 0
#.# ,1P,( )*(I+, ................................................................................................................... 0
#.2 &3AA&(,I'(I& )*(I+, ..................................................................................................... 4
4 %aria&e '(its............................................................................................................................. )
'(,P' I+V)5V,D I+ (3I' P)&,''6............................................................................................... 9
2.1 P)J,&( .A+A7,.,+( )- 'AP ,+3A+&,.,+(' ...................................................................9
2.2 8,1 9*,: D,'I7+, A+D VAIA85, (:P, &*'()., ,1I( ...............................................11
2.# &*'()., ,1I( A+D A8AP &)D, ....................................................................................... 12
1 INTRODUCTION
In Any BI %ro'e!# #here migh# &e a need #o wri#e !om%le( logi!)s whi!h wo"ld no# &e
%ossi&le #o im%lemen# "sing #he s#andard f"n!#ions %rovided &y SAP. In s"!h s!enario)s
ABAP is of grea# hel%. Using ABAP any !om%le( logi! !o"ld &e eval"a#ed as in #he
%rogramming lang"ages #o #ransform #he da#a in BI. he do!"men# %rovides #he overview
of "sing ABAP wi#h in BI while e(#ra!#ing* #ransforming and loading #he da#a. he
advan#ages of #he ABAP &a!kgro"nd as i#)s easier #o "nders#and #he #e!hni!al as%e!#s of
B$* s"!h as when #here is a need #o !rea#e addi#ional #ransfer s#r"!#"res or if #here is a
need #o %rogram any !onversion ro"#ines for #he da#a &eing "%loaded* as well as &eing
familiar wi#h #he so"r!e #a&les from SAP +,-.
2 ABAP STATEMENTS GENERALLY USED IN BI
S./.0 Syn#a(: S./.0 1utput!"ields2
3+45 1#ource!table2
I64,APP.67I68 1Target!table2
9'34+ A// .6+I.S I6 1Int!table2:
$;.+. 1$ond2:
98+4UP B< 1%roup2:
9;AVI68 1%roup!$ond2:
94+7.+ B< 1#ort!key2:.
0la"ses "sed in #he S./.0 s#a#emen#:
(. WHERE: is "sed #o res#ri!# #he n"m&er of re!ords fe#!hed &y S./.0 s#a#emen#. he
logi!al e(%ression !om%ares #he !on#en# of !ol"mns in #he da#a&ase wi#h #he !ondi#ions
%rovided in $here !la"se.
Some of #he /ogi!al .(%ressions whi!h !o"ld &e "sed in #he $;.+. !la"se are
O*eran! Descri*tion
= ,;<al t!
12 +!t ,;<al t!
1 5ess than
2 7reater than
2= 5ess than !r e;<al t!
1= 7reater than !r e;<al t!
.> ,;<al t!
6. +!t ,;<al t!
/ 5ess than
8 7reater than
8. 5ess than !r e;<al t!
/. 7reater than !r e;<al t!
B.$..6 (! %he%k if the "al<e is within spe%ified inter"al
/I?. (! %he%k if the "al<e mat%hes a pattern
I6 (! %he%k if the "al<e is in set !f spe%ified "al<es
IS 6U// (! %he%k if the "al<e is n<ll
2) FOR ALL ENTRIES: If #he addi#ion 34+ A// .6+I.S is s%e!ified &efore
$;.+. !la"se* #hen #he fields from #he in#ernal #a&le 1I6@AB/.2 !an &e "sed as
o%erands when !om%aring wi#h rela#ional o%era#ors. he in#ernal #a&le 1I6@AB/.2
m"s# have a s#r"!#"red line #y%e and #he !om%onen# !om% m"s# &e !om%a#i&le wi#h #he
!ol"mn !ol. S./.0 will re#"rn re!ords from da#a&ase whi!h are ma#!hing wi#h #he
1I6@AB/.2 &ased on $;.+. !la"se.
*) INTO/ APPENDING: Adds I64 s%e!ifi! fields where #he re!ords fe#!hed &y
S./.0 will ge# s#ored. I64 !la"se refreshes I6@AB/. !on#en#s and adds new
re!ords fe#!hed &y S./.0 in#o I6@AB/..
APP.67I68 will add re!ords fe#!hed &y S./.0* a# #he end of I6@AB/. and
e(is#ing !on#en#s of I6@AB/. remains "n!hanged.
+) LOOP Syntax:
/44P A 1I&T!TAB'(2 9I64 1)ork Area2:
9$;.+. 1$ond2:
AAAAA.
AAAAA.
AAAAA.
.67/44P.
4+
/44P A 1 I&T!TAB'( 2
9ASSI86I68 1"ield #ymbol2:
9$;.+. 1 $ond 2:.
AAAAA.
AAAAA.
AAAAA.
.67/44P.
he /44P and .67/44P s#a#emen#s define a loo% aro"nd in#ernal #a&le re!ords. he
/44P s#a#emen# reads lines from in#ernal #a&le 1I6@AB/.2 seB"en#ially. .i#her all
#he lines !o"ld &e read or !ondi#ions 104672 !o"ld &e s%e!ified #o res#ri!# #he lines #o
&e read. he s#a#emen# &lo!k &e#ween /44P and .67/44P is e(e!"#ed on!e for ea!h
line.
5. FIELD-SYMBOLS
Syntax: "I('*+#,-B'# ."#/ 0typing 1 #T23$T32( struc *("A3'T dobj4.
he 3I./7CS<5B4/S s#a#emen# de!lares a field sym&ol 13S2. Af#er i#s de!lara#ion* a
field sym&ol is ini#ial C #ha# is* i# does no# referen!e a memory area. A memory area needs
#o &e assigned Dnormally "sing #he ASSI86 s#a#emen#E &efore "sing i# as an o%erand.
4#herwise an e(!e%#ion,shor# d"m% will &e #riggered.
6. READ
Syntax: 2(A* TAB'( .I&T!TAB'(/ 0 table!key 1 free!key 1 inde5 4 result BI&A2,
#(A2$6.
his s#a#emen# reads a row from in#ernal #a&le 1I6@AB/.2. A row needs #o &e
s%e!ified &y ei#her naming val"es #a&le@key for #he #a&le key* a free !ondi#ion free@key or
an inde(. he o"#%"# res"l# de#ermines when and where #he row !on#en#s are read.
BI6A+< S.A+0; !la"se makes +.A7 s#a#emen# a &i# fas#er. PrereB"isi#e for "sing
BI6A+< S.A+0; is #ha# 1I6@AB/.2 m"s# &e sor#ed wi#h #he keys "sed in +.A7)s
#a&le key.
7. SORT
Syntax: #2T .I&T!TAB'(/ 7#TAB'(8 0 0 7A#$(&*I&%1*(#$(&*I&%8 7B,
0comp9 7A#$(&*I&%1*(#$(&*I&%8 4 0comp: 7A#$(&*I&%1
*(#$(&*I&%8 4 ... 8 4 .
S4+ s#a#emen# sor#s an in#ernal #a&le 1I6@AB/.2. As s#andard* n"meri! and &y#eC
#y%e !om%onen#s are sor#ed &y #heir val"e and !hara!#erC#y%e !om%onen#s a!!ording #o
#heir &inary re%resen#a#ion !ode %age. If no e(%li!i# sor# key is en#ered "sing #he B<
addi#ion* #he in#ernal #a&le 1I6@AB/.2 is sor#ed a!!ording #o #he #a&le key. In #his
!ase* #he #a&le key !an !on#ain a ma(im"m of FG0 !om%onen#s.
3 USAGE OF ROUTINES IN BI
3.1 Start Routine in Transformation
S#ar# +o"#ine is availa&le wi#h ransforma#ion and is #riggered &efore ransforma#ion.
S#ar# ro"#ine e(is#s wi#h #he same s#r"!#"re as #ha# of #he so"r!e and is "s"ally "sed for
fil#ering re!ords or fe#!hing glo&al da#a.
0li!k on S#ar# +o"#ine &"##on #o !rea#e S#ar# +o"#ine. S4U+0.@PA0?A8. !on#ains
!on#en#s of so"r!e da#a. S4U+0.@PA0?A8. has same s#r"!#"re as #ha# of So"r!e of #he
ransforma#ion. Addi#ionally* S#ar# ro"#ine e(e!"#es for every %a!kage a# on!e.
3.2 End Routine in Transformation
.nd +o"#ine is availa&le wi#h ransforma#ion and is #riggered af#er #he #ransforma#ion.
.nd ro"#ine e(is#s wi#h #he same s#r"!#"re as #ha# of #he #arge# and is "s"ally is "sed for
"%da#ing da#a &ased on e(is#ing da#a.
0li!k on .nd +o"#ine &"##on #o !rea#e .nd +o"#ine. +.SU/@PA0?A8. !on#ains
%ro!ess da#a whi!h is %ro!essed via s#ar# ro"#ine and #ransforma#ion.
+.SU/@PA0?A8. has same s#r"!#"re as #ha# of #arge#. Addi#ionally* .nd ro"#ine
e(e!"#es for every %a!kage a# on!e.
3.3 Expert Routine
.(%er# +o"#ine is "sed define #he #ransforma#ion logi! in order #o #ransfer #he da#a from
So"r!e #o #arge#. Bo#h #he S4U+0.@PA0?A8. and +.SU/@PA0?A8. !o"ld &e
a!!essed #oge#her in #he e(%er# ro"#ine. In order #o !rea#e an .(%er# ro"#ine #raverse
#hro"gh #he .di# men" and sele!# .(%er# +o"#ine. .(%er# +o"#ine will #rigger wi#ho"# any
#ransforma#ion +"le. All e(is#ing +"les will &e dele#ed on!e #he .(%er# +o"#ine is
develo%ed and #his is generally "sed for !"s#omiHing r"les.
S4U+0.@PA0?A8. e(is#s wi#h #he same s#r"!#"re as #ha# of So"r!e and
+.SU/@PA0?A8. e(is#s wi#h #he same s#r"!#"re as #ha# of #arge# in #he
#ransforma#ion. Val"es !o"ld &e infl"en!ed from S4U+0.@PA0?A8. and amended #o
#he +.SU/@PA0?A8.. 54V. !ommand needs #o &e "sed #o #ransfer #he da#a from
so"r!e %a!kage #o res"l# %a!kage.
Stat!nt "#$ %n t& x'(t ()"t%n t) t(an#*)(! $ata *()! #)"(+ t) ta(,t:
-;( .#ource!Package."ield!&ame/ T .2esult!Package."ield!&ame /
3.4 Characteristic Routine
0hara!#eris#i! +o"#ine a%%ears wi#hin #he ransforma#ion and wo"ld &e #riggered as %ar#
of #he ransforma#ion &ased on #he !hara!#eris#i! or key fig"re. If r"le is for
0hara!#eris#i!* #hen 0hara!#eris#i! #ransforma#ion ro"#ine and key fig"re #ransforma#ion
ro"#ine wo"ld #rigger &ased on #he r"le. he r"le level ro"#ines or #he field level ro"#ines
i.e. ro"#ines im%lemen#ed wi#hin #he #ransforma#ion wo"ld involved for every re!ord
"nlike #he s#ar# or end ro"#ines.
4 VARIABLE EXITS
SAP %rovides a varia&le of #y%e !"s#omer e(i# for B$ B"eries whi!h !"s#omer is a&le #o
manage i#s val"es de%ends on #heir &"siness reB"iremen#s. his do!"men# %rovides a
&asi! idea #o s#ar# in #his area "sing ABAP !ode.
Steps involved in this process:
Pro'e!# managemen# of SAP .nhan!emen#s
>"ery B.I >"ery 7esigner and Varia&le y%e 0"s#omer .(i#
0"s#omer .(i# and ABAP 0ode
4.1 Proect !ana"ement of S#P Enhancements
In order #o s#ar#* i# is ne!essary #o a!#iva#e a new %ro'e!# for a SAP enhan!emen# for
whi!h #he #ransa!#ion 0547 m"s# &e !alled. Provide a name for #he %ro'e!# and %ress #he
&"##on J!rea#e). A se!ond s!reen reB"es#ing a shor# des!ri%#ion will &e showed* en#er #he
reB"ired informa#ion and Jsave):
I# is ne!essary #o %rovide #he enhan!emen# for #he new %ro'e!#.
In #he lis#* sele!# #ha# one res%onsi&le for handle #he varia&les in #he BI,B$ B"eries:
-RSR..../ 0 BI: En&an+!nt# *)( G1)2a1 3a(%a21# %n R')(t%n,4
0hoosing J!om%onen#s)* i# is %ossi&le #o verify #ha# f"n!#ion mod"le
.II@SAP/++S0@001 is already assigned for #he new %ro'e!#* sele!#ing #ha# one D&y
do"&le !li!kingE* sys#em '"m%s #o #he f"n!#ion mod"le defini#ion whi!h has &asi!ally an
ins#r"!#ion like JI60/U7. KI+S+U01.). A!#"ally #he re%or# KI+S+U01 is reserved for
s#ore #he !"s#omer !ode whi!h will manage #he varia&le val"es in #he B$ B"ery.
6ow i# is ne!essary #o !rea#e #he re%or# KI+S+U01 in #ransa!#ion S.-L. B"# &efore #his
%ro!ed"re we need a varia&le whi!h will &e handled in #ha# re%or#. In #he ne(# i#em #he
s#e%s #o !rea#e a sim%le B"ery and a "ser e(i# varia&le #y%e will &e e(%lained.
4.2 $E% &uer' (esi"ner and )aria*le T'pe Customer Exit
1. In #he B"ery designer 7.1* !rea#e a new B"ery following #he s#andard %ro!ed"re. Sele!#
#he !hara!#eris#i! whi!h is reB"ired #o &e fil#ered and !rea#e a new varia&le:
F. Sele!# #he #e!hni!al name and #he des!ri%#ion for #he new varia&le in #he a%%ro%ria#ed
area:
-. Se# #he #y%e J0"s#omer e(i#) in #he field JPro!essing &y):
M. Sele!# #he !hara!#eris#i! and res#ri!# i# &y #he varia&le !rea#ed in #he %revio"s i#em as a
fil#er for #he B"ery D"se #he drag and dro%E:
G. 0rea#e a sim%le B"ery in #he J+ows,0ol"mns) area #ha# we !an "se as e(am%le:
N. 0"s#omer e(i# in #he %rogram KI+S+U01 wo"ld &e !rea#ed af#er saving #he B"ery.
4.3 Customer Exit and #$#P Code
he #ransa!#ion S.-L !o"ld &e "sed for !rea#ing #he %rogram KI+S+U01.
he mos# im%or#an# informa#ion here is #ha# #he J!"s#omer e(i# %rogram) will re!eive #he
varia&le name of #he B$ B"ery in #he ABAP varia&le Ji@vnam)* whi!h is defined as an
im%or# %arame#er in #he f"n!#ion mod"le .II@SAP/++S0@001 and #he B$ B"ery)s
varia&le val"e is handled in #he #a&le .@@+A68..
;en!e* i# is ne!essary #o !rea#e a %rogram #ha# !he!ks #he varia&le name in order #o
!onfirm if #he !orre!# one is &eing handled and manage i#s !"rren# val"es in #he #a&le
.@@+A68..
I# is an e(am%le of #he !ode:
OPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCO
OP In!l"de KI+S+U01
OPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCO
7AA: l@s@range <P. rrrangesid.
0AS. i@vnam.
$;.6 QK@+A+SQ.
l@s@rangeClow = Q1F-MGQ.
l@s@rangeCsign = QIQ.
l@s@rangeCo%# = Q.>Q.
APP.67 l@s@range 4 e@#@range.
.670AS..
6aviga#e #o #he #ransa!#ion 0547 #o a!#iva#e #he !"s#omer e(i#.
A,,itional In-or.ation
he !"s#omer e(i# for varia&les is !alled #hree #imes ma(imally and is !alled [email protected].
he firs# s#e% [email protected] = 1E is #riggered &efore #he %ro!essing of #he varia&le %o%C"% and
ge#s !alled for every varia&le of #he %ro!essing #y%e R!"s#omer e(i#S. his !o"ld &e "sed
#o fill yo"r varia&le wi#h defa"l# val"es.
he se!ond s#e% [email protected] = FE is #riggered af#er #he %ro!essing of #he varia&le %o%C"%.
his s#e% is !alled only for #hose varia&les #ha# are no# marked as Rready for in%"#S and
are se# #o Rmanda#ory varia&le en#ryS.
he #hird s#e% [email protected] = -E is !alled af#er all varia&le %ro!essing and ge#s !alled only
on!e and no# %er varia&le where #he "ser en#ries !o"ld &e valida#ed.
Please no#e #ha# "ser in%"# val"es !an no# &e overwri##en in#o a varia&le wi#h !"s#omer
e(i#. Val"es for o#her varia&les !an only &e derived or "ser en#ries !o"ld &e valida#ed.

You might also like