abap in bi 1.0

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.

Upload: saravana-kumar

Post on 03-Jun-2018

230 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ABAP in BI 1.0

8/12/2019 ABAP in BI 1.0

http://slidepdf.com/reader/full/abap-in-bi-10 1/15

Usage of ABAP in SAP BI 7.0Version: v1.0

By

Anweshi [email protected]

And

Jayalakshmi Velama [email protected]

Wipro Technologies29-Dec-2008

Abstract: This document discusses the usage of ABAP in BI in various objects.

Page 2: ABAP in BI 1.0

8/12/2019 ABAP in BI 1.0

http://slidepdf.com/reader/full/abap-in-bi-10 2/15

CONFIDENTIA IT!

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 Description1 0.1 Anweshi

Pagadala &JayalakshmiVelama

01-Apr-2010 Initial Draft

2 0.9 AnweshiPagadala &Jayalakshmi

Velama

9-Apr-2010 eleased f!r e"iew

# 1.0 AnweshiPagadala &JayalakshmiVelama

1$-Apr-2010 In%!rp!rated e"iew !mments

Page 3: ABAP in BI 1.0

8/12/2019 ABAP in BI 1.0

http://slidepdf.com/reader/full/abap-in-bi-10 3/15

TA% E OF CONTENT&

1 INTRODUCTION......................................................................................................................... 42 ABAP Statements genera y use! in BI ...................................................................................4" Usage o# Routines in BI.............................................................................................................$

#.1 ' (A ( )*(I+, I+ ( A+' ) A(I)+ ...................................................................................... /#.2 , +D )*(I+, I+ ( A+' ) A(I)+ .........................................................................................#.# , P, ( )*(I+, ...................................................................................................................#. 3A A (, I'(I )*(I+, ..................................................................................................... 4

4 %aria& e '(its............................................................................................................................. ) ' (,P' I+V)5V,D I+ (3I' P ) ,'' 6...............................................................................................9.1 P )J, ( A+A7, ,+( ) 'AP , +3A+ , ,+(' ................................................................... 9.2 8, *, : D ,'I7+, A+D V A IA85, ( :P, *'() , , I( ...............................................11.# *'() , , I( A+D A8AP )D, ....................................................................................... 1

Page 4: ABAP in BI 1.0

8/12/2019 ABAP in BI 1.0

http://slidepdf.com/reader/full/abap-in-bi-10 4/15

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)sABAP 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 overviewof "sing ABAP wi#h in BI while e(#ra!#ing* #ransforming and loading #he da#a. headvan#ages of #he ABAP &a!kgro"nd as i#)s easier #o "nders#and #he #e!hni!al as%e!#s ofB$* s"!h as when #here is a need #o !rea#e addi#ional #ransfer s#r"!#"res or if #here is aneed #o %rogram any !onversion ro"#ines for #he da#a &eing "%loaded* as well as &eingfamiliar wi#h #he so"r!e #a&les from SAP +,-.

2 ABAP STATEMENTS GENERALLY USED IN BI

S / Syn#a(: S / utput!"ields 23+45 #ource!table 2I6 4,APP 6 I68 Target!table 29' 34+ A// 6 +I S I6 Int!table 2$; + $ond 298+4UP B< %roup 29;AVI68 %roup!$ond 294+ + B< #ort!key 2 .

la"ses "sed in #he S / s#a#emen#:

( . WHERE: is "sed #o res#ri!# #he n"m&er of re!ords fe#!hed &y S / s#a#emen#. helogi!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!

2 +!t ,;<al t!

5ess than2 7reater than

2= 5ess than !r e;<al t!

= 7reater than !r e;<al t!

> ,;<al t!

6 +!t ,;<al t!

/ 5ess than

Page 5: ABAP in BI 1.0

8/12/2019 ABAP in BI 1.0

http://slidepdf.com/reader/full/abap-in-bi-10 5/15

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 I6 @ AB/ 2 !an &e "sed aso%erands when !om%aring wi#h rela#ional o%era#ors. he in#ernal #a&le I6 @ AB/ 2m"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 / will re#"rn re!ords from da#a&ase whi!h are ma#!hing wi#h #heI6 @ AB/ 2 &ased on $; + !la"se.

*) INTO/ APPENDING: Adds I6 4 s%e!ifi! fields where #he re!ords fe#!hed &yS / will ge# s#ored. I6 4 !la"se refreshes I6 @ AB/ !on#en#s and adds newre!ords fe#!hed &y S / in#o I6 @ AB/ .

APP 6 I68 will add re!ords fe#!hed &y S / * a# #he end of I6 @ AB/ ande(is#ing !on#en#s of I6 @ AB/ remains "n!hanged.

+) LOOP Syntax:

