SAP BUILT IN FUNCTIONS HIDING



Get Example source ABAP code based on a different SAP table
  



Built-In Functions, Hiding by Methods
Within a class, a built-in function is always hidden by methods of the class if they have the same name, regardless of the number and type of its arguments. The function is also hidden regardless of the number and type of method parameters. This especially takes place in method calls for which no selector => or -> is specified in front of the method name:
A static method hides a built-in function with the same name in all methods of the associated class.
An instance method hides a built-in function with the same name in the instance methods of the associated class.
The function is hidden regardless of the operand position. More specifically, any built-in functions called as arguments of other functions are also hidden.



Latest notes:

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

ABAP_EXAMPLE_VX5
The following class returns a syntax error. The specification of strlen on the right side of the assignment addresses 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 a return value. 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.
ABAP_EXAMPLE_END