You are on page 1of 15

How to use BADIs (Business Add-Ins) for subsequent processing in BW Data Staging

BUSINESS INFORMATION W AREHOUSE

ASAP How to Paper

Applicable Releases: 2.1C


SAP (SAP America, Inc. and SAP AG) assumes n res! nsi"i#i$% & r err rs r missi ns in $'ese ma$eria#s. T'ese ma$eria#s are !r (ided )as is* +i$' u$ a +arran$% & an% ,ind, ei$'er e-!ress r im!#ied, inc#udin. "u$ n $ #imi$ed $ , $'e im!#ied +arran$ies & merc'an$a"i#i$%, &i$ness & r a !ar$icu#ar !ur! se, r n n/in&rin.emen$. SAP s'a## n $ "e #ia"#e & r dama.es & an% ,ind inc#udin. +i$' u$ #imi$a$i n direc$, s!ecia#, indirec$, r c nse0uen$ia# dama.es $'a$ ma% resu#$ &r m $'e use & $'ese ma$eria#s. SAP d es n $ +arran$ $'e accurac% r c m!#e$eness & $'e in& rma$i n, $e-$, .ra!'ics, #in,s r $'er i$ems c n$ained +i$'in $'ese ma$eria#s. SAP 'as n c n$r # (er $'e in& rma$i n $'a$ % u ma% access $'r u.' $'e use & ' $ #in,s c n$ained in $'ese ma$eria#s and d es n $ end rse % ur use & $'ird !ar$% +e" !a.es n r !r (ide an% +arran$% +'a$s e(er re#a$in. $ $'ird !ar$% +e" !a.es.

HOW TO

USE

A!"S #OR SU SE$UE%T PROCESS"%& "%

W !ATA STA&"%&

'a()ar* 2++2

1,,- SAP A.ER"CA/ "%C. A%! SAP A&

TA

0E O#

CO%TE%TS

HOW TO

USE

A!"S #OR SU SE$UE%T PROCESS"%& "%

W !ATA STA&"%&

)si(ess Sce(ario

W'en e-ecu$in. da$a # ads in$ BW, % u &$en +an$ $ $ri..er su"se0uen$ !r cesses au$ ma$ica##%. T' se su"se0uen$ !r cesses c u#d inc#ude s$andard !r cesses re#a$ed $ da$a s$a.in. (#i,e a..re.a$e r ##/u!, in& cu"e c m!ressi n, O1S c n$en$ ac$i(a$i n r $'e re"ui#d & indices). H +e(er, $'ere a#s c u#d "e $'er su"se0uen$ !r cesses, +'ic' are $%!ica##% n $ !ar$ & $'e s$andard # ad !r cess (#i,e $'e $ransmissi n & in$erne$ e/mai#s, r $'e e-ecu$i n & cus$ m ABAP23 re! r$s). T'is d cumen$ descri"es a .enera#/!ur! se in$er&ace, +'ic' .i(es % u &u## &#e-i"i#i$% (er $'e e-ecu$i n & !r cesses, $ri..ered "% $'e da$a e-$rac$i n in$ BW. In $'e a!!endi- a#s s me sam!#e ABAP O"4ec$s c din. is #is$ed, +'ic' can "e used $ e-ecu$e an SAP O&&ice mai# (ia $'e BA1I.

2 "(tro1)ctio(
F r su"se0uen$ !r cessin. in da$a s$a.in. in BW, $'ere are 5 "asic !$i ns a(ai#a"#e6 Tri..er & e(en$s, +'ic' can "e !ic,ed u! "% $'er !r .rams 2 !r cesses 2 e(en$ c'ains. 7a##/u! & a &unc$i n m du#e, su!!#ied "% SAP ($'is &ea$ure +as im!#emen$ed ri.ina##% & r BW8.9, ' +e(er s' u#d n $ "e used an%m re m (in. & r+ard). Tri..er & a Business Add/In (BA1I). $ $'e BA1I

T'is s$e!/"%/s$e! .uide e-!#ains $'e re0uired s$e!s $ im!#emen$, $es$ and $r u"#es' im!#emen$a$i n.

A#$' u.' $'e im!#emen$a$i n & $'e BA1I is &air#% eas%, % u s' u#d 'a(e s me ,n +#ed.e and e-!erience in $'e & ## +in. areas6 BW sc'edu#in. and adminis$ra$i n Business Add/Ins (see & r e-am!#e Online Documentation: Basis >> Changing the SAP Standard >> Business Add-Ins) ABAP23 !r .rammin. (idea##% s me ABAP O"4ec$s !r .rammin.) ABAP23 de"u..er

Fina##%, a#s n $e $'a$ (+'i#e $'e u!.rade"i#i$% & $'e BA1I in$er&ace is su!! r$ed "% SAP), #i,e a#+a%s +'en % u !er& rm cus$ m de(e# !men$, SAP cann $ .uaran$ee $'e c rrec$ness and u!.rade"i#i$% & % ur c din.. Hence, "e& re indu#.in. in$ e-$ensi(e Add/In de(e# !men$, i$ is 'i.'#% rec mmended $ &irs$ ana#%:e $'e "usiness needs, and $ +ei.'$ $'em a.ains$ $'e ! $en$ia# ris,s. A#s , ma,e sure $'a$ % u &ami#iari:e % urse#& &irs$ +i$' $'e s$andard BW &unc$i na#i$% ; % u mi.'$ ac$ua##% n $ need $ use $'e BA1Is, in man% si$ua$i ns. A#s !#ease n $e, +i$' BW Re#. 5.< SAP s$ar$ed $ s'i! Pr cess 7'ains, +'ic' mi.'$ &ur$'er reduce $'e demand & r BA1Is.

2++2 SAP A.ER"CA/ "%C. A%! SAP A&

HOW TO

USE

A!"S #OR SU SE$UE%T PROCESS"%& "%

W !ATA STA&"%&

2 T3e Step * Step Sol)tio(


T'e & ## +in. s$e!s descri"e $'e im!#emen$a$i n and usa.e & BA1Is. T'e &irs$ c'a!$er descri"es $'e im!#emen$a$i n, +'i#e $'e sec nd c'a!$er is dedica$ed $ $'e de"u..in. & $'e BA1I im!#emen$a$i n.

E(able t3e )sa4e o5

A!"s 5or s)bse6)e(t processi(4

1. Maintain an InfoPackage, (which you must have created for your BW staging scenario). Push the button Subsequent Process. .

2. !n the "o"#u" screen, check the method Execute Business Add-In , and then "ush Enter .

3. !nce you are back to the schedu$er screen, you wi$$ note the green checkmark on the Subsequent Process. Bo%, indicating that you have in fact se$ected some subse&uent "rocessing method. Make sure to save your work in the schedu$er.

2++2 SAP A.ER"CA/ "%C. A%! SAP A&

HOW TO

USE

A!"S #OR SU SE$UE%T PROCESS"%& "%

W !ATA STA&"%&

.ai(tai( a(1 acti7ate a

A!" i8ple8e(tatio(

1. 'ou can access the re&uired ()P B)*I definition either via transaction SE18, or via the menu as indicated on the right (SAP menu >> Tools >> ABAP Workbenc >> !tilities >> Business Add-Ins >> "e#inition).

2. +he B)*I definition, that you want to use here, is an ()P defined definition. It is ca$$ed BW$Sc eduler . ,nter this definition name, and then "ush "is%l&' .

3. !n this screen, you wi$$ see some genera$ "ro"erties of the B)*I. -rom here, "ush the button Inter#&ce .

2++2 SAP A.ER"CA/ "%C. A%! SAP A&

HOW TO

USE

A!"S #OR SU SE$UE%T PROCESS"%& "%

W !ATA STA&"%&

4. 'ou wi$$ see, that the "re# defined interface is ca$$ed I($E)$BW$S*+E"!,E-. +here is a method associated with this interface, ca$$ed !SE-$E)IT. .ere, doub$e#c$ick on the method descri"tion.

5. *oub$e#c$ick wi$$ take you to the interface descri"tion. +he user e%it offers the fo$$owing im"ort "arameters (see a$so !(( note /0122/)3 4543 +he re&uest number of the $oad "rocess. +(+)+6(3 (tatus (Icon7green7$ight for e%ited successfu$$y or Icon7red7$ight for e%ited incorrect$y or (P)8, for InfoPackgegrou" e%ited without check). (!648,3 +he name of the Info(ource, for which data was $oaded. !9+P(!648,3 +he name of the *ata(ource. 9!:('(3 +he name of the $ogica$ system I* (source system), from which data was $oaded. +'P3 +y"e of data (*;transaction data, M;master data, attributes, +;te%ts, .;hierarchies).

2++2 SAP A.ER"CA/ "%C. A%! SAP A&

HOW TO

USE

A!"S #OR SU SE$UE%T PROCESS"%& "%

W !ATA STA&"%&

:543 :rou" re&uest number (on$y fi$$ed, if function modu$e is ca$$ed at the end an InfoPackage :rou"). W4I+,7+!7!*(3 <=<, if an !*( is u"dated (not fi$$ed in case of InfoPackage :rou"). . W4I+,7+!786B,3 <=<, if an Info8ube is u"dated (not fi$$ed in case of InfoPackage :rou"). :4!6P78)993 <=<, if funtion modu$e is ca$$ed by an InfoPackage :rou" (otherwise (P)8,).

6. )s a ne%t ste", you wi$$ need to create a so#ca$$ed Im"$ementation for your B)*I. Im"$ementations can be accessed via transaction SE1., or direct$y from the menu (from the main screen of the B)*I definition) via Im%lement&tion .

7. If you choose "is%l&' or * &n/e , you wi$$ receive an error message, in case that there is no Im"$ementation defined yet.

8. >ia Im%lement&tion >> *re&te , you can create a new Im"$ementation. Make sure to fo$$ow the naming convention for deve$o"ment ob?ects (i.e. the technica$ name must start with the $etter 0 ).
2++2 SAP A.ER"CA/ "%C. A%! SAP A& :

HOW TO

USE

A!"S #OR SU SE$UE%T PROCESS"%& "%

W !ATA STA&"%&

9. !n the ne%t screen for the Im"$ementation ("ro"erty screen), enter a $ong descri"tion.

10. !nce you save your new Im"$ementation, you wi$$ be "rom"ted for a deve$o"ment c$ass (as we$$ as for a deve$o"ment re&uest). -o$$ow here the usua$ "rocedure for deve$o"ment c$ass @ re&uest in"ut.

11. )$so, you wi$$ be re&uired to register as a deve$o"er, if you have not done so yet. )gain, here fo$$ow the usua$ standard "rocedure.

2++2 SAP A.ER"CA/ "%C. A%! SAP A&

HOW TO

USE

A!"S #OR SU SE$UE%T PROCESS"%& "%

W !ATA STA&"%&

12. !nce you have saved your Im"$ementation, you are back to the "ro"erties screen. *oub$e#c$ick on the method !ser$E)IT .

13. *oub$e#c$ick wi$$ take you to the )B)P !b?ects ,ditor. .ere, enter your custom coding (see ne%t screens, and a""endi%, for e%am"$es).

14. By "ushing the button Si/n&ture , you wi$$ get a $isting of the interface "arameters, as described above.

2++2 SAP A.ER"CA/ "%C. A%! SAP A&

<

HOW TO

USE

A!"S #OR SU SE$UE%T PROCESS"%& "%

W !ATA STA&"%&

15. P$ease see on the right, for a coding e%am"$e. +his sam"$e coding is not much of "ractica$ use A however it<s a great coding for getting started. Basica$$y, first it discriminates on your 6ser#I* (to make sure that no other user is affected). +hen, an end$ess $oo" is "rogrammed, which wi$$ he$" you to debug (and further understand) the coding.

16. )ctivate your coding, using the activation iconB make sure to se$ect a$$ the re$evant ob?ects.

17. !nce you are back to the B)*I definition screenC

2++2 SAP A.ER"CA/ "%C. A%! SAP A&

HOW TO

USE

A!"S #OR SU SE$UE%T PROCESS"%& "%

W !ATA STA&"%&

18. C you can se$ect your new Im"$ementation, from the menu via Im%lement&tion >> * &n/e .

19. 5ow you need to activate the Im"$ementation itse$f, via the )ctivation Icon. (In case that you a$ready have a com"eting Im"$ementation for this B)*I active, you wi$$ get the message on the right. In this case, make sure to first de# activate the com"eting Im"$ementation, as there can be on$y one Im"$ementation active at a time).

20. !nce you have activated the Im"$ementation, this wi$$ be indicated via the status message Acti1e on the right of the technica$ name.

2++2 SAP A.ER"CA/ "%C. A%! SAP A&

HOW TO

USE

A!"S #OR SU SE$UE%T PROCESS"%& "%

W !ATA STA&"%&

E=ec)te a(1 1eb)4 t3e A!"


1. 5ow it is the time to test your deve$o"ments. :o back to the schedu$er (InfoPackage), and e%ecute the re$evant e%traction (of course, with o"tion Subsequent Process sti$$ activated).

2. In transaction DS2345 (Process 61er1ie7) you can monitor the e%traction $oad. ("ecifica$$y, you wi$$ recogniEe when the data e%tract has entered your custom $ogic (in form of an end$ess $oo"), in "rogram 0*,$I2$,S".

3. 8$ick on the re$evant work# "rocess, then choose from the menu DPro/r&m8session >> Pro/r&m >> "ebu//in/5. +here wi$$ be a "o"#u", and you wi$$ have to confirm that you rea$$y want to debug.

2++2 SAP A.ER"CA/ "%C. A%! SAP A&

1+

HOW TO

USE

A!"S #OR SU SE$UE%T PROCESS"%& "%

W !ATA STA&"%&

4. +he debugger wi$$ take you to the end$ess#$oo" that you "rogrammed before.

5. 5ow in the debugger, change the fie$d va$ue of the variab$e 9(5< to D)<. +his wi$$ a$$ow you to $eave the end$ess#$oo". -rom there, you may kee" on debugging.

6. ) few ste"s further down, you wi$$ be taken to the interface of the user#e%it of the B)*I. .ere you can check the interface va$ues of the B)*I.

2++2 SAP A.ER"CA/ "%C. A%! SAP A&

11

HOW TO

USE

A!"S #OR SU SE$UE%T PROCESS"%& "%

W !ATA STA&"%&

9 Appe(1i= >Sa8ple A AP Co1i(4?


T'e ABAP O"4ec$s c din. "e# + is a &u##% &unc$i nin., !rac$ica# a!!#ica$i n & $'e BW BA1Is. T'e c din. $ri..ers an E-!ress SAP O&&ice Mai# (& r $+ users), "ased n $'e u$c me & $'e # adin. !r cess.
met od I($E)$BW$S*+E"!,E-9!SE-$E)IT. : d&t&; ,S<. d&t&; document$d&t& t'%e sodocc /i1= ob>ect$content t'%e solisti1= recei1ers t'%e somlreci1= i$ob>ect$content t'%e st&nd&rd t&ble o# solisti1= i$recei1ers t'%e st&nd&rd t&ble o# somlreci1. : i# s'-un&me eq ?,6T+A-?. : : : : do. c eck not ,S< is initi&l. exit. enddo.

: endi#. c&se Source. 7 en ?,S-S*-2?. conc&ten&te tst&tus ?-equest? rnr ?u%lo&ded? into document$d&t&-ob>$descr se%&r&ted b' s%&ce. conc&ten&te ?-equest? rnr ?#or In#osource? source ?u%lo&ded? into ob>ect$content-line se%&r&ted b' s%&ce. &%%end ob>ect$content to i$ob>ect$content. conc&ten&te ?#rom sources'stem? lo/s's into ob>ect$content-line se%&r&ted b' s%&ce. &%%end ob>ect$content to i$ob>ect$content. mo1e ?2ETTE@? to recei1ers-recei1er. mo1e ?)? to recei1ers-ex%ress. &%%end recei1ers to i$recei1ers. mo1e ?,6T+A-? to recei1ers-recei1er. mo1e ?)? to recei1ers-ex%ress. &%%end recei1ers to i$recei1ers.

2++2 SAP A.ER"CA/ "%C. A%! SAP A&

12

HOW TO

USE

A!"S #OR SU SE$UE%T PROCESS"%& "%

W !ATA STA&"%&

: : : : : : :

c&ll #unction ?S6$<EW$"6*!2E<T$SE<"$API1? ex%ortin/ document$d&t& A document$d&t& document$t'%e A ?-AW? %ut$in$outbox A?? I2P6-TI<B SE<T$T6$A,, A <EW$6B@E*T$I" A t&bles 6B@E*T$+EA"EA ob>ect$content A i$ob>ect$content 6B@E*T$PA-A A 6B@E*T$PA-B A recei1ers A i$recei1ers E)*EPTI6<S T66$2A<C$-E*EIDE-S A1 "6*!2E<T$<6T$SE<T AE "6*!2E<T$TCPE$<6T$E)IST A F 6PE-ATI6<$<6$A!T+6-I0ATI6< A G PA-A2ETE-$E--6A3 )$E--6AH E<I!E!E$E--6AJ 6T+E-S A 8.

i# s'-subrc K> 4. : 2ESSABE I" SC-2SBI" TCPE SC-2SBTC <!2BE- SC-2SB<6 : WIT+ SC-2SBD1 SC-2SBDE SC-2SBDF SC-2SBDG. endi#.

7 en ot ers. endc&se.

2++2 SAP A.ER"CA/ "%C. A%! SAP A&

12