0% found this document useful (0 votes)
141 views

TAW11 Abap TypesAndDataObjects PDF

Uploaded by

manurey6879
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
141 views

TAW11 Abap TypesAndDataObjects PDF

Uploaded by

manurey6879
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 80

Page 1 of 1

About This Module


Part 2 – ABAP Types and Data Objects
In this module we will discuss the data types and data objects in ABAP and also introduce you to the ABAP type system.
This will help you to choose the correct data types for your requirements and define the appropriate data objects in your
applications.
Module Duration: 2 hours
Module Objectives
Module Content
Target Audience

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/m2p1.htm 28/07/2010
Page 1 of 1

About This Topic


In this topic, we will discuss the data types in ABAP and the data objects derived from them. We describe the visibility
and validity of data objects and explain the operations on data objects dependent on the data type.
Estimated time to complete this topic: 45 minutes
What's in it for me?
Lists the predefined ABAP types and generic types.
Classifies the visibility and validity of data objects; and explain the operations on data objects dependent on the
data type.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1p1.htm 28/07/2010
Page 1 of 2

Predefined ABAP Types


Audio Transcript
Let us now look at the predefined ABAP type.
Predefined data types can be categorized as complete data types and incomplete data types. The complete types can
be used to type a data object directly while the incomplete types must be supplemented with a length specification to
create a complete type.
Each predefined data type has a characteristic initial value. This type-specific initial value plays an important role in
instantiating the data objects and executing the CLEAR statement.
The image on your screen shows you the description for each data type, the initial value it would take on instantiation,
its static length, and its attributes. You will notice that for the variable length, the length begins with zero and is
adjusted dynamically during runtime.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o1c1.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o1c1.htm 28/07/2010
Page 1 of 2

Generic ABAP Types


Audio Transcript
The runtime environment of ABAP provides predefined generic types in addition to the predefined ABAP types.
Unlike the ABAP data type, the generic data type cannot be used to define a data object. They are used exclusively to
type formal parameters and field symbols. The third column in the image on your screen shows you the compatibility
of the generic data type with one or more predefined data types. For example, the generic data type ‘numeric’ is only
compatible with the ABAP data types i, f and p.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o1c2.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o1c2.htm 28/07/2010
Page 1 of 2

Date Fields
Audio Transcript
ABAP has a separate data type for Date and Time fields. They are character like data types and contain 8 numeric
characters for the date and 6 numeric characters for the time.
On the screen you can see that the 8 character field for the data type date can be represented as the date format or
as an integer when the date type is converted to an integer for arithmetic purposes.
The internal format of YYYYMMDD can also be defined to a more user friendly format. This specified format can be
used for input and output. The sample code on your screen shows you how date1 has a formatted output and date2 is
as per the system format.
Date fields can be used in arithmetic expressions. The data object of type date will be represented as an integer and
its value is calculated as the number of days from 1st January 0001.
If the data object with type time is used in arithmetic expressions, then it takes a value as the number of seconds from
midnight.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o1c3.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o1c3.htm 28/07/2010
Page 1 of 1

Automatic Type Conversion during Value Assignment


Audio Transcript
If different types of ABAP data objects are used in an operation, the types are converted automatically. Automatic type
conversion is user friendly. However, conversions use up runtime and it is advisable to keep conversion during
runtime to a minimum.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o1c4.htm 28/07/2010
Page 1 of 2

Definition of Data Objects


Audio Transcript
Data types are descriptions in ABAP and are not linked to an address inside memory. Data objects are instances of a
data type and therefore occupy memory.
The image on your screen shows you the syntax to define a data object. The statement ‘DATA’ defines the data and
the keyword TYPE links the type to the data object. The link is static and cannot be changed at runtime.
Predefined data types are available in the ABAP runtime environment where you may have complete and incomplete
data types.
Global data types are defined in the Dictionary.
The local data type is defined using the TYPES statement within the ABAP program.
The structure of data objects can contain Elementary fields, Structures or Internal tables.
Structures and internal tables can be mutually nested to nearly any depth. If a structure contains an internal table or
other component with a variable length (components with type string and xstring), it is called a deep structure. If the
component has a fixed length, it is termed as a flat structure. A structure can contain other structures as its
components. Such objects are called nested structures.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c1.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c1.htm 28/07/2010
Page 1 of 2

