PUBLIC

Basic form

PUBLIC SECTION.

Effect

You can only use this statement in the declaration part of a class in ABAP Objects. It opens the public section of the class definition, which ends either when the next section begins ( PROTECTED SECTION or PRIVATE SECTION statements), or at the ENDCLASS statement.

The public 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 public section. However, if it does, the public section must be the first visibility section, before the protected and private sections.

All of the components defined in the public section are visible in the subsequent protected and private sections.

Example

CLASS C1 DEFINITION.
  PUBLIC SECTION.
    DATA A1.
    ...
  PROTECTED SECTION.
    DATA A2 LIKE A1.

    ...
  PRIVATE SECTION.
    DATA A3 LIKE A1.
    ...
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