CALL BADI

Get Example source ABAP code based on a different SAP table
  


Standard SAP Help for CALL

CALL BADI


Short Reference

• CALL BADI ABAP Statement

ABAP_BASIC_FORM_10 CALL BADI { badi->meth parameter_list }
| { badi->(meth_name) { parameter_list
| parameter_tables} }.


What does it do?Calls a BAdI method. The statement has a static and a dynamic variant. In both variants a BAdI reference variable must be specified for badi. In the static variant, a BAdI reference variable of the static type of a concrete BAdI class must be specified for badi , and for meth a BAdI method of the corresponding BAdI must be entered directly.
In the dynamic variant, a BAdI reference variable of the static type of the abstract super class CL_BADI_BASE must be specified for badi. For meth_name , a character-like data object must be specified that must contain the name of a BAdI method in uppercase when the statement is executed.

With regards to the addressing of BAdI methods, the BAdI reference variable behaves like an interface reference variable with the static type of the affected BAdI interface. A BAdI method declared as a component of the corresponding BAdI interface is addressed directly using its name. BAdI methods declared in component interfaces of the BAdI interface can be addressed using the interface component selector or any alias names.

The additions parameter_list or parameter_tables assign actual parameter to the formal parameters of the BAdI method or handle non-class-based exceptions exactly as described in Method Call. The exceptions that can occur in dynamic accesses are also the same as those of CALL METHOD.

The effect of the statement CALL BADI is that the specified method is called in all object plug-ins to which the BAdI object referenced by the badi refers. If the BAdI is defined for single use, then badi must contain a valid BAdI reference for a static BAdI call. If badi is initial, a handleable exception is raised.
If the BAdI is defined for multiple use, then badi must contain a valid BAdI reference or can be initial for a static BAdI call. If the referenced BAdI object refers to multiple object plug-ins ,then the call order is the same for every CALL BADI statement. The exact call order can be determined in the definition of the corresponding BAdI implementations, if the predefined BAdI BADI_SORTER of the enhancement spot of the same name was implemented for the current BAdI. If the referenced BAdI object does not reference object plug-ins, or the badi is initial, then the statement has no effect.
In a dynamic BAdI call, a handleable exception is always raised if there is an invalid BAdI reference in badi.

If a method is added to a BAdI afterwards, it can be missing in a BAdI implementation. In this case the call is executed as if the method existed with an empty implementation. Actual parameters that are bound to EXPORTING or RETURNING parameters passed by value are initialized. All other actual parameters remain unchanged.

System Fields With a regular method call, the system field sy-subrc is either set to 0 or, when handling non-class-based exceptions, it is set to the value specified after EXCEPTIONS.


Latest notes:BAdI objects and BAdI references can only be generated using the statement GET BADI.
In the terminology of the enhancement concept, the statement CALL BADI is known as an enhancement spot element invocation.
The call of a BAdI method of a BAdI defined for single use behaves as a method call with meth( ...): the called method must exist. In contrast, the call of a BAdI method defined for multiple use rather corresponds to the triggering of an event with RAISE EVENT: One or more methods can exist, or no methods at all.




Runtime Exceptions

Catchable Exceptions
CX_BADI_INITIAL_REFERENCE
Reason for error:
The reference variable badi is initial either for the static call, although the BAdI was defined for single use, or for the dynamic call.

CX_SY_DYN_CALL_ILLEGAL_METHOD
Reason for error:
Method does not exist at the dynamic call
Runtime error:
DYN_CALL_METH_NOT_FOUND

Return to menu