ABAP Keyword Documentation → ABAP − Reference → Declarations → Declaration Statements → Classes and Interfaces → Components in Classes and Interfaces → Methods → CLASS-METHODS
CLASS-METHODS - IMPORTING, EXPORTING, CHANGING, RAISING
Other versions: 7.31 | 7.40 | 7.54
Syntax
CLASS-METHODS meth [DEFAULT IGNORE|FAIL]
[IMPORTING
parameters [PREFERRED PARAMETER p]]
[EXPORTING parameters]
[CHANGING parameters]
[{RAISING exc1|RESUMABLE(exc1) exc2|RESUMABLE(exc2) ...}
|{EXCEPTIONS exc1 exc2 ...}].
Effect
This statement declares a general
static method meth
. The additions define make an interface method optional,
define the parameter interface of the method, and specify the exceptions that the method can raise and propagate. The additions have the same syntax and meaning as those for
general instance methods.
Notes
- Static methods cannot be redefined, which means that they cannot be flagged as abstract or final.
-
Static methods are always executed in the class in which they were declared, even if they were called in subclasses or using the names of subclasses.
Example
Declaration of a static method with input/output parameters.
PUBLIC SECTION.
CLASS-METHODS
escape_xml
CHANGING
xml TYPE xstring.
...
ENDCLASS.