BAdI: Customer-Defined Functions in the Formula Editor

If the transformations are performed in the Application Server, you can integrated user-defined functions in the Formula Editor's transformation library. This also allows you to make special functions not contained in the transformation library available for frequent use. You can use the RSAR_CONNECTOR Business Add-In to do this. In this BAdI, you define which class or method your function was implemented in and under which entry the function will be offered in the Formula Builder. The actual implementation of the function takes place in the specified class or method. For detailed information about how to use Business Add-Ins (BAdIs), see Business Add-Ins (BAdIs)..

Procedure

Implementing the BAdI

  1. To implement a BAdI, follow the instructions in the BAdI documentation. The specific things to look out for when implementing BAdI RSAR_CONNECTOR are described below.

  2. Call transaction SE19. Enter RSAR_CONNECTOR as the name for the Add-In that you want to create the implementation for.

  3. By double-clicking the method (GET), you open the class builder. You can enter your coding for implementing the enhancement. You can define which entry your function will be displayed with and which category it will be displayed under in the Formula Editor. You also define the class or method that the function was implemented in. For more information, see Structure of Implementing a Function and Implementing a Category.

  4. Save and activate your implementation.

Naming Conventions

The technical name of a user-defined function:

  • cannot be empty

  • must be consistent

  • must begin with ‘C_’

  • can only contain alphanumeric characters, that is, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_' (small letters, blank spaces and special characters are not allowed)

  • can have a maximum of 61 characters

Implementing the Methods

The ABAP methods specified in the function description under class and method (in the BADI implementation) are called later in maintenance and formula evaluation. You define which processing is performed by the function. The customer-defined functions must therefore also be implemented as methods for BAdI implementation in an additional class. These methods must have the following properties:

  • They are declared static and public.

  • They can only have importing, exporting, and returning parameters. Changing parameters are not permitted.

  • They can only have one exporting or returning parameter.

  • Exporting parameters cannot have a generic type.

In the methods, you can use ABAP code to implement the function.

CALL FUNCTION 'RS_TBBW_CONVERT_TIMESTAMP'

EXPORTING

i_timestamp = i_timestamp

IMPORTING

E_data = e_dat.

************************

ENDMETHOD.

Result

The functions you have defined are available in the transformation library in the Customer-Defined Functions selection.