/44P A I&T!TAB'( 2 9I6 4 )ork Area 29$; + $ond 2

.

.

.6 /44P.

4+

/44P A I&T!TAB'( 29ASSI86I68 "ield #ymbol 29$; + $ond 2 .

.

.

.6 /44P.

he /44P and 6 /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 I6 @ AB/ 2 se "en#ially. i#her all#he lines !o"ld &e read or !ondi#ions 46 2 !o"ld &e s%e!ified #o res#ri!# #he lines #o

Page 6: ABAP in BI 1.0

8/12/2019 ABAP in BI 1.0

http://slidepdf.com/reader/full/abap-in-bi-10 6/15

&e read. he s#a#emen# &lo!k &e#ween /44P and 6 /44P is e(e!"#ed on!e for ea!hline.

5. FIELD-SYMBOLS

Syntax: "I('*+#,-B '# "#/ 0typing 1 #T23$T32( struc *("A3'T dobj4.

he 3I / CS<5B4/S s#a#emen# de!lares a field sym&ol 3S2. Af#er i#s de!lara#ion* afield 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 I6 @ AB/ 2. A row needs #o &es%e!ified &y ei#her naming val"es #a&le@key for #he #a&le key* a free !ondi#ion free@key oran inde(. he o"#%"# res"l# de#ermines when and where #he row !on#en#s are read.BI6A+< S A+ ; !la"se makes + A s#a#emen# a &i# fas#er. Prere "isi#e for "singBI6A+< S A+ ; is #ha# I6 @ AB/ 2 m"s# &e sor#ed wi#h #he keys "sed in + A )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 I6 @ 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 I6 @ 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 forfil#ering re!ords or fe#!hing glo&al da#a.

Page 7: ABAP in BI 1.0

8/12/2019 ABAP in BI 1.0

http://slidepdf.com/reader/full/abap-in-bi-10 7/15

li!k on S#ar# +o"#ine &"##on #o !rea#e S#ar# +o"#ine. S4U+ @PA ?A8 !on#ains!on#en#s of so"r!e da#a. S4U+ @PA ?A8 has same s#r"!#"re as #ha# of So"r!e of #heransforma#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.

li!k on nd +o"#ine &"##on #o !rea#e nd +o"#ine. + SU/ @PA ?A8 !on#ains %ro!ess da#a whi!h is %ro!essed via s#ar# ro"#ine and #ransforma#ion.+ SU/ @PA ?A8 has same s#r"!#"re as #ha# of #arge#. Addi#ionally* nd ro"#inee(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 fromSo"r!e #o #arge#. Bo#h #he S4U+ @PA ?A8 and + SU/ @PA ?A8 !o"ld &ea!!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 isdevelo%ed and #his is generally "sed for !"s#omiHing r"les.

Page 8: ABAP in BI 1.0

8/12/2019 ABAP in BI 1.0

http://slidepdf.com/reader/full/abap-in-bi-10 8/15

