1. The document describes how to create a single and multiple implementation of a BADI (Business Add-In) in SAP. It involves creating a BADI definition in transaction SE18, then creating one or more implementations of that BADI in transaction SE19. The implementations can add custom code and logic that is called from core SAP transactions.
2. It also provides steps to search for an existing BADI related to a specific SAP transaction (such as goods receipt), then implementing that BADI to add additional validation logic when data is entered into that transaction.
3. Finally, it outlines how to create a BADI definition with function codes to add custom menu options to a report program. This
1. The document describes how to create a single and multiple implementation of a BADI (Business Add-In) in SAP. It involves creating a BADI definition in transaction SE18, then creating one or more implementations of that BADI in transaction SE19. The implementations can add custom code and logic that is called from core SAP transactions.
2. It also provides steps to search for an existing BADI related to a specific SAP transaction (such as goods receipt), then implementing that BADI to add additional validation logic when data is entered into that transaction.
3. Finally, it outlines how to create a BADI definition with function codes to add custom menu options to a report program. This
1. The document describes how to create a single and multiple implementation of a BADI (Business Add-In) in SAP. It involves creating a BADI definition in transaction SE18, then creating one or more implementations of that BADI in transaction SE19. The implementations can add custom code and logic that is called from core SAP transactions.
2. It also provides steps to search for an existing BADI related to a specific SAP transaction (such as goods receipt), then implementing that BADI to add additional validation logic when data is entered into that transaction.
3. Finally, it outlines how to create a BADI definition with function codes to add custom menu options to a report program. This
1. The document describes how to create a single and multiple implementation of a BADI (Business Add-In) in SAP. It involves creating a BADI definition in transaction SE18, then creating one or more implementations of that BADI in transaction SE19. The implementations can add custom code and logic that is called from core SAP transactions.
2. It also provides steps to search for an existing BADI related to a specific SAP transaction (such as goods receipt), then implementing that BADI to add additional validation logic when data is entered into that transaction.
3. Finally, it outlines how to create a BADI definition with function codes to add custom menu options to a report program. This
Go to transaction SE18 and create a BADI Definition. Enter the description. The name of the interface will be automatically proposed. Double clic on it. www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e 1 of $1 Enter the name of the method you want to create. %lic the #aramters pushbutton to create parameters for the method. Sa&e and acti&ate it. Go to transaction SE1' and create a BADI implementation. A popup window will as you for the definition name. Enter the name of the BADI definition which you ha&e created. www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e $ of $1 #ress Enter. Enter the description for the implementation. Then sa&e and acti&ate it. Double clic on the method name. (rite the code. Sa&e and acti&ate it. www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e ) of $1 Then* create a code usin! the BADI www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e + of $1 1.2 Multiple Implementation %reate a BADI, -S.B/GET/0ATE1IA2S/1 in a manner similar to that created abo&e. But* chec the checbo3 for 0ultiple .se Then* create one implementations for the same BADI,4 5%ode is similar to the pre&ious one6 www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e 7 of $1 Then* create a pro!ram utili8in! the BADI,4 9ow* you want to create another implementation of the same BADI. 2et us e3amplify the concept. Say* you want that when the user will enter :GA1I; in the selectiuon4screen* it will stand for :%A1; internally and selection will be done out of 0A1A table based on material code , :%A1;. <* you define another implementation of the same BADI from transaction , SE1'. www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e = of $1 9ow* when you will e3ecute the pro!ram and enter :GA1I; in the material code field in the selection4 screen* it will !et internally translated to :%A1; when the second implementation will be acti&e. www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e > of $1 1.3 Searching for BADI in SA !ransaction and Implementing it There is a business demand in AB% corporation . when the user will post !oods receipt &ia transaction 0IG<* he should enter same date in document date and postin! date field. Else* an information messa!e will as the user to do that. The Bill of 2adin! number should start with :9#; -ou* as a SA# Technical %onsultant* is ased to translate this idea into the appropriate section of the code. -our mana!er has ased you to use BADI instead of any user or field e3its to implement the idea. Go to the pro!ram behin! 0IG< and search for the phrase , %2/E?IT@A9D2E1ABGET/I9STA9%E in the main pro!ram. This will show you the BADIs which can be implemented by you to incorporate the business demand. www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e 8 of $1 So* you !et to now now that there are two BADIs which can come to your use. They are, 0B/0IG</BADI 0B/0IG</ITE0/BADI. 9ow* you ha&e to !o to transaction SE18 and e3plore each of the BADIs to find out the suitable one. In fact* the suitable one will ha&e a method in it for which importCe3port parameters should ha&e some reference to documentCpostin! dates. <n in&esti!ation* you will find that in BADI , 0B/0IG</ITE0/BADI* there is a method , ITE0/0<DID- which uses , is/!ohead as import parameter. This has the structure G<@EAD which contains the fields for document and postin! date as columns. 9ow* you will implement this BADI. Go to transaction SE1' and create an implementation for the BADI. In the code for the method* write the followin!,4 method ID/E?/0B/0IG</ITE0/BADIEITE0/0<DID- . DATA , 2/I9I5$6 T-#E %. ID is/!ohead4bldat ne is/!ohead4budat. messa!e i)'85FF6 with GBoth postin! and document dates should be sameG. E9DID. 2/I9I A IS/G<@EAD4D1B91HF5$6. T1A9S2ATE 2/I9I T< .##E1 %ASE. ID 2/I9I 9E G9#G. 0ESSAGE I)'85FF6 (IT@ GBill of 2adin! should start with 9#G. E9DID. endmethod. Then* sa&e and acti&ate it. Then* perform a transaction &ia 0IG<. -our reIuirement will be fulfilled. www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e ' of $1 1." Menu #nhancements 1.".1 Demand $ .ser will choose a material in the selection screen. All the records for that material in different plants and stora!e locs will be shown in a report. .ser will select a line from the list and choose option from the menupath to mi!rate to transaction 0BF) to see the details of that document number. BADI with function codes will be used to pro&ide the menu option. The underlyin! method will accept the document number as an input and the method will call transaction 0BF) for that document number. 1.".2 Steps to %e follo&ed 1.".2.1 Step 1 $ 'reate the main program in S#3( %reate a report pro!ram from SE)8. %reate a pf4ststus for includin! menu painter. Double clic on the G.I status to create and acti&ate it. %lic -es to create the G.I status . www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e 1F of $1 Enter a description for the G.I status and press Enter. The screen shown abo&e will appear. Sa&e* acti&ate and come out. -ou will be na&i!ated to SE)8 editor for the pro!ram. Sa&e and acti&ate it. %ome out. 1.".2.2 Step 2 $- 'reate BADI Definition from S#1( Go to transaction SE18. Enter the name of the BADI to be defined and press %reate pushbutton. www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e 11 of $1 Enter the description. %hec4off the checbo3 for 0ultiple use BADI. The tabstrips for function code5Dcodes6 will appear. %lic on that to !o to appropriate tab4pa!e. Enter the name of the pro!ram. Enter the name of the function code*startin! with :H; which will be used later in pro!ram for BADI. Enter description . Then* double clic on the pro!ram name. %lic )es. www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e 1$ of $1 Sa&e the BADI definition. enter two lines for two function codes,4 one for e3itin! out of the pro!ram*another for the details on document number.#ress Enter. The screen shown abo&e will appear. Double clic on the line for HJD<%. www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e 1) of $1 Enter the details for function code HJD<%. Then * double clic on the line for function code , E?IT. %omplete entry for that too. Then* sa&e and acti&ate the menu painter.%ome out. www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e 1+ of $1 -ou will na&i!ate to the transaction SE18. %lic on the tab pa!e , Interface. An interface name is proposed by the system. Double4clic on that. Enter the name of the method which will be acti&ated when the function code related to BADI will be acti&ated. Then* clic on the pushbutton , #arameters. Enter the details for importCe3port parameters of the method. Then* chec and acti&ate the BADI definition. 1.".2.3 Step 3 $-Implement the BADI from transaction S#1* www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e 17 of $1 Go to transaction SE1' and create an implementation for the BADI you ha&e defined. Enter the name of the BADI definition. Enter the description for the BADI implementation. Then* in the table control* fill in the details for function code HJD<%. Then* !o to tab pa!e for, Interfaces. Then* chec and acti&ate the BADI implementation. www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e 1= of $1 Double clic on the method name to write code for it. (rite the code. %hec and acti&ate it. %ome out.<nce a!ain* chec and acti&ate the implementation and come out of SE1'. 1.".2." Step "$- lace the function codes properl+ in the menu painter Edit the report pro!ram. Double clic on the G.I status. www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e 1> of $1 0aintain the two function codes at appropriate place. %hec* acti&ate and come out to SE)8 editor. www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e 18 of $1 1.".2., Step ,$- 'omplete the program details *&---------------------------------------------------------------------* *& Report YSUBBADIFC0001 * *& * *&---------------------------------------------------------------------* REPORT YSUBBADIFC0001 . * Create a GUI status for te pro!ra" SET PF-STATUS #YSUBBADIFC0001#. * $OAD T%E DEFI&ITIO& OF T%E G$OBA$ C$ASS C$ASS C$'E(IT%A&D$ER DEFI&ITIO& $OAD. * De)*are a+ ,+terfa)e refere+)e -ar,a.*e for te ,+terfa)e use/ ,+ te * BADI /ata 0 *'.a/, t1pe ref to YIF'E('SUBBADIFC0001'D. /ata 0 2'".*+r *,3e "se!-".*+r. * De)*are t1pes TYPES 0 BEGI& OF TYP'DOC 4 5B$&R $I6E 5SEG-5B$&R 4 7Do)u"e+t +u".er 58A%R $I6E 5SEG-58A%R 4 7F,s)a* 1ear .2art $I6E 5SEG-B9ART 4 75o-e"e+t t1pe 9ER6S $I6E 5SEG-9ER6S 4 7P*a+t $GORT $I6E 5SEG-$GORT 4 7Stora!e *o)at,o+ S%6:G $I6E 5SEG-S%6:G 4 7Dr;Cr I+/,)ator C%ARG $I6E 5SEG-C%ARG 4 7Bat) 5E&GE $I6E 5SEG-5E&GE 4 7<t1 E&D OF TYP'DOC. DATA 0 I'DOC TYPE STA&DARD TAB$E OF TYP'DOC 9IT% %EADER $I&E. PARA5ETERS 0 P'5AT&R $I6E 5SEG-5AT&R OB$IGATORY. START-OF-SE$ECTIO&. SE$ECT ".*+r 7Do)u"e+t +o "=ar 7F,s)a* 1r. .2art 75o-e"e+t t1pe 2er3s 7P*a+t *!ort 7Stora!e $o) s3>! 7Dr;Cr ,+/,)ator )ar! 7Bat) "e+!e 7<ua+t,t1 fro" "se! I&TO TAB$E ,'/o) 2ere "at+r ? p'"at+r. E&D-OF-SE$ECTIO&. IF &OT ,'/o)@A IS I&ITIA$. *oop at ,'/o). 2r,te0;B ,'/o)-".*+r r,!t-=ust,Ce/4 D0 ,'/o)-"=ar r,!t-=ust,Ce/4 DE ,'/o)-.2art r,!t-=ust,Ce/4 FE ,'/o)-2er3s r,!t-=ust,Ce/4 GH ,'/o)-*!ort r,!t-=ust,Ce/4 BF ,'/o)-s3>! r,!t-=ust,Ce/4 BI ,'/o)-)ar! r,!t-=ust,Ce/4 www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e 1' of $1 HH ,'/o)-"e+!e *eft-=ust,Ce/. e+/*oop. e+/,f. TOP-OF-PAGE . 9RITE0;B #Do)&o# 4 D0 #F,s.Yr# 4 DI #5-t.T1p# 4 FI #P*a+t# 4 GB #St$o)# 4 BD #Dr;Cr# 4 BI #Bat)# 4 HB #<t1# . 2r,te0;B s1-u*,+eJK0L. AT USER-CO55A&D. CASE SY-UCO55. 9%E& #E(IT#. $EAME PROGRA5. 9%E& #N:DOC#. * Re!,ster for te BADI CA$$ 5ET%OD C$'E(IT%A&D$ER?OGET'I&STA&CE E(PORTI&G eP,t'+a"e ? #YSUBBADIFC0001'D# +u**',+sta+)e'a))epte/ ? #(# C%A&GI&G ,+sta+)e ? *'.a/,. IF &OT *'.a/, IS I&ITIA$. * Rea/ te /o)u"e+t +o for te )urre+t *,+e a+/ pass ,t to te "eto/ READ CURRE&T $I&E FIE$D MA$UE I'DOC-5B$&R I&TO 9'5B$&R. CA$$ 5ET%OD $'BADI-OS%O9'DETAI$S E(PORTI&G DOC&R ? 9'5B$&R. e+/,f. e+/)ase. 1.".3 Mode of #-ecution E3ecute the pro!ram with a material code. www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e $F of $1 The output shown abo&e will appear. Select a document number and press the pushbutton in the application toolbar. It will tae you to transaction 0BF) for that document number5 as per the method behin! the function code implemented by BADI6. #ress Enter to see the details. www.hi!hnooncorp.com staffin!"hi!hnooncorp.com #a!e $1 of $1