Literals
Audio Transcript
A literal is defined in the source text of the program. There are three types of literals:
The numeric literal which is defined as a sequence of digits, the text-field literal which is defined as a sequence of
characters using the inverted commas to enclose the characters, and the string literal which is defined using the
character string defined within back quotes. The string literal is only available from SAP Web Application Server 6.10
and later.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c2.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c2.htm 28/07/2010
Page 1 of 2

Visibility of Data Objects


Audio Transcript
As ABAP developers, you are familiar with the concept of encapsulating data. The extent to which data objects are
visible depends on the context. The following rules apply to data objects that are defined using the DATA statement:
A global data object is visible to the entire program.
Inside a subroutine, if the data appears between FORM and ENDFORM, it is a local data object to the subroutine.
If it appears between FUNCTION and ENDFUNCTION, then it defines a local data object of a function module.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c3.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c3.htm 28/07/2010
Page 1 of 2

Visibility Areas in Objects


Audio Transcript
Data objects that are created in the declaration part of a class are called attributes.
Using these attributes you can decide on the visibility areas using Private, Protected or Public attributes.
The image on your screen shows you different options for specifying visibility.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c4.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c4.htm 28/07/2010
Page 1 of 2

Lifetime of Data Objects


Audio Transcript
The lifetime of a data object depends on their visibility.
Global data objects are valid as long as the program is in memory.
Local data objects are valid within the subroutine or function module which creates it. These data objects are lost
once the runtime of the modularization unit is completed.
If you use the STATICS statement instead of DATA when you declare local data objects, their lifetime is extended to
the overall program lifetime. Therefore, such data objects have the same lifetime as global data objects, but their
visibility is still limited to the respective modularization unit.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c5.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c5.htm 28/07/2010
Page 1 of 2

Runtime Behavior: Initial Value and Start Value


Audio Transcript
At the start of its lifetime the data object is assigned an initial value. For Global data objects this initial value is
assigned when the program is loaded into memory. For local data objects the initial value is assigned each time the
subroutine or function module is called.
If the local data objects are declared with the STATICS statement, then the initial value is assigned the first time they
are called by the surrounding modularization unit.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c6.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c6.htm 28/07/2010
Page 1 of 1

Runtime Behavior: Fields with Dynamic Length


Audio Transcript
The system will not reserve memory for elementary, variable-length data objects on entering the validity area. The
necessary memory is allocated only when a value has been assigned to the variable.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c7.htm 28/07/2010
Page 1 of 2

Integers and Integer Arithmetic


Audio Transcript
Types i, p, and f represent the three numeric types available. They differ in their inner representation and their
maximum value range and how it does the calculations. Over this and the next two slides you will learn about the
three types and look at their individual arithmetic in detail. This slide shows you how the integer type i is defined and
how it works. Type i is represented internally as a binary number, works faster than the other two types and always
rounds off the result of its calculation to the next whole number.
The image on your screen shows you the valid operations for integers. If the result of the interim calculation lies
outside the maximum value range, then a runtime error occurs.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c8.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c8.htm 28/07/2010
Page 1 of 2

Floating Point Arithmetic


Audio Transcript
Floating point numbers are represented by binary precision floating point numbers. Floating point numbers are
normalized, and the exponent and the mantissa are also stored in the binary form.
The floating point operations of the relevant processors are used for calculations in floating point arithmetic.
There may be inaccuracies as the algorithms are executed with binary numbers. It is recommended that this data type
is used when an approximation is allowed and not when accurate results are expected.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c9.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c9.htm 28/07/2010
Page 1 of 2

Results of Arithmetic for Mixed Expressions


Audio Transcript
It is possible to define an arithmetic expression of mixed data types including character types. The character type
must contain data that can be interpreted as numeric and there must be at least one data object with a numeric type.
Once the arithmetic has been determined, all operands are converted to the numeric type that corresponds to the
chosen arithmetic. The system performs the calculation using these converted values and ultimately converts the
result to the desired result type. The image on your screen shows you how this formula has been interpreted by the
system.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c10.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c10.htm 28/07/2010
Page 1 of 1

Arithmetic Used for Mixed Expressions


Audio Transcript
From the image on your screen you can see that arithmetic to be used is decided by the combination of all the types
in the whole expression. Three rules are shown on the slide as an indicator of the arithmetic that will be selected.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c11.htm 28/07/2010
Page 1 of 2

Packed Numbers and Fixed Point Arithmetic


