In this lesson you will learn how to create ABAP structures and nested structures in the dictionary.
A structure (structured type) comprises components (fields). Types are defined for the components A component can refer to an elementary type (via a data element or by directly specifying the data type and length in the structure definition), another structure or a table type. A structure can therefore be nested to any depth.
This lesson gives you an overview of ABAP structures, what they are and what they are used for.
We will continue with the definition of structured data objects (structure variables). Also, this chapter will teach you how to use basic ABAP statements for structured data objects.
In ABAP, you can define structured data objects (called structure variables or simply structures).
This allows you to combine values that belong together logically into one data object.
Structures can be nested.
This means that components can be made up of more structures or even internal tables.
In the program, structure variables are defined with the DATA statement, in the same way as elementary data objects.
Data objects are always defined with the DATA key word.
You can use an ABAP standard type, a local type, or a global type to type a data object.
You can refer to an already defined data object when defining additional variables (LIKE addition).
If the type information is missing in a variable definition, the standard type C is assumed.
In contrast, if the length is missing, then the appropriate default length for the (incomplete) standard type is used.
The "DATA myvar." statement without type or length information thus defines a character variable with a length of 1 as the default length of type C is one.
Literals and constants belong to the fixed data objects.
You can use literals to specify fixed values in your programs.
There are numericliterals (specified without quotation marks) and text literals (specified with quotation marks).
You define constants using the CONSTANTS statement.
You can use the MOVE statement to transfer the contents of a data object to another data object.
The following two syntax variants have the same effect:
MOVE var1 TO var2.
var2 = var1.
If both data objects var1 and var2 are of different types, then there is a typeconflict.
In this case, a type conversion is carried out automatically, if a conversion rule exists.
For detailed information on copying and the conversion rules, refer to the keyword documentation for the MOVE statement.
The CLEAR statement resets the contents of a data object to the type-specific initial value.
Video Lesson 4.1: Working With Elementary Data Objects
Lesson Overview
In this lesson you will become familiar with the difference between data types and data objects and you will learn how to define and use these in a program. You will also learn some basic ABAP statements.
You will be working with structures and internal tables, as well as program flow control and logical expressions.
Data Types and Data Objects
A formal variable description is called data type. In contrast, a variable concretely defined by means of a data type is called data object.
Let's have a look at the ABAP standard types predefined by SAP (implemented types) first.
These are divided into two groups:
Complete and
incomplete types.
The following implemented ABAP standard types are complete.
This means that they already contain the type-related, fixed length information:
Complete ABAP standard types
D
Type for date(D), format: YYYYMMDD, length 8 (fixed)
T
Type for time (Time), Format: HHMMSS, length 6 (fixed)
I
Type for integer (I), length 4 (fixed)
F
Type for floating point number (F), length 8 (fixed)
STRING
Type for dynamic length character string
XSTRING
Type for dynamic length byte sequence (HeXadecimal string)
The following standard types do not contain a fixed length (incomplete). With these, the length of the variable has to be specified for data object definitions.
C
Type for character string (Character) for which the fixed length is to be specified
N
Type for numerical character string (Numerical character) for which the fixed length is to be specified
X
Type for byte sequence (HeXadecimal string) for which the fixed length is to be specified
P
Type for packed number (Packed number) for which the fixed length is to be specified. (In the definition of a packed number, the number of decimal points may also be specified.)
For more information on predefined ABAP types, refer to the keyword documentation on the TYPES or DATA statement.
You should now be able to model your data and create transparent tables in the ABAP dictionary to add, edit and delete data. This lesson is an example of an Airline Data Model and how it was created in SAP.
Your assignment is to:
Create a relational data model for an airline company that needs to store data from the passengers such as Name, ID, Address and Flight ; data from the flights such as ID, Origin and Destination; and data from the airline company such as ID, Airline Name and Flight numbers assigned to it.
Create transparent tables in the ABAP Dictionary to represent your relational model.
In this lesson you will learn how to view all the data stored in a database table.
In this lesson you will learn how to create transparent tables to model your data.
In the ABAP Dictionary, a transparent table is an implemented description of the corresponding database table that contains the actual application data.
The fields of the transparent table form the identically-named columns of the corresponding database table.
Usually, a structure in the ABAP Dictionary is used to centrally describe structure variables that are to contain the fields of various tables.
You can then use these dictionary structures in the ABAP program to define data objects (concrete structure variables) that either serve as temporary data storage in the program or as an interface for the field transport between the screen and ABAP program.
With structures however, we refer to component and component type as opposed to field and data element, it is posible to have a structure as the component of another structure.
You will learn how to create a maintenance generator for your custom tables. The maintenance generator is used to add, edit and delete table entries.
Table Maintenance Generator is a tool used to customize the tables created by end users and can be changed as required, such as making an entry to that table, deleting an entry etc.
In other words, table maintenance generator is a user interface tool which is used to change the entry of the table or delete an entry from the table or create an entry for the table.
In this lesson you will learn how to create transparent tables to model your data.
In the ABAP Dictionary, a transparent table is an implemented description of the corresponding database table that contains the actual application data.
The fields of the transparent table form the identically-named columns of the corresponding database table.
Usually, a structure in the ABAP Dictionary is used to centrally describe structure variables that are to contain the fields of various tables.
You can then use these dictionary structures in the ABAP program to define data objects (concrete structure variables) that either serve as temporary data storage in the program or as an interface for the field transport between the screen and ABAP program.
With structures however, we refer to component and component type as opposed to field and data element, it is posible to have a structure as the component of another structure.