Tutorial by Examples

ABAP Classes can be declared Globally or Locally. A global class can be used by any object within the ABAP repository. By contrast, a local class can only be used within the scope it is declared. CLASS lcl_abap_class DEFINITION. PUBLIC SECTION. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS...
Class implementation: CLASS lcl_abap_class DEFINITION. PUBLIC SECTION. METHODS: constructor, method1. PROTECTED SECTION. PRIVATE SECTION. METHODS: method2, method3. ENDCLASS. CLASS lcl_abap_class IMPLEMENTATION. METHOD constructor. &q...
Class implementation: CLASS lcl_abap_class DEFINITION. PRIVATE SECTION. METHODS method1 IMPORTING iv_string TYPE string CHANGING cv_string TYPE string EXPORTING ev_string TYPE string. ENDCLASS. CLASS lcl_abap_class IMPLEMENTATION. METHOD m...
Class implementation: CLASS lcl_abap_class DEFINITION. PRIVATE SECTION. METHODS method1 RETURNING VALUE(rv_string) TYPE string. ENDCLASS. CLASS lcl_abap_class IMPLEMENTATION. METHOD method1. rv_string = 'returned value'. ENDMETHOD. ENDCLASS. Method call example: ...
Information Inheritance allows you to derive a new class from an existing class. You do this using the INHERITING FROM addition in the CLASS subclass DEFINITION INHERITING FROM superclass. statement. The new class subclass inherits all of the components of the existing class superclass. The n...
Information The ABSTRACT and FINAL additions to the METHODS and CLASS statements allow you to define abstract and final methods or classes. An abstract method is defined in an abstract class and cannot be implemented in that class. Instead, it is implemented in a subclass of the class. Abstra...

Page 1 of 1