Entering content frame

Definition and Visibility of Data Types Locate the document in its SAP Library structure

The following graphic shows where you can define data types in ABAP:

This graphic is explained in the accompanying text

This differentiates between

·        Predefined ABAP types that are built into the kernel.

·        Local data types that you can define in ABAP programs.

·        Data types in the Repository that are available to Repository objects in all programs.

Visibility of Data Types

·        The predefined ABAP types (c, d, f, i, n, p, t, x) are always visible. You cannot declare types with the same names as these data types, either in the program or in the ABAP Dictionary.

·        When we talk about the visibility of local data types in the program, we must differentiate between local data types in procedures and global data types. Data types defined in a procedure obscure other objects with the same name that are declared in the global declarations of the program. All local data types in a program obscure data types with the same names in the ABAP Dictionary. This also applies to data types from type groups.

·        In the ABAP Dictionary, different visibility rules apply to standalone data types and the data types stored in type groups. Data types in type groups obscure standalone data types with the same names. However, this should be an exceptional situation. All data types in the ABAP Dictionary should be in the same namespace. When you create a standalone data type, the system displays a warning if the name begins with the name of a type group followed by an underscore. Equally, you cannot create a type group if there is already a standalone data type with the same name followed by an underscore.

The graphic shows the visibility of local and ABAP Dictionary data types:

This graphic is explained in the accompanying text

The system searches from the inside out. If you specify TYPE1 in a TYPE addition in the program, the system uses the ABAP Dictionary type both in the procedure and the main program.  If you specify TYPE2 in the procedure, the system uses the local type from the procedure. However, if you specify TYP2 in the main program, the system uses the type from the main program. TYPE2 from the ABAP Dictionary is obscured. If you specify TYPE3 either in the procedure or the main program, the system uses the type from the main program TYPE3 from the ABAP Dictionary is obscured.

 

 

Leaving content frame