Defining and Implementing Business Add

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 8

Defining and Implementing Business Add-ins (BADI) (Step-by-step with screenshots)

By Vikram Chellappa Defining a Business Add-in SAP provides the BADIs where are appli a!le in the standard appli ations" Appli ation programmer whoever wishes to have a Business Add-ins in a parti ular program an define the interfa e for an enhan ement in the Business Add-in !uilder" Programmer has to program the interfa e all in the program at the appropriate pla e" Customers an sele t the add-in and implement it a ordingly to their !usiness needs" #" $rom SAP menu% hoose &ools -' ABAP (ork!en h -' )tilities -' Business Add-ins or transa tion ode S*#+" &he e,ample% whi h is illustrated% is the string onversion in the program" And giving the provision to the users to determine themselves how their strings are to !e onverted" Appli ation developer define an enhan ement% onsists of interfa e with a method with hanging parameter used to pass the string" -" *nter the BADI name and hoose reate

." *nter the short te,t% hoose the interfa e ta!"

/" Dou!le li k on the interfa e name field" &he system !ran hes to the lass !uilder"

0" In the lass !uilder assign a method to the interfa e and define a parameter with the attri!utes"

1" Save and a tivate the interfa e and navigate !a k to the Business Add-in definition" 2ow in the BADI s reen% displays the method you have reated for the interfa e" (hen you maintain the interfa e methods% orresponding e,e uting lass 3Adapter lass4 is generated" 5" Save your entries and do ument the des ription of the Business Add-in" Do umentation is important for the users to understand the purpose of the Add-in" Implementation of BADI #" &he list of Business Add-ins availa!le in the system an !e found through SAP 6eferen e Implementation guide 3I784 or in omponent hierar hy" BADIs definition is in luded in I78 so that the ustomer9partner an reate suita!le% ompany-spe ifi implementations

