‎2008 Jun 27 2:41 AM
Hi
Can anyone tell me what is the custom code in badi?..and how i can implement user defined badi?.
If any one have some document regarding badi plz forward to me.
Thanks
sachin
‎2008 Jun 27 3:25 AM
‎2008 Jun 27 3:49 AM
Hi,
step by step to implement and create BADI,
1. Go to transaction 18.
2. Create the Enhancement spot (named as 'ZBC_BADI')
3. Click the button 'Create BADI' in the left side panel.
4. Give the BADI name. (named as 'ZBADI_TEST').
5. Give the Interface name and description, after that it will automatically show the window to create the methods.
6. save and active.
7. use the badi wherever required.
Refer
[http://www.saptechnical.com/Tutorials/ExitsBADIs/MultipleUse/page1.htm|http://www.saptechnical.com/Tutorials/ExitsBADIs/MultipleUse/page1.htm]
Regards,
SB
‎2008 Jun 27 4:10 AM
Hi Sachin,
Se18 tcode where the BADI is defined.
Se19 is the T-code where you implement BADI.
Se24 which is class builder.
In way it gives a beautiful explanation of how to OOPS object.
And when you start implementing BADIs you will come to know more nuances like
Should not be using like need to use type, (referencing)
Usage or range etc.
Refer this link
With screen shots
http://www.sapmaterial.com/badi.html
For standard BAdI, interface and class will be predefined by SAP.
Adapter class performs these tasks
Control ( the class calls all active implementations)
Filtering (If the Add-in has to be executed under certain conditions, the class ensures that only certain implementations are executed)
In BAdI, all the enhancement components are grouped together.
Program Enhancements (interface methods)
Menu Enhancements (function codes in interface definition)
Screen Enhancements
During implementation, the class for implementing the interface is created automatically.
Navigate to Class Builder by double-clicking the method.
Implement the method of the class and activate it.
In the main program, create a reference variable to the BAdI definition (interface).
Find out if any active implementation exists for the definition.
If it exists, perform the implementation by calling the required method implemented in the adapter class.
Implementation for Standard BAdIs
Find the required BAdI for the transaction
Create custom implementation for the BAdI
From the available methods, select the required one
Enter the custom code in the method and activate
Execute the transaction and check if the method with the custom code is being invoked
Finding the BAdI
Go to any transaction (say CV02N) and from the menu, select System ->Status to get the program name.
In the program, search for CL_EXITHANDLER=>GET_INSTANCE with the radio button u201CIn Main Programu201D selected.
Select one program from the list of programs containing calls to BAdIs.
The changing parameter INSTANCE will have the interface assigned to it.
Find out the corresponding BAdI Interface and definition
For eg: if the inteface name is IF_EX_DOCUMENT_MAIN02 is the interface , the BAdI definition name will be DOCUMENT_MAIN02
In the interfaces tab, select by double clicking, the required method to be called to suit the requirement.
Insert your own code in the method selected.
Save the code and activate it.
If it is not activated, previous active version of the method will be called.
Multiple Use BAdIs
Multiple implementations are possible for the same BAdI
There is no sequence control for multiple implementation
since at the time of definition, it doesnu2019t know which implementation will be active.
All active implementations will be triggered by the application program.
To display the list of all implementations of a BAdI definition, go to Implementation -> Display in SE18.
Navigate to the Interface definition in SE24 for defining the methods.
For each of the methods defined, appropriate filter value must be defined as an importing parameter.
The method then selects the active implementation based on the value.
When implementation is done, select from the search help or enter a valid value
Cheers
Mohinder Singh Chauhan