ABAPDATA_READ_ONLY_INCLUDE - DATA READ ONLY INCLUDE

BAL Application Log Documentation   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.

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


BAL Application Log Documentation   BAL Application Log Documentation  
This documentation is copyright by SAP AG.


Length: 1588 Date: 20120522 Time: 044424     triton ( 58 ms )