Test Methods> (Only in Test Classes) 7 METHODS meth $[ABSTRACT$|FINAL >$]> $[AMDP OPTIONS $[READ-ONLY$] $[CDS SESSION CLIENT clnt$|CURRENT$]>$]> FOR TESTING> $[${RAISING exc1$|RESUMABLE(exc1) exc2$|RESUMABLE(exc2) ...$}$]. >
ABP Handler Methods> (Only in HandlerClasses of ABAP Behavior Pools) 8 METHODS meth $[FINAL>$]> FOR rap_behv ...>
What does it do? The statement METHODS> declares or redefines an instance method meth>. The naming conventions> apply to the name meth>. Instance methods are bound to objects. To use instance methods, an object of the class must first be created. In instance methods, all components of the same class can be accessed without a component selector. The variants of the statement METHODS> are used to distinguish between the following kinds of method declarations: General instance methods> The most general form of the METHODS> statement allows instance methods to be defined with any input and output parameters.
Functional instance methods> Functional methods> have exactly one return value and any number of formal parameters.
Instance constructors> Instance constructors are methods with the given name constructor> , which are called automatically when their class is instantiated. Constructors have any number of input parameters and no output parameters. They cannot be declared in interfaces.
Event handlers> Event handlers are methods that can be called directly using or in statements>, but are mainly called when an event of a class or an interface is raised. The only possible formal parameters of an event handler are input parameters defined as the output parameters of the event.
Redefinition of Instance Methods> A method declared in a superclass can be redefined in a subclass as long as it is not flagged as final in the superclass. In a redefinition>, the interface of the method is not changed.
AMDP Methods> In general, the same rules apply to declaring AMDP methods> as to all instance methods. There is, however, one special optional addition, AMDP OPTIONS>>, and no non-class-based exceptions can be declared using EXCEPTIONS>.
Definition of a test method> Test methods can be declared in test classes. They have no interface parameters and are called during ABAP Unit> tests by the ABAP runtime framework. They cannot be declared in interfaces.
ABP Handler Methods> ABP methods can be declared in the handler classes> of an ABAP behavior pool>. They implement the CRUD operations of a RAP business object>.
Latest notes: In the methods of a class, one method of the class hides> a built-in function> with the same name. This hiding is independent of the type and number of method parameters and the type and number of arguments on the function. This means that a method should not have the same name as a built-in function. NON_V5_HINTS ABAP_HINT_END