!--a11y-->
Typical BAdIs 
This example explains the enhancement technique through BAdIs.
Country-specific validity tests are to be executed upon completion of an order in ERP. The interface of this validity test is to be specified using the interface if_check_validity. The current country is available in a field called cntry.
A suitable BAdI enhancement option consists of two parts:
...
1. Depending on the current country, an object (or even several objects) must be supplied that implements the if_check_validity interface.
2. The appropriate methods of this object (or several objects) are called, and the result of this validity test is used again in the ERP coding.
It is very important to ensure that the order processing itself predefines the specification of the if_check_validity interface and its contract. The contract contains rules for the interface of the BAdI. That is, which values may be passed to the methods, which values are expected back, and what the return values mean.
In other systems that are based on ERP, a country-specific implementation can/must be provided in accordance with the contract.
The two parts of an enhancement option described above are implemented using the following ABAP statements:
· GET BADI – for getting objects
· CALL BADI – for calling interface methods
You might have a BAdI definition created in ERP with the name badi_check_validity. This definition can have a method check_validity with an input parameter data that verifies the validity of the order day and the country filter of the BAdIs, which has the name country. In this case, the enhancement option can look as follows:
DATA bd TYPE REF TO badi_check_validity.
GET BADI bd FILTERS country = cntry.
CALL BADI bd->check_validity EXPORTING data = ...
The code fragment shows that the BAdI is addressed in an ABAP program through a reference variable of the type REF TO badi_check_validity. An object that points to such a reference variable is called BAdI Handle. BAdI names are therefore in the same namespace as all global objects and data types.
The statement GET BADI searches in the Repository for all currently activated implementations of the BAdIs and chooses those that are defined for the filter value in cntry. These are instantiated and are referenced by the BAdI handle created in the statement. In the following statement CALL BADI, the method call is automatically passed to the actual BAdI implementation instances referenced by the BAdI handle.