Audio Transcript
To avoid the problems of rounding off when using the type i and the inaccuracy when using the type f, the type p was
introduced.
This type has a wider range and includes decimal numbers. As can be seen from the image, the length can be
defined when defining the type. The term DECIMALS defines how many of the digits in the length of type p are set
aside for digits after the decimal point.
Packed numbers are the best option for business calculations where the correct rounding for the specified number of
decimal places is very important. The algorithm for this arithmetic is similar to using a pencil and paper. Interim results
initially use packed numbers with 31 decimal places. If an overflow occurs, the entire expression is calculated again
with an internal accuracy of 63 decimal places. If another overflow occurs, an exception is raised and it can be
handled.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c14.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c14.htm 28/07/2010
Page 1 of 2

Unicode Character Set Table


Audio Transcript
Before the advent of the Unicode character set table, different character tables were used to represent different sets
and data interchange was not an easy process.
As of SAP Web Application Server 6.10 and later, the Unicode character set is also supported and this allows for a
possible 65,536 characters that could be represented.
The Unicode check needs to be activated for this to work and can be set for each program. If the Unicode check is
active, it can be run in a non Unicode supported system but the reverse is not true.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c15.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c15.htm 28/07/2010
Page 1 of 2

Overview of Possible ABAP Commands for String Processing


Audio Transcript
To summarize what you have looked at so far, you must remember that:
All elementary data objects defined as byte like data type will be treated as byte like data objects.
All elementary data objects defined as character like data type will be treated as character like data objects.
In non-Unicode systems, the byte like data objects is treated as character like data objects.
In Unicode systems, you must differentiate between them when defining them.
All flat structures are treated as character like data objects only if they contain character like components.

In the image on your screen, you will see some statements. In each of these statements, the operands are treated like
type c fields, regardless of their actual field type. They are not converted.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c16.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c16.htm 28/07/2010
Page 1 of 1

String/Byte Sequence Processing


Audio Transcript
In Unicode, the IN BYTE MODE will have to be added to ensure that each byte is examined individually, and not in
pairs. The corresponding IN CHARACTER MODE addition is optional for processing character-like data objects.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c17.htm 28/07/2010
Page 1 of 1

Lengths and Comparisons


Audio Transcript
The standard function STRLEN( ) is used to determine the occupied length of a string. The corresponding function,
XSTRLEN( ), is available for byte-like data objects.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c18.htm 28/07/2010
Page 1 of 1

Access with Offset and Length Information for Elementary Data Objects
Audio Transcript
As you can see from the image on your screen, when character fields are defined, the offset and length are
interpreted character by character. When defined as byte-like fields the values are assumed in bytes.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c19.htm 28/07/2010
Page 1 of 1

Access with Offset and Length Specifications for Structures


Audio Transcript
In flat structures, offset access is possible even if they are not completely character-like as long as the access does
not go beyond the character-like area.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c20.htm 28/07/2010
Page 1 of 2

Value Assignments
Audio Transcript
On your screen you can see that if we want to assign the value of one field to another, we can either say MOVE
source TO target or we can say target=source.
Both source and target should be of the same type. There is one more option shown on your screen. The WRITE
statement is used when you want to copy the source to the target in a formatted form. In this case the target field has
to be long enough to accommodate the formatting, for example, spaces or separators.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c21.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t1o2c21.htm 28/07/2010
Page 1 of 1

About This Topic


This topic will discuss more about using structures, particularly nested or deep structures. In addition it will also discuss
what the Unicode check means when working with structures.
Estimated time to complete this topic: 30 minutes
What's in it for me?
Defines program local structure types and structures, differentiate and use nested, flat, and deep structures.
Explains the uses of named includes.
Explains executing Unicode compatible value assignments between structures.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t2p1.htm 28/07/2010
Page 1 of 2

Definition of Structures
Audio Transcript
There are two ways to declare structures: This can be done using the TYPES statement to explicitly define a structure
type to which the DATA statement refers, or construct the data type implicitly in the DATA statement.
Sample code for both types is shown on your screen for reference.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t2o1c1.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t2o1c1.htm 28/07/2010
Page 1 of 2

Definition of Nested Structures


Audio Transcript
Nested structures can be defined as deep as required. The components of the substructure can be addressed with a
corresponding chain of component names.
On your screen, you can see the sample code where the structure name is nested into the second structure address.
A deep structure is a structure in which at least one component has a dynamic type, which can be an elementary data
object with variable length of type string or xstring, a reference to another data object, or an internal table.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t2o1c4.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t2o1c4.htm 28/07/2010
Page 1 of 2

