PROTECTED

Basic form

PROTECTED SECTION.



Effect

You can only use this statement in the declaration part of a class in ABAP Objects. It opens the protected section of the class definition, which concludes either with the beginning of the next section (PRIVATE SECTION statement), or at the ENDCLASS statement.

The protected section is one of the visibility sections of a class, which determines the external visibility of the class components.

A class definition need not contain a protected section. However, if it does, the protected section must come between the public and private sections.

All of the components in the protected section can access the components from the public section. In turn, they can be accessed by the components of the private section.

Example

CLASS C1 DEFINITION.
  PUBLIC SECTION.
   DATA A1.
    ...
  PROTECTED SECTION.
    DATA A2 LIKE A1.
    ...
  PRIVATE SECTION.
    DATA A3 LIKE A2.
    ...
ENDCLASS.

Related

CLASS

PUBLIC SECTION

PROTECTED SECTION

PRIVATE SECTION

ENDCLASS

CLASS-DATA

CLASS-METHODS

CLASS-EVENTS

METHODS

EVENTS

INTERFACES

ALIASES

METHOD

ENDMETHOD

INTERFACE

ENDINTERFACE

CREATE OBJECT

CALL METHOD

RAISE EVENT

SET HANDLER

Special variants of other keywords

Additional help

Classes