Ansicht
Dokumentation

ABAPDATA_READ_ONLY_INCLUDE - DATA READ ONLY INCLUDE

ABAPDATA_READ_ONLY_INCLUDE - DATA READ ONLY INCLUDE

CPI1466 during Backup   Vendor Master (General Section)  
This documentation is copyright by SAP AG.
SAP E-Book

Effect

You can only use this addition in the public visibility section (PUBLIC SECTION) of a class declaration (see CLASS) or in an interface definition (see INTERFACE).

The READ-ONLY addition makes a public attribute, declared in a DATA statement, readable from outside the class, but only modifiable by methods of the class or its subclasses.

Example

CLASS C1 DEFINITION.
  PUBLIC SECTION.
    DATA A VALUE 'X' READ-ONLY.
    METHODS M.
ENDCLASS.

DATA O TYPE REF TO C1.
CREATE OBJECT O.

CALL METHOD O->M.
WRITE O->A.

CLASS C1 IMPLEMENTATION.
  METHOD M.
    A = 'Y'.
  ENDMETHOD.
ENDCLASS.

Attribute A of class C1 can only be read from outside the class. To change it, you need a method from the same class.

Additional help

Classes






Addresses (Business Address Services)   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.

Length: 1563 Date: 20240616 Time: 100433     sap01-206 ( 26 ms )