ABAP Keyword Documentation → ABAP - Reference → Declarative statemnts → Classes and Interfaces → ABAP Objects - Overview → Examples for ABAP Objects
ABAP Objects, OO Transaction
This example demonstrates the linking of a transaction code with the method of a local class.
Other versions: 7.31 | 7.40 | 7.54
Source Code
<span class="blue">*&---------------------------------------------------------------------*</span>
<span class="blue">*& Subroutine pool DEMO_OO_TRANSACTION *</span>
<span class="blue">*& *</span>
<span class="blue">*&---------------------------------------------------------------------*</span>
PROGRAM demo_oo_transaction.
<span class="blue">*</span>
CLASS demo_class DEFINITION.
PUBLIC SECTION.
METHODS instance_method.
ENDCLASS.
<span class="blue">*</span>
CLASS demo_class IMPLEMENTATION.
METHOD instance_method.
MESSAGE 'Instance method in local class' TYPE 'I'.
ENDMETHOD.
ENDCLASS.
Description
The program DEMO_OO_TRANSACTION is a subroutine pool that does not contain any subroutines. Instead,
the program contains the definition of the local class demo_class
, with which
the transaction code DEMO_OO_METHOD is linked. When the transaction is called, the program is loaded, one instance of the class is created, and the method is called.