SAP CLASS - Reference ABAP Statements

Get Example source ABAP code based on a different SAP table
  


Standard SAP Help for CLASS

CLASS

ABAP Reference
ABAP Code Snippet


ABAP Syntax


Declaration part

CLASS class DEFINITION [INHERITING FROM superclass]
[ABSTRACT]
[FINAL]
[CREATE {PUBLIC|PROTECTED|PRIVATE}]
[SHARED MEMORY ENABLED]
[FOR TESTING
[RISK LEVEL {CRITICAL|DANGEROUS|HARMLESS}]
[DURATION {SHORT|MEDIUM|LONG}] ]
[[GLOBAL] FRIENDS [class1 class2 ...]
[intf1 intf2 ...] ].
[PUBLIC SECTION.
[components]]
[PROTECTED SECTION.
[components]]
[PRIVATE SECTION.
[components]]
ENDCLASS.


Implementation part

CLASS class IMPLEMENTATION.
implementations
ENDCLASS.
ABAP Code Snippet

What does it do? Declaration and implementation of a class class. In the declaration part, the components components of a class are declared in the visibility sections PUBLIC, PROTECTED , and PRIVATE SECTION, using ALIASES, [CLASS-]DATA, [CLASS-]METHODS, and [CLASS-]EVENTS. In the implementation part, all the concrete methods declared in the declaration part between METHOD and ENDMETHOD are implemented.

ABAP Addition INHERITING FROM superclass
Defines class as a subclass of superclass.
ABSTRACT
Defines class as an abstract class, which cannot be instantiated.
FINAL
Defines class as a final class, from which you cannot derive subclasses.
CREATE {PUBLIC|PROTECTED|PRIVATE}
Specifies whether the class class can be instantiated as public, protected , or in its package as private.
SHARED MEMORY ENABLED
Specifies that instances of the class can be stored in shared memory.
FOR TESTING
Defines a test class for ABAP Unit. The additions determine the test properties.
[GLOBAL] FRIENDS [class1 class2 ...] [intf1 intf2 ...]
Describes other classes class1 class2 ... or interfaces intf1 intf2 ... as friends, which are permitted to access all components of class.

Return to menu