Use of Named Includes


Audio Transcript
The nested structure cannot be used when presenting data using the SAP List Viewer or in the Table Control. The
alternative is to use a Named Include. The sample code on your screen shows you how this can be done. The
structure s_name has three components to it, prename, surname and title.
The structure is called using the “Include Type … As.. “ statement. Notice how, it is no longer represented as a nested
structure and the three components are now called name.
To call a structure you can use the Include Structure statement.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t2o2c1.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t2o2c1.htm 28/07/2010
Page 1 of 2

Value Assignment Using Compatibly Typed Structures


Audio Transcript
The contents of one structure can be assigned to another structure. As mentioned earlier, the program is more
efficient if you can keep the types of the structures the same and avoid as much automatic conversion as possible.
If the components of two structures are type compatible, but their component names are different, these two
structures are still compatibly typed as a whole.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t2o3c1.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t2o3c1.htm 28/07/2010
Page 1 of 2

Assigning Values to Identically Named Structure Components


Audio Transcript
To assign values between identically named structures, you can use the MOVE-CORRESPONDING statement. The
system will copy each source field to the target field matching it by name. On your screen, the sample code shows
you how the fields of name are moved into the matching fields in address which has the fields of the same name
among other fields. The interpretation of how this is done is shown on the right of the screen.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t2o3c2.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t2o3c2.htm 28/07/2010
Page 1 of 1

About This Topic


This topic will define the global data types and constants. Global types are created centrally in the ABAP Dictionary.
Estimated time to complete this topic:
What's in it for me?
Explains the need for global types and constants and their creation.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3p1.htm 28/07/2010
Page 1 of 2

Overview of Global Types and Constants


Audio Transcript
You have already looked at predefined data types and how to work with them. In this topic, you will learn about Global
data types and constants, where they are created, and why and how to use them. The Global data type is
administered centrally and enables better use and control. As they reside in the ABAP Dictionary, it is possible to use
them in all your Repository objects.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c1.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c1.htm 28/07/2010
Page 1 of 2

Benefits of Reusability for Global Data Types


Audio Transcript
Global data types are linked to business contexts based on content, and are actively integrated in the SAP system.
Therefore, when searching for a global data type, consider both technical and semantic properties.
Global data types are centrally administered. Hence, you can use them in all repository objects. Also, global data
types minimize maintenance while maximizing system consistency.
Let us now look at what an ABAP Dictionary is.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c2.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c2.htm 28/07/2010
Page 1 of 2

Overview: ABAP Dictionary


Audio Transcript
The ABAP Dictionary manages global information that can be accessed and used throughout the repository objects.
This Dictionary includes the Search functions and the global data types.
Simple and complex structured data types can be defined in the ABAP Dictionary. You cannot declare types or data
objects that are known outside the boundaries of a program. Technical and semantic information is also stored here.
The ABAP Dictionary also maintains all information about database tables which are addressed from the SAP
System. All changes to the database table is first completed in the ABAP Dictionary and then copied to its appropriate
place to ensure a consistent availability of information. This also ensures that there is no dependency on platforms.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c3.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c3.htm 28/07/2010
Page 1 of 2

Advantages of Using Dictionary Types for User Dialogs


Audio Transcript
Programs in the SAP system may contain user dialogs to input and output data. Global types for input and output
fields have many useful attributes:
When a user enters invalid data, the value ranges that are defined for the Global data type are automatically checked
as they are globally available and an error message can go to the user. A similar feature is available for formatting
and semantic information. This is because the global data objects have the same type as the columns in the database
table.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c4.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c4.htm 28/07/2010
Page 1 of 2

Advantages of Using Dictionary Types for Database Dialogs


Audio Transcript
The next advantage of the ABAP Dictionary lies in the fact that it not only maintains information about the global data
type but also contains all required information about the definitions of database table. When you want to administer a
database table, or you want to access data from the database table form within your ABAP program, the fact that both
these information are available globally ensures ease of operations.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c5.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c5.htm 28/07/2010
Page 1 of 2

Example: Typing Interface Parameters


Audio Transcript
Global types are used to define the interface parameters for function modules and methods of global classes. If this
type is complete, you can use it directly, at runtime, to define the data object. This makes your program more robust
while reducing maintenance. On your screen you can see how the ABAP program can directly call the function or the
methods as they are linked to the global data type.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c6.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c6.htm 28/07/2010
Page 1 of 2

Overview: Global Types