2. In the SAP menu% hoose ABAP (ork!en h -' )tilities -' Business Add-ins or

transa tion ode S*#:"


." *nter the implementation name and li k on the reate !utton"

/" *nter the BADI name

0" *nter the short des ription for the BADI implementation and implement the interfa e in the lass appearing in the BADI implementation s reen"

1" Dou!le li k on the implementation lass and insert the desired sour e ode for the implementation !etween the method ZIF_EX_BUSINESSADDIN~CONVERSION. And Method" In this parti ular e,ample enter the statement translate arameter to ! er "ase " Save and a tivate your entries and return to the hange implemention s reen"

5" Choose A tivate% now you

an use this implementation when the appli ation program is e,e uted" Several implementations may e,ist for a Business Add-in !ut that is not used in multiple use !asis" ;owever only one implementation an !e a tivate at any one time" But in ase of m!lt# le !se of the BADI% we an have multiple implementations a tivate" &he instan e generation of the implementing lass must set the attri!ute as pu!li and not as private% prote ted or a!stra t" System will give dump if you do so"

+" $ollowing is the ode for the lass <C=>C?2V*6SI?2>BADI>I7P= method C?2V*6SI?2 Method ZIF_EX_BUSINESSADDIN~CONVERSION. translate para eter to !pper "ase. end ethod. Calling BADI in the Appli ation

#" (hen we define BADI% enhan ement management generates a lass that implements the
interfa e" &he appli ation developer uses a fa tory method to reate an instan e of adapter lass in the appli ation program and alls orresponding method" &he adapter lass method generated !y the enhan ement management de ides !y he king the entries in the ta!le whether one or several a tive implementations need to !e alled" If re@uired% the implementations are su!se@uently e,e uted" &he appli ation program ensures only the adapter lass method is alled" &he appli ation program doesnt know whi h implementations are alled" -" Call the string onversion Business Add-in% the program alling the Business Add-in" $ollowing is the ABAP sour e ode RE#OR$ ZM#$ES$_BADI. % De"lar&n' the handler "lass( "l_e)&thandler de*&n&t&on load. % Inter*a"e Re*eren"e data( +ad&_&nter*a"e t,pe re* to ZIF_EX_BUSINESSADDIN. % Str&n' data( -_str./01 t,pe " 2al!e 3+add& test3. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%Start o* Sele"t&on E2ent..................... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% start4o*4sele"t&on. "all ethod "l_e)&thandler56'et_&nstan"e "han'&n' &nstan"e 5 +ad&_&nter*a"e. -r&te( 7 3#lease "l&"8 here3. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%At l&ne4sele"t&on E2ent..................... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% at l&ne4sele"t&on. -r&te( 7 3or&'&nal -ord39 -_str. &* not +ad&_&nter*a"e &s &n&t&al. "all ethod +ad&_&nter*a"e46"on2ers&on "han'&n' para eter 5 -_str. end&*. -r&te( 7 3Con2erted -ord39 -_str. $ilter dependent Badi #" Business Add-in definition level 3for e,ample a ountry% industry se tor4 we an have filter dependent option" If an enhan ement for ountry spe ifi versions then it is likely that different

partners an implement this enhan ement" &he individual ountries an reate and a tivate their own implementation" -" In the enhan ement definition% all the methods reated in the enhan ements interfa e need to have filter value as their importing parameter" &he appli ation program provides the filter values for the implementation method" ." $ilter dependent BAdi is alled using one filter value only% it is possi!le to he k a tive implementation for the filter value using the fun tion module SAC>*AI&>C;*CB>AC&IV*" 7ultiple use Badi #" &here are multiple use and single use Business Add-ins" &his option an !e hoose at Business Add-in definition" -" &he distin tion is !ase on the pro edure or event hara ter of an enhan ement" In the first ase the program waits for the enhan ement to return a return ode" &ypi al e,ample is !enefit al ulation in ;6 depending on the implementation% alternative al ulations an !e e,e uted" In ase of multiple use add-ins% an event that may !e interest to other omponents in program flow" Any num!er of omponents ould use this event as a hook to hang their own additional a tions on to" ." &here is no se@uen e ontrol for multiple-use implementations of BAdis" Se@uen e ontrol is te hni ally impossi!le% at the time of the definition the interfa e does not know whi h implementations parameters will !e hange the implementations" /" &he on ept of multiple use of the Business Add-in is that has !een implemented on e already an !e implemented again !y right of the software hain"

EXITS:

Mater#al$E%ternal Ser&#"es' User(E%#ts' BASCCCC# Servi e masterD Che k servi e spe ifi ations BASICCC# IDo servi e masterD In!ound pro essing BASICCC# IDo servi e masterD In!ound pro essing BAS?CCC# IDo servi e masterD ?ut!ound pro essing BAS?CCC# IDo servi e masterD ?ut!ound pro essing 78ACCCC# 7aterial 7aster 3Industry4D Che ks and *nhan ements 78ACCCC# 7aterial 7aster 3Industry4D Che ks and *nhan ements 78ACCCC- 7aterial 7aster 3Industry4D 2um!er Assignment 78ACCCC- 7aterial 7aster 3Industry4D 2um!er Assignment 78ACCCC. 7aterial 7aster 3Industry and 6etail4D 2um!er Display 78ACCCC. 7aterial 7aster 3Industry and 6etail4D 2um!er Display 78ACCCC. 7aterial 7aster 3Industry and 6etail4D 2um!er Display 78ACCCC. 7aterial 7aster 3Industry and 6etail4D 2um!er Display 78VCCCC# 7aterial 7aster 3Industry4D A=* Distri!ution 78VCCCC# 7aterial 7aster 3Industry4D A=* Distri!ution

78VCCCC- 7aterial 7aster 3Industry4D 6ead Values for $ilter ?!Ee ts 78VCCCC. 7aterial master 3retail4D A=* distri!ution 78VCCCC. 7aterial master 3retail4D A=* distri!ution 78(CCCC# 7aterial 7aster 36etail4D Additional Data 78(CCCC- 7aterial 7aster 36etail4D 2um!er Assignment 78(CCCC- 7aterial 7aster 36etail4D 2um!er Assignment 78(CCCC- 7aterial 7aster 36etail4D 2um!er Assignment S6V>$67 S6VD $ormula al ulation 3o!solete sin e /"CAF4 S6V>$67 S6VD $ormula al ulation 3o!solete sin e /"CAF4 S6V>$67 S6VD $ormula al ulation 3o!solete sin e /"CAF4 S6VD*& )ser s reen on ta! strip of servi e detail s reen S6VD*& )ser s reen on ta! strip of servi e detail s reen S6VD*& )ser s reen on ta! strip of servi e detail s reen S6VD*& )ser s reen on ta! strip of servi e detail s reen S6V*DI& Servi e list ontrol 3maintenan e9display4 S6V*2&6G )nplanned part of entry sheet 3o!solete sin e 6el" ."#84 S6V*SI Data onversion entry sheet interfa e S6V*SI Data onversion entry sheet interfa e S6V*SB2 Set a ount assignment in servi e line S6V*S== Servi e line he ks S6V*S== Servi e line he ks S6V*SS6 Set entry sheet header data S6V*)SC6 )ser s reen on entry sheet ta!strip S6V*)SC6 )ser s reen on entry sheet ta!strip S6V*)SC6 )ser s reen on entry sheet ta!strip S6V*)SC6 )ser s reen on entry sheet ta!strip S6VB2&&P Setting the a ount assgnmt ategory when reading in% if H)H S6V=I7I& =imit he k S6V7AI=# Pro essing of mail !efore generation of sheet S6V7AI=# Pro essing of mail !efore generation of sheet S6V7S&=V Conversion of data during importing of standard servi e at" S6VP?(*B Pur hase order for servi e entry in (e! S6VI)?& Servi e e,port9import for in@uiry9@uotations S6VI)?& Servi e e,port9import for in@uiry9@uotations S6V6*= Changes to omm" stru ture for release of entry sheet S6VS*= Servi e sele tion from non-SAP systems S6VS*= Servi e sele tion from non-SAP systems BADIs' A6&7AS>BAPI>*A&*2D Influen e In!ound Pro essing for 7aterial-BAPI A6&7AS>DA&A>*26IC; *nri hment of A=* Change Pointers for A6&7AS IDo s A6&7AS>DA&A>6*D)C* IDo $iltering at &ime of Data Import for A6&7AS A6&7AS>$I=&*6I28 Customer-Defined 6e ipient $ilter for A6&7AS IDo BADI>A6&IC=*>7ASS>6& Customer-Spe ifi Arti le 7aster Data *nhan e" in 7ass 7ain" BADI>A6&IC=*>6*$>6& BAdI for 6eferen e and Copy ;andling in the Arti le 7aster BADI>*A2>SGS&*7A&IC BADI>8&I2>VA6IA2& BADI>7A&>$>SP*C>S*= BAdI for 7aterial Spe ial $ield Sele tion BADI>7A&*6IA=>C;*CB *nhan ed he ks for material master ta!le BADI>7A&*6IA=>?D

BADI>7A&*6IA=>6*$ Addition of ustomer-defined default data for material BADI>7A&7AS>A=*>C6 Change Data in 7A&7AS IDo (hen 8enerating an IDo BADI>7A&7AS>A=*>I2 Change Data in 7A&7AS IDo Before Posting BADI>7A&26>C;*CB>PVS BADI>77>7A&26 BADI>77>SPS&?CB BADI>SC6**2>=?8IC>6& *,it for CustomerJs ?wn Control of S reen Se@uen e9Validity CD&>C;*CB>7A&*6IA= Che ks for *,isten e of a 7aterial in a CD& 7A&86P>SB)>)PD BAdI for the Arti le ;ierar hy Conne tion 78>7ASS>2*(S*8 )ser-Spe ifi $ields K Segments in 7ass 7aintenan e BOR O)*e"ts' B)S##5+CC- Servi e Produ t

You might also like