Professional Documents
Culture Documents
Suri - BADI Meterial
Suri - BADI Meterial
1.BADI
2. Difference between Customer exit and BADI
3. Different ways of finding BADI
4. Types of BADI – 1.Standard BADI
2. Custom BADI
3. Filter BADI
5. BADI Sequencing
6. BADI with Fallback Class
BADI:
Business Addins
It is based on object oriented programming
In Userexits (Customerexits) the same exit cannot be reuse in other projects
In BADIs the same BADI definition can be implemented in N number of
implementations
BADI concept is purely designed based on object oriented programming
For implementing BADI, SAP will provide you an interactive & respective
implementation class
Here interface is a collection of methods where you have to implement the
additional code
Advantages of BAdi’s:
Note:
T codes for working with BADIs are
SE18 -------- for BADI definition
SE19 -------- for BADI implementation
1st Method:
Go to SE24
Object Type: CL_EXITHANDLER
Display
Double click on method GET_INSTANCE
Place cursor at call method CL_EXITHANDLER
Go to GET_INSITANCE method
GET_CLASS_NAME_BY_INTERFACE
Select Dynamic Break Point, stop
2nd Method:
Types of BADI:
1. Standard BADI
2. Custom BADI
3. Filter BADI
***Standard BADI:
Object-1:
In XK02 (Vendor) BADI : VENDOR_ADD_DATA METHOD :
CHECK_ALL_DATA
BUSINESS REQUIREMENT
VENDER_FIELDSTATUS
GOS_SRV_SELECT
ADDRESS_CHECK
ADDR_TXJCD_CHECK
CVI_CALL_BTE
ADDRESS_UPDATE
VENDER_ADD_DATA
Go to se18
Give the BADI NAME
And check all the methods
Find the suitable/roughly decide BADI name and method by reading the
description and checking the signature.
Then create implementation
METHOD IF_EX_VENDER_ADD_DATA~CHECK_ALL_DATA.
IF I_LFA1-LAND1= ‘DE’ AND I_LFA1-REGIO =’ ‘.
Message ‘Region is required for GERMON VENDORS’ TYPE ‘E’.
ENDIF.
ENDMETHOD.
Steps:
1. In SE18 - Create Custom BADI.
2. In SE19 - Create implementations for your BADI
Filter BADI:
It is a part of Custom BADI
In Filter BADI, the same definition can be called in different
implementations
It is type of BADI which has a filter value so that only those implementations
which satisfy the filter value are executed. The remaining implementations
are not executed this type of BADI is called a filter BADI.
It is type of badi which has a filter value so that only those implementations
which satisfy the filter value are executed.
The remaining implementations are not executed this type of badi is called a
filter badi.
Object:
Solution:
Go to SE18
Utilities --- Create Classic BADI
Definition Name: ZBADI_CUST_FILTER
Enter
Note:
Based on your definition name system will create an interface
ZIF_EX_BADI_CUST_FILTER
Activate
During activation you will find a message, Enter
Once your interface is activated system will add additional parameter
FLT_VAL based on your filter type VKORG
Back
Activate
Implementation :
Go to SE19
Classic BADI
BADI Name: ZBADI_CUST_FILTER
Create Impl
Enter
Implementation Name: ZBADI_FIL1
Enter
Save
Interface tab
Double click on GET_TAX
Place cursor between METHOD………..ENDMETHOD
IF FLT_VAL = ‘1000’.
TAX = 10.
ENDIF.
Activate
Back
Activate
Back
Classic BADI
BADI Name: ZBADI_CUST_FILTER
Create Impl
Enter
Sales org
1020
Save
Interface tab
Double click on GET_TAX
Place cursor between METHOD………..ENDMETHOD
IF FLT_VAL = ‘1020’.
TAX = 20.
ENDIF.
Activate
Back
Activate
Back
Classic BADI
BADI Name: ZBADI_CUST_FILTER
Create Impl
Enter
Implementation Name: ZBADI_FIL3
Enter
Short Text: implementation for filter badi
Scroll down to bottom
Select ‘+’ Insert Row
Sales org
1030
Save
Interface tab
Double click on GET_TAX
Place cursor between METHOD………..ENDMETHOD
IF FLT_VAL = ‘1030’.
TAX = 30.
ENDIF.
Activate
Back
Activate
Driver Program :
Go to SE38
Program: ZCAL_CUSTOM_FILTER_BADI
Create
Short Description
Type: Executable Program
Save
Final Code:
IF SY-SUBRC NE 0.
MESSAGE ‘Error in calling BADI’ TYPE ‘E’.
ELSE.
CALL METHOD obj->get_tax
EXPORTING
FLT_VAL = V_VKORG
CHANGING
TAX = V_TAX.
ENDIF.
ENDIF.
Output:
Scenario: For a BADI definition if some BADI Implementations are exist then all
the active BADI implementations are called during run time. If all the BADI
implementations are inactive or does not exist then if there is any fallback class
exist then it is called during runtime. The FALLBACK class is a default
implementation of BADI definition which is called if all the BADI
implementations are inactive or none of the BADI implementation exists.
Step1. Go to TCODE-SE20. Create a Enhancement Spot
Step2. Provide a Enhancement spot name and click on the Create button.
Step6. Provide the BADI definition name and the description and at last click on
the Continue button.
Step7. Some of the BADI definition properties are Multiple use.
Step8. Expand the BADI definition, click on the Interface element from the left
hand side. Then provide the Interface name 'ZIF_SHOW_MESSAGE' in the right
hand side and then double click on it. A popup will appear stating to create the
same . Click on YES button to create it.
Step9. Now provide a method description and activate it and go back.
Step11. Create a BADI Implementation. Expand the BADI definition in the L:H:S.
Select the Implementation and click on the highlighted button to create the
implementation.
Step12. Now provide a Enhancement implementation name and description and
click on the continue button.
Step13. Now provide the BADI Implementation name, description and the
implementing class name and click on the continue button.
Step14. Now expand the BADI implementation form the L:H:S and click on the
Implementing class to implement the method.
Step15. Now double click on the Method Name to implement it.
Step17. Provide some in the method and activate it. At last click on the BACK
button .
Step18. Now one BADI implementation is created for the BADI definition.
Step27. Select the check box and provide a fall back Class name and double click
on it. From the popup click YES to continue.
Step28. Now double click on the method to implement it.
Step29. Provide some statement and activate it. At last click on BACK button.
BADI Sequencing:
The sequence for execution of BAdI implementations can be controlled for BAdIs
used on a multiple basis by a sort mechanism.
Special Sort : if sorting is to take place using non-numeric sort values. In this case,
you need to enter the name of the implementation.
Step2: Provide short description. Make sure it is multiple use check box is enable
Step3: Goto Interface tab. Double click on ZIF_EX_BADI_SEQENCE. Create
method as follows.
BADI : ZBADI_SEQENCE.
Activate Method.
Activate.
Activate.
Step 23: Back.
Go to – SE38