S4U+ @PA ?A8 e(is#s wi#h #he same s#r"!#"re as #ha# of So"r!e and+ SU/ @PA ?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+ @PA ?A8 and amended #o#he + SU/ @PA ?A8 . 54V !ommand needs #o &e "sed #o #ransfer #he da#a fromso"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

hara!#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 forhara!#eris#i!* #hen hara!#eris#i! #ransforma#ion ro"#ine and key fig"re #ransforma#ionro"#ine wo"ld #rigger &ased on #he r"le. he r"le level ro"#ines or #he field level ro"#inesi.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.

Page 9: ABAP in BI 1.0

8/12/2019 ABAP in BI 1.0

http://slidepdf.com/reader/full/abap-in-bi-10 9/15

4 VARIABLE EXITS

SAP %rovides a varia&le of #y%e !"s#omer e(i# for B$ "eries whi!h !"s#omer is a&le #omanage i#s val"es de%ends on #heir &"siness re "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 >"ery esigner and Varia&le y%e "s#omer (i#

"s#omer (i# and ABAP ode

4.1 Pro ect !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# forwhi!h #he #ransa!#ion 54 m"s# &e !alled. Provide a name for #he %ro'e!# and %ress #he

&"##on !rea#e). A se!ond s!reen re "es#ing a shor# des!ri%#ion will &e showed* en#er #here "ired informa#ion and save):

Page 10: ABAP in BI 1.0

8/12/2019 ABAP in BI 1.0

http://slidepdf.com/reader/full/abap-in-bi-10 10/15

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$ "eries:

RSR 0 BI: En&an+ ! nt# *)( G1)2a1 3a(%a21 # %n R ')(t%n,4

Page 11: ABAP in BI 1.0

8/12/2019 ABAP in BI 1.0

http://slidepdf.com/reader/full/abap-in-bi-10 11/15

hoosing !om%onen#s)* i# is %ossi&le #o verify #ha# f"n!#ion mod"leI @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 I6 /U K +S+U01.). A!#"ally #he re%or# K +S+U01 is reserved fors#ore #he !"s#omer !ode whi!h will manage #he varia&le val"es in #he B$ "ery. 6ow i# is ne!essary #o !rea#e #he re%or# K +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 #hes#e%s #o !rea#e a sim%le "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 "ery designer 7.1* !rea#e a new "ery following #he s#andard %ro!ed"re. Sele!##he !hara!#eris#i! whi!h is re "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#edarea:

Page 12: ABAP in BI 1.0

8/12/2019 ABAP in BI 1.0

http://slidepdf.com/reader/full/abap-in-bi-10 12/15

-. Se# #he #y%e "s#omer e(i#) in #he field Pro!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 afil#er for #he "ery D"se #he drag and dro%E:

Page 13: ABAP in BI 1.0

8/12/2019 ABAP in BI 1.0

http://slidepdf.com/reader/full/abap-in-bi-10 13/15

G. rea#e a sim%le "ery in #he +ows, ol"mns) area #ha# we !an "se as e(am%le:

N. "s#omer e(i# in #he %rogram K +S+U01 wo"ld &e !rea#ed af#er saving #he "ery.

Page 14: ABAP in BI 1.0

8/12/2019 ABAP in BI 1.0

http://slidepdf.com/reader/full/abap-in-bi-10 14/15

4.3 Customer Exit and #$#P Code

he #ransa!#ion S -L !o"ld &e "sed for !rea#ing #he %rogram K +S+U01.

he mos# im%or#an# informa#ion here is #ha# #he !"s#omer e(i# %rogram) will re!eive #hevaria&le name of #he B$ "ery in #he ABAP varia&le i@vnam)* whi!h is defined as anim%or# %arame#er in #he f"n!#ion mod"le I @SAP/++S0@001 and #he B$ "ery)svaria&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:

O CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

O In!l"de K +S+U01

O CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

A A: l@s@range <P rrrangesid.

AS i@vnam.

$; 6 QK@+A+ S Q.

l@s@rangeClow = Q1F-MGQ.

l@s@rangeCsign = QIQ.

l@s@rangeCo%# = Q >Q.

APP 6 l@s@range 4 e@#@range.

6 AS .

6aviga#e #o #he #ransa!#ion 54 #o a!#iva#e #he !"s#omer e(i#.

Page 15: ABAP in BI 1.0

8/12/2019 ABAP in BI 1.0

http://slidepdf.com/reader/full/abap-in-bi-10 15/15

A,,itional In or.ation

he !"s#omer e(i# for varia&les is !alled #hree #imes ma(imally and is !alled I@S P.

he firs# s#e% DI@S P = 1E is #riggered &efore #he %ro!essing of #he varia&le %o%C"% andge#s !alled for every varia&le of #he %ro!essing #y%e R!"s#omer e(i# . his !o"ld &e "sed#o fill yo"r varia&le wi#h defa"l# val"es.

he se!ond s#e% DI@S P = 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%"# andare se# #o Rmanda#ory varia&le en#ry .

he #hird s#e% DI@S P = -E is !alled af#er all varia&le %ro!essing and ge#s !alled onlyon!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#omere(i#. Val"es for o#her varia&les !an only &e derived or "ser en#ries !o"ld &e valida#ed.