sapdev logo background
sapdev logo sapdev logo
Comments

SAP METHOD CALLS documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

Method Calls
There are two types of method call: static and dynamic. In static method calls, the name of the method must be specified in full in the program. In dynamic method calls, the full name of the method or part of the name is determined at runtime.
When an instance method is called using a reference variable and the static type of the reference variable is a superclass of the dynamic type, the dynamic method call can be used to call all visible methods of the dynamic type. In static method calls, however, only the visible methods of the static type can be called.
Static method calls have the pattern meth( ) . They do not need a keyword; instead, the method is specified directly and the parameters are passed in parentheses. Dynamic method calls are introduced using CALL METHOD .
  • Static method calls

  • Dynamic method call

  • An obsolete syntax variant also exists where static method calls are still introduced using CALL METHOD .

    System Fields
    The system field sy-subrc is set to 0 when a method is called. If a non-class-based exception is raised that was handled by the assignment of a value, then sy-subrc
    is set to this value.
    Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




    METHODS
    METHOD_CALLS_DYNAMIC




    comments powered by Disqus