!--a11y-->
BAdI: Customer-Defined Functions in the Formula Builder 
Use
You can integrate self-defined functions in the transformation library of the formula builder. In doing so, you can also make special functions available for frequent use that are not contained in the transformation library. The Business Add-In RSAR_CONNECTOR is available for this. For more information about using Business Add-Ins (BAdIs), read the detailed documentation for
Business Add-Ins.Procedure
Implementing the BAdI
Implementing a Business Add-In. In the following, the specific special features for the implementation of the BAdI RSAR_CONNECTOR are described.
|
Coding Lines |
Description |
|
method IF_EX_RSAR_CONNECTOR~GET . |
|
|
data: l_function type SFBEOPRND. |
Structure with the description of the function |
|
case i_key. |
Importing parameter: Key with the function category |
|
when 'CUSTOM'. |
The BAdI implementation is always accessed with the ‘CUSTOM’ key. |
|
* Beschreibung der Funktion C_TECH_NAME1 |
|
|
clear l_function. |
|
|
l_function-tech_name = 'C_TECH_NAME1'. |
Appears later in the Technical Name column and must be unique. |
|
l_function-descriptn = 'Beschreibung 1'. |
Appears later in the Description column. |
|
l_function-class = 'CL_CUSTOM_FUNCTIONS'. |
Name of the class in which the function is implemented. |
|
l_function-method = 'CUSTOMER_FUNCTION1'. |
Name of the method in which the function is implemented. |
|
APPEND l_function TO c_operands. |
Changing parameter: Table with descriptions of the function |
|
* ... weitere Beschreibungen |
|
|
endcase. |
|
|
endmethod. |

A function does not have a type. For this reason, the TYPE field of structure
SFBEOPRND must not be filled.Naming conventions
The technical name of a self-defined function;
Implementing the methods
The ABAP methods specified in the function description under class and method, are later called up later in formula evaluation and maintenance. For this reason, the customer-defined functions need to be implemented as methods in an additional class, alongside BAdI implementation. These methods must have the following properties:
ABAP coding can be used to help implement the function in the methods.

The system does not check whether the class or method specified in BAdI implementation actually exists. If a class or method does not exist, a runtime error occurs when using the function in the formula builder.
Result
The functions you have defined are available in the Customer-Defined Functions selections in the transformation library.