Audio Transcript
Now that we have seen why we need global data types and their advantages, let us look at the types themselves in
detail.
Inside the ABAP dictionary, the elementary data types are known as data elements. They can contain technical and
semantic information, field labels, details about F1 help and a link to the search help.
Structured data types are called structures and just like the local structure types they can be nested to any depth.
Data types for internal tables are called table types. While known as table types, they are stored internally in the
Dictionary as access types. Data types are not the same as the definition of data tables seen earlier.
Global types are formed from elementary types, just like local program data types. Although they are identical
technically, they have different names from the predefined ABAP types. These are only valid within the ABAP
Dictionary. Thus, to make things simple, they are referred to as predefined Dictionary types.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c7.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c7.htm 28/07/2010
Page 1 of 1

Mapping Between Dictionary Types and ABAP Types


Audio Transcript
The image on your screen shows you how the Dictionary type is mapped to the ABAP type when generating the
program. After that, on actual execution of the program, it is the ABAP type that is used. The documentation for the
same is shown on the right of our image.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c8.htm 28/07/2010
Page 1 of 2

Examples of Predefined Dictionary Types


Audio Transcript
We have already seen that the global data types are formed from elementary types. Just like local program data types
they are technically identical to the predefined ABAP types. They are referred to as predefined Dictionary types. Some
examples of these types are shown in the table on your screen. The two columns in blue show how the ABAP type is
different from the Dictionary type.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c9.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c9.htm 28/07/2010
Page 1 of 2

Attributes of Data Elements


Audio Transcript
Data elements are elementary Dictionary types. The options for assigning a technical property to a data element are
either by using a domain, or by direct type specification.
If you assign the technical properties using a domain, then the domain itself contains the technical attributes. This
reduces maintenance. It is recommended to use this method if the technical attributes for usage have to be the same
but not the semantic attributes.
With direct type specification, you would need to reference dictionary type and if this type is an incomplete one, then
the rest of the required information like length or decimal places has to be defined for the data element.
The semantic information has to be defined for a data element.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c10.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c10.htm 28/07/2010
Page 1 of 2

Using Data Elements in Programs


Audio Transcript
Let us now look at how to use these data elements in a program. When you want to assign the type to the input or
output field using a data element, some existing attributes can be used.
With the predefined data type, the type and length attributes can be checked automatically and error messages can
be sent out automatically. Similarly, existing formatting or additional restrictions can be used. Help information stored
with a field is also available automatically when the user hits the F1 key. If any search help is assigned to the data
element, which too is now accessible.
The image on your screen shows you how this is done, as the global data type is used for the assignment. Let us now
look at structures.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c11.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c11.htm 28/07/2010
Page 1 of 2

Structures in the ABAP Dictionary


Audio Transcript
A structure contains several components and any number of them can be global types. The type to each component
can be assigned by using a data type, by direct type specification or by using a structure type or a table type.
You have already seen the advantages of using the global data type. Similar advantages exist with the use of direct
type specification and using of the structure type enables you to use any level of complexity.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c12.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c12.htm 28/07/2010
Page 1 of 2

Using Dictionary Structures in ABAP Programs


Audio Transcript
The sample code on your screen shows you how to use Dictionary Structures in ABAP programs.
To define a screen interface, a flat global structure type can be used. Formatting options, online help and search
functions, validity checks and so on can come from the global types itself so that the entire program is more efficient.
Similarly, for the user, error messages can come from the global types too, as these would have been defined there.
You have to define the structure for the data transport between screen and program with the TABLES statement.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c15.htm 28/07/2010
Page 2 of 2

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c15.htm 28/07/2010
Page 1 of 1

Using Structure Components for Screens


Audio Transcript
In continuation from the previous slide, here, you can see how all the various checks, like validity, formatting options,
semantic information can be accessed in the new structure as they are originating from the global types. Similarly,
technical information also comes from the technical type to your ABAP program.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c18.htm 28/07/2010
Page 1 of 1

Type Groups in the ABAP Dictionary


Audio Transcript
A type group has to be used to define a global constant. The name of this type group can contain up to 5 characters.
The CONSTANTS statement is used to define constants in the type group.
All predefined ABAP types and the global Dictionary types can be used. To use the types of a type group in a
program, you specify the type group using the TYPE-POOLS statement.
The sample code on your screen shows you how this can be written.

http://online.sap.com/sap/courses/sap-113634/16441125/KTMID509897808040915370315/t3o1c19.htm 28/07/2010

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy