Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Built-In Types, Data Objects, Functions, and Constructors →  Built-In Functions 

Built-In Functions - Obscured by Methods

Within a class, a built-in function is always obscured by methods of the class if they have the same name, regardless of the number and type of arguments in the function. The function is also obscured regardless of the number and type of method parameters. This also takes place in method calls for which no selector => or -> is specified in front of the method name:

  • A static method obscures a built-in function with the same name in all methods of the associated class.
  • An instance method obscures a built-in function with the same name in the instance methods of the associated class.

The function is obscured regardless of the operand position. More specifically, any built-in functions called as arguments of other functions are also obscured.

Other versions: 7.31 | 7.40 | 7.54


Note

Methods should never be given the same name as a built-in function.


Example

The following class returns a syntax error. The strlen specified on the right side of the assignment indicates the method of the class and not the built-in function. It cannot be specified in this operand position since it is not a functional method with return code.

CLASS demo DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS main.
    CLASS-METHODS strlen IMPORTING text TYPE string
                         EXPORTING len  TYPE i.
ENDCLASS.

CLASS demo IMPLEMENTATION.
  METHOD main.
    DATA(len) = strlen( `xxx` ).
  ENDMETHOD.
  METHOD strlen.
    ...
  ENDMETHOD.
ENDCLASS.