Show TOC Start of Content Area

Procedure documentation Creating Attributes  Locate the document in its SAP Library structure

Use

Attributes contain data. They define the state of an object (an instance of a class).

Prerequisites

You have already created the internal data types in the class which you want to refer to. For more information, see Creating Internal Types in Classes.

Procedure

...

       1.      Open the class you want to edit.

       2.      Choose the Attributes tab page.

       3.      To create an attribute, make the following entries:

Option

Description

Attribute

Name of the attribute

Level

The declaration type specifies whether the attribute is an instance attribute (DATA), a static attribute (CLASS-DATA), or a constant (CONSTANTS).

Visibility

The visibility sets the visibility section of the class component. The component can be in the PUBLIC SECTION, in the PROTECTED SECTION, in the PACKAGE SECTION or in the PRIVATE SECTION.

For more information, see Visibility Sections in Classes.

Read Only

The flag determines whether an attribute can be changed from outside the object, or if it is read only.

Typing

Determines the type of an attribute or parameter. The possible values are:

      Reference another attribute using LIKE

      Reference a data type using TYPE

      Reference an object type using TYPE REF TO

      Reference a data type using TYPE REF TO DATA

      Embed an object type (not yet available in ABAP objects)

      Other type (in this case, the type is defined by direct input in the protected or private section).

Associated Type

ABAP associated type for an interface parameter. The associated type must be a global type in the ABAP Dictionary or exist in a type pool. In the latter case, the type pool must be declared in the function group.

When assigning a type using the LIKE method, you cannot use types from type pools.

Additionally, you can use the internal ABAP types C, I, N, X, P, D, T, F, and the TABLE type - to an extent in generic form.

Description

Short description of the method.

Initial Value

You must enter an initial value for constants.

Note

If you need the definition of a structured data object here, choose the Direct Type Entry pushbutton and define the structure within the DATA statement:

DATA: BEGIN OF structure,

         ...

      END OF structure.

Perform the syntax check after that.

       4.      Save your entries.

Result

You have created and specified attributes for a class or an interface. The system generates the corresponding ABAP code in the definition part of the class or interface pool for all of the attributes.

 

 

End of Content Area