Start of Content Area

Procedure documentation BAdI: Customer-Defined Functions in the Formula Builder Locate the document in its SAP Library structure

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

  1. To implement a BAdI, proceed as described here: Structure linkImplementing a Business Add-In. In the following, the specific special features for the implementation of the BAdI RSAR_CONNECTOR are described.
  2. Call up transaction SE19. Enter RSAR_CONNECTOR as the Add-In name for which you want to create the implementation.
  3. By double-clicking on the method (GET), you arrive in the class builder. Here you can enter your coding for the enhancement implementation. The following example shows the structure of such an implementation:
  4. 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.

     

    Note

    A function does not have a type. For this reason, the TYPE field of structure SFBEOPRND must not be filled.

  5. Save and activate your implementation.

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.

Caution

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.

 

 

End of Content Area