Sie sind auf Seite 1von 61

ABAP/4 Programming

Lesson 2

Program Data and Dictionary Tables


Click here to start
Table of Contents Author: Roger Hayen

Program Data and Dictionary Tables Email: roger.hayen@cmich.edu

Lesson 2 Topics Home Page: Contents

Lesson Objectives

Functions of ABAP/4 Dictionary

Integration into ABAP/4 Workbench

Basic Dictionary Objects

Dual Level Data Concept

Transparent Tables

Extract from the Flight Data Model

Displaying Table Definitions

Table Definition

Displaying Data Elements

Displaying Domains

Creating Transparent Tables

Structures

Creating Structures

Aggregated Objects in the ABAP/4


Dictionary: Views
Data Types

Pre-defined Data Types

Data Objects

Variable Data Objects

Elementary Data Objects

Initializing a Data Object

Assigning Values

Calculating Values

Sub-fields

Calculating Dates

Input Parameters

Data Types and Data Objects

User-defined Data Types

User Defined Types

Elementary Types

Field String Types

Type Groups in the ABAP/4 Dictionary

Field Strings

Literals and Constants

Summary of Declarative Statements

Type Conversion

Conversion Rule: Elementary Types


Conversion Rule: Field String Types

Summary

Summary

Summary

Quick Check

Quick Check

Quick Check

Quick Check

Slide
1 of
47

Lesson Purpose
The purpose of this lesson is to examine and describe the use of data in ABAP/4
programs including the relationship to obtaining data from tables in the ABAP/4
Dictionary.

In learning to write ABAP/4 programs you need to learn about obtaining data
from tables in the ABAP/4 Dictionary including how the data are defined as fields
in the Dictionary. ABAP/4 has a number of different data types that are used with
the data manipulated in an ABAP/4 program.

Slide
2 of
47

Lesson Topics

This lesson consists of the following main topics:

 ABAP/4 Dictionary
 Dictionary Objects
 Table Definitions
• Table Fields
• Data Elements
• Domains

 Structures
 Data Type

• Predefined
• User-defined

 Calculations

• Arithmetic
• Date

 Input Parameters

Slide
3 of
47

Lesson Objectives
Upon completion of this lesson, you should be able to:

• Describe the ABAP/4 Dictionary and the immediate effect of changes to ABAP/4
programs stored in the Dictionary
• Describe the basic Dictionary objects including a table, table field, data element,
and domain
• Describe a transparent table including its use in ABAP/4 programming and its
creation
• Describe the use of structures in an ABAP/4 program including their creation
• List the numeric and alpha-numeric predefined data types that are part of ABAP/4
data
• Describe arithmetic and date calculations in ABAP/4 including the arithmetic
operators and their syntax in the COMPUTE statement

Slide
4 of
47

Functions of ABAP/4 Dictionary


The ABAP/4 Dictionary is used for creating and managing data definitions. It enables all
data used in the system to be described centrally, without redundancy.

• All data entered in the ABAP/4 Dictionary is available throughout the SAP R/3
System.
• Changes take effect in all relevant system components via the activation
mechanism in R/3.
• Via the Repository Information System, the Dictionary can be analyzed from
many different angles of inquiry.
• Foreign key relations, used in linking data in different tables, are stored in the data
dictionary.

Slide
5 of
47

Integration into ABAP/4 Workbench


The ABAP/4 Dictionary is an active, integral component of the ABAP/4 Development
Workbench. ACTIVE means that any change made in the Dictionary becomes effective
AT ONCE in the relevant ABAP/4 programs and screens.

• This ACTIVE workbench is integrated into both the development and runtime
environment.
• The basis for this is the interpretive nature of the R/3 Systems. The interpreter
does not operate directly on the original SOURCE code of an ABAP/4 program or
screen, but interprets a generated, internal representation, the GENERATED
code.
• When changes are made in the ABAP/4 Dictionary, automatic post-generation of
this internal representation guarantees that the interpreter is always working with
the latest version of the program.
• The ABAP/4 Dictionary enables you to develop and maintain large program
systems where many developers work together because it allows everyone to
access and use correct, consistent information.
Slide
6 of
47

Basic Dictionary Objects

Objects in the ABAP/4 Dictionary resided on three levels that support their re-usability.
These levels are:

1. Tables and structures

2. Data elements

3. Domains

• The basic data definition objects in the ABAP/4 Dictionary are tables, domains
and data elements. Domains describe the technical attributes of table fields (e.g.
field type, field length), while data elements contain the semantic definition (e.g.
short description).
• Table fields are not independent objects and can only be maintained within tables.
The table field requires the existence of a referenced data element.
• A data element requires the existence of a referenced domain.
• Domains can be defined without further reference to other Dictionary objects.
Slide
7 of
47

Dual Level Data Concept

In the ABAP/4 Dictionary, two types of objects are used for data definition purposes.
These are technical domains (known as domains in the R/3 System) and semantic
domains (known as data elements in the R/3 System).

• The domain is the central object used to describe the attributes of a business
object. It describes a field’s value range which is defined by specifying formal
attributes such as external format and length and by specifying fixed values or a
value table.
• The data element is the semantic object. It describes precisely the purpose of a
domain in a particular business setting for the fields which depend on it.
• For example, the table fields FORCURAM (table SBOOK) and PRICE (table
SFLIGHT) belong to the same domain S_PRICE. To distinguish their actual
business application, the field FORCURAM uses the data element S_F_CUR_PR
and the field PRICE uses the data element S_PRICE. However, both fields belong
to the same domain because they are currency fields and thus have similar
technical attributes.
• Data elements and domains are used in SAP to insure that fields with equivalent
forms and semantics are CONSISTENT.

Slide
8 of
47

Transparent Tables

Transparent tables provide a logical view of the data in the ABAP/4 Dictionary that is
independent of the table's physical storage in the database management system (DBMS)
such as Oracle. When it has been activated in the ABAP/4 Dictionary, a transparent table
is automatically created in the database. This process translates the database-independent
description of the table in the ABAP/4 Dictionary into the language of the database
system being used.

• Transparent tables are a representation of the way SAP R/3 interacts with the
DBMS that actually stores the data, such as Oracle. This is just the manner in
which data is made available to an ABAP/4 program by the R/3 Basis System and
is NOT a user-defined or controlled specification.
• The database table has the same name as the table in the ABAP/4 Dictionary. The
fields also have the same names in both the database and in the ABAP/4
Dictionary. The data types in the ABAP/4 Dictionary are converted to the
corresponding data types of the database system.
• Beginning with Release 3.0, the sequence of fields in the ABAP/4 Dictionary can
vary from the sequence of fields in the database. This allows you to insert new
fields without having to convert the table by performing a physical reorganization.
When adding new fields, the adjustment is made by changing the database catalog
(ALTER TABLE). A new field is appended to the database table, regardless of its
position in the ABAP/4 Dictionary.
Slide
9 of
47

Extract from the Flight Data Model

Many of the example programs and exercises for the ABAP/4 Programming lessons
relate to the SAP flight data model. This is contained in the development class SAB4.

The following tables from this model are used with these lessons:

• SPFLI: Table of flight connections


• SFLIGHT: Table of flights
• SBOOK: Table of flight bookings

A data model specifies tables and their relationships for the data used with the SAP R/3
System. A graphical data model helps you visualize the tables and their mutual
dependencies. The two key elements of the graphical data model are small boxes (called
entity types) representing the tables and arrows to show relationships between these
tables. A data model is based on the ABAP/4 Dicitionary so changes to a table definition
are automatically reflected in the model. You can double-click an entity to drill down
from the data model to the underlying table definition in the Dictionary.
A data model can be displayed in either the Data Browser or graphically. You may
explore the data model from the SAB4 development class that includes the SFLIGHT
table in the Data Browser (Standard View) or the graphic Data Modeler (Display Mode)
by examining these additional screens:

Display Data Model: Hierarchy (Standard View)

Data Modeler: Graphics (Display Mode)


Slide
10 of
47

Displaying Table Definitions

A list of the fields that define the content of a table can be displayed. The following
description includes the steps for displaying a table definition starting from the ABAP/4
Development Workbench screen.

To display a table definition:

1. Click the ABAP/4 Dictionary button on the Application toolbar to display the
Dictionary: Initial Screen.
2. Type the table name in the Object name textbox, e.g. SBOOK.
3. If necessary, click the Tables option button in the Dictionary objects section to
select that option.
4. Click the Display button in the Dictionary objects section to display the
Dictionary: Table/Structure: Display Fields screen containing the table definition.
If necessary, you may need to scroll down the Initial Screen to see the Display
button in the Dictionary objects section.
Slide
11 of
47

Table Definition

You can double-click a data element name to navigate to the definition of that data
element. That is, you “drill-down” to the data element name from the table definition.

To view a data element description:

1. Double-click the desired data element name in the Data elem. column, e.g.
S_CARR_ID. The Dictionary: Display Data Element screen displays.
Slide
12 of
47

Displaying Data Elements

The Dictionary: Display Data Element screen includes the Short text used with the
selected data element to describe that data element. On this screen, the data type indicates
how the data would be displayed on output from the table. The domain attributes can be
displayed from the Display Data Element screen using drill down.

To display the domain for a data element:

1. Double-click the value in the Domain name textbox, e.g. S_CARR_ID. The
Dictionary: Display Domain screen appears with the domain definition.
Slide
13 of
47

Displaying Domains

The Dictionary: Display Domain screen includes the Format section that is used when
specifying these attributes. Although you can view this same information from the
Display Data Element screen, these attributes can be changed from the Domain screen,
which is indicated by the textboxes in the Format section. Of course, you must have
appropriate authorization to make any changes to the Domain.
Slide
14 of
47

Creating Transparent Tables

To define a table, you go into the Object Browser and proceed as follows:

• Under a defined development class, click the Display button to display the
development object list for the specified development class. Select the
development class by positioning the cursor on the development class name and
click the Create icon on the application tool bar.
• A pop-up window will be displayed with the classifications of development
objects. Click the Dictionary objects radio button to select this classification.
• On the Dictionary objects screen, click Table and enter the table name.
• On the next screen, you can enter the field names for your table and specify the
name of an existing data element (or define a new one) which points to a domain.

 By activating a transparent table in the ABAP/4 Dictionary, you automatically


create the table via the database utility in the database.
 Only complex database operations such as table conversions must be performed
directly via the database utility. Simple operations, such as creating objects, can
be performed automatically by activating the objects in the ABAP/4 Dictionary.
 You can control database objects with the database utility.

Slide
15 of
47

Structures

Besides defining tables stored in the database, you can also define the structure of data
which occurs when performing calculations in programs, or when passing data between
programs with a global definition in the ABAP/4 Dictionary. This kind of definition is
known as a structure. That is, structures define data that is transferred between programs
without storing it it a database table.

• Structures do NOT correspond to objects in the database.


• Structures are defined in the same way as tables.
• Structure are defined by the keywords DATA BEGIN OF / DATA END OF.
They contain a fixed number of objects.
• Structures are defined and activated in the ABAP/4 Dictionary. They can then be
addressed by ABAP/4 programs like tables declared in the TABLES statement.
• While data can be permanently stored in transparent tables in the database, data in
structures is temporary and exists only during the runtime of a program.
• Structures are used in particular for defining data at the interface of module pools
and screens, as well as for assigning the types to the parameters of reusable
function modules or subroutines.
• Defining structures centrally means that you can change them centrally. The
active ABAP/4 Dictionary then ensures that any modifications are made in all the
places concerned.

Slide
16 of
47
Creating Structures

To define a structure, you go into the Object Browser and proceed as follows:

• Under a defined development class, click the Display button to display the
development object list for the specified development class. Select the
development class by positioning the cursor on the development class name and
click the Create icon on the Application tool bar.
• A pop-up window displays with the classifications of development objects. Click
the Dictionary objects radio button to select this classification.
• On the Dictionary objects screen, click Structure.
• On the next screen, you can enter the field names of your structure and specify the
name of an existing data element (or define a new one) which points to a domain.

When checked and found to have no errors, the structure is saved and activated, and then
it is ready for use.
Slide
17 of
47

Aggregated Objects in the ABAP/4 Dictionary: Views

Database (DB) views can be defined from the SAP R/3 System. They provide users with
a virtual table or a logical user view of the data in one or more database tables.

• The data for an application object is often distributed on several DB tables in a


relational data model.
• The database system allows you to define application-dependent views (logical
user views) of the data. These are application-specific views of different ABAP/4
Dictionary tables.
• In this way, data from different tables can be combined in a logical manner and
information which is NOT of interest can be masked out.
• ‘Aggregated’ means consisting of several components. In the ABAP/4 Dictionary,
aggregated objects are objects which come from several different transparent
tables.
• Views allow you to gather information from the fields of different tables and
present it to users in the form they require when working with the R/3 System.
• Views are mainly used for programming with ABAP/4 and for F4 online help.
• Views are usable across different programs.
Slide
18 of
47

Data Types

Data types may be either predefined or user-defined.

• There are eight predefined data types for use by the ABAP/4 language.
Slide
19 of
47

Pre-defined Data Types

The eight pre-defined data types in ABAP/4 are specified by a letter which indicate the
type.

• The numeric data types P, I and F have the following properties and value ranges:
property
Type range suitable for
value
I integer -231 to +231 counters, quantities, indexes, time
periods
P number 2 characters amounts of money, lengths,
with per byte weights
decimal
places
F floating -2.2E-308 to calculation in a very large value
point +1.8E308 range

• Calculations with number of type I are the most economical, followed by type F
and then type P. You should note, however, that approximation can cause errors
with type F numbers. It is particularly inadvisable to compare two floating point
type numbers for equality. You should instead check whether the difference
between the two falls within an acceptable tolerance. You should only use
floating point number for mathematical problems where you can accept
approximation errors. For business problems, you should normally use type P.
• Packed numbers are the best choice if you have large numbers, or if decimals are
involved in your calculations.
• In type P numbers, two digits are stored in each byte. The last half byte is used for
the plus or minus sign.

For additional information see:

Formatting WRITE Output on the Screen

Formatting WRITE Output on the Screen

The format of data fields on the output screen depends on their data
type.

Output format of predefined data types

Data type Output length Positioning


C field length left-justified
D 8 left-justified
F 22 right-justified
I 11 right-justified
N field length left-justified
P 2 * field length (+1) right-justified
T 6 left-justified
X 2 * field length left-justified

The numeric data types F, I, and P are right-justified and padded with
blanks on the left. If there is sufficient space, thousands separators are
also output. If a type P field contains decimal places, the default output
length is increased by one.

Note
With the data type D, the internal format of a date differs from
its output format. When you use the WRITE statement for
outputting data, the system automatically outputs dates of type
D in the format specified in the user's master record (e.g.
DD/MM/YYYY or MM/DD/YYYY).

PROGRAM ZA01TEST.
DATA NUMBER TYPE P VALUE '-1234567.89' DECIMALS
2.
WRITE: 'Number', NUMBER, 'is packed'.

The output appears as follows:

Number 1,234,567.89- is packed

The field NUMBER has a total length of 13, i.e. 9 digits (including the
decimal point), the leading minus sign, and two commas as separators.
The output length of the NUMBER field is 2*8+1=17 because the field
length of a type P field is 8. The superfluous positions are filled with
four blanks. This means that there are five blanks between the literal
'Number' and the number itself.
Slide
20 of
47

Data Objects

Data objects can be either fixed or variable.

• While the value of variable data objects can be changed in the program, the value
of fixed data objects cannot be changed at runtime.
• You can differentiate between literals and constants in fixed data objects. Literals
are unnamed, constants are named data objects.
Slide
21 of
47

Variable Data Objects

You use the DATA statement to declare data objects in your ABAP/4 programs.

 The additions for the DATA statement are the same as those for the TYPES
statement. In exactly the same way as with the TYPES statement, you can use
 TYPE to refer to a predefined or user-defined data type or
 LIKE to refer to the type of a data object within the program or an
ABAP/4 Dictionary object.
 The LIKE addition is specified so you can use the attributes from an existing field
defined in the data dictionary instead of defining the variable attributes internally
in the program.
 Note that you can use the TYPE and LIKE additions for any data object
declarations.
Slide
22 of
47

Elementary Data Object

You can specify a length for predefined data types P, N, C and X. You enter this in
parenthesis following the data object name.

• If there is no length specified, the standard length for the data type applies.
• For data type P you can specify the number of decimal places (up to a maximum
of 14) using the DECIMALS addition.
• If you do not specify a data type, the default type C will apply to the field.
Slide
23 of
47

Initializing a Data Object

You use the CLEAR statement to reset any variable data object to the initial value
appropriate to its type.

• Each elementary field is initialized with a value appropriate to its type. You can
set an initial value for an elementary field yourself using the VALUES extension
of the DATA statement. Only a fixed data object can follow the VALUES
extension (a literal or a constant).
Slide
24 of
47

Assigning Values

Value assignment from one data object to another data object can be accomplished in the
following ways:

• MOVE < object1> to < object2>.

Or
• < object2> = < object1>.

• Arithmetic operations also affect the assignment of values to data objects.


Slide
25 of
47

Calculating Values

The COMPUTE statement allows arithmetic operations to be specified as a formula that


is calculated.

• The COMPUTE keyword is optional.


• You can nest parenthetical expressions as deep as you wish.
• The arithmetic operators and parentheses which form the parts of an expression
each count as one word. They MUST therefore be separated by spaces. However,
the opening parenthesis must NOT be separated from the function name, e.g.
SQRT( … ).

Wrong: A = (B+EXP(C))*E/SIN(3-G).

Right: A = ( B + EXP(C) ) * E / SIN( 3 - G ).

Where A, B, C, E, and G are data objects or variables, and EXP


and SIN are function names.
• There is a separate process in the ABAP/4 interpreter for each of the data types P,
I, and F. An arithmetic expression is calculated using only one of theses
arithmetic processes. Which arithmetic process is used is determined in the order
I, then P, then F. Both the arithmetic operators and the result field go into the
determination of the process used.
• Valid arithmetic operators are ADD, SUBTRACT, MULTIPLY, and DIVIDE, or
you can use the shortened form of the symbols + , - , * , or /.
• The operator ** is used to raise a number to a power, e.g. exponentiation.
• The DIV and MOD operators return integers, where DIV is integer division and
MOD is the remainder.
• The STRLEN function returns the length of a string.
• The arithmetic operators follow the normal order of precedence in performing the
multiplication and division before and addition or subtraction.

Slide
26 of
47
Sub-fields

You can address and change sub-areas of an elementary field by specifying the offset and
length of the sub-string. When an offset is not included, an offset of zero is implied and
the sub-field begins with the first character of field.

In ABAP/4, you can specify offset values for elementary data objects in all statements
which process these data objects. To do so, specify the name of a data object in a
statement as follows:

<f>[+<o>][(<l>)]

The operation of the statement is performed for the part of the field <f> that begins at
position <o>+1 (that is the first position immediately to the right of position <o>) and has
a length of <l>.

If the length <l> is not specified, the field is processed for all positions between <o> and
the end of the field.

• With some statements, the offset and length details may be given as variables.
• The plus sign (+) must NOT be preceded or followed by any spaces when
specifying a sub-field.
Slide
27 of
47

Calculating Dates

Date field values may be converted to numeric field values, and numeric field values may
be converted to date field values.

• If a date field is converted to a numeric field, the ABAP/4 system calculates the
number of days since 01/01/0001.

NOTE: This use of a four digit year value, makes the R/3 System “Year 2000”
compliant.

• Conversely, a numeric value assigned to a date field is interpreted as the number


of days since 01/01/0001. Date field values are converted into numeric values
(number of days since 01/01/0001) before any calculation takes place.
Slide
28 of
47

Input Parameters

The PARAMETERS statement is a declarative language element for establishing internal


fields within the report. The difference between the PARAMETERS and DATA
statements is that fields declared using PARAMETERS are presented for input on the
selection screen at runtime when the program is being executed.

• When you use the PARAMETERS statement, you can use the TYPE and LIKE
additions as you would when using the DATA statement.
• As you would use VALUE with DATA statements to assign an initial value, you
can use the addition DEFAULT with the PARAMETERS statement to set a
default value for the field. This value can be a literal, a constant, or a system field
which takes its value from the system when the report is processed (e.g. SY-
DATUM).
• Use the OBLIGATORY addition to cause a question mark (?) to initially appear
in the PARAMETERS textbox. This forces a user to enter a value on the selection
screen. However, R/3 requires the user to delete the question mark when entering
the desired, required value.

Slide
29 of
47

Data Types and Data Objects

Data types in ABAP/4 are classified by definition as either predefined or user-defined.

The names of the predefined data types are fixed. The names of the user-defined data
types are defined by the programmer in the program.

The TYPES statement does NOT create a new data object or variable, it specifies a new
type that can be used in creating a data object or variable.
Slide
30 of
47

User-defined Data Types

User-defined data types can either be elementary or structured. User-defined elementary


data types are based entirely on predefined elementary data types. To define your own
elementary data types, you use the TYPES statement.

• User-defined elementary data types make your programs easier to read and
maintain by giving them descriptive names that are easier to understand and more
recognizable.
• The TYPE statement never allocates data space in memory, whereas the DATA
statement always does.
• Elementary data types cannot be included in further components. Structured data
types, on the other hand, are made up freely of elementary and structured data
types.
• In structured data types there is a difference between field string types and table
types:
o Field string types (known as structures or records in other terminology)
can be made up of components of any type.
o Table types (known as arrays in other terminology) can be made up of
lines of any type.
• Field string types and table types at the highest level can themselves contain
further field string types and table types.

Slide
31 of
47

User Defined Types

You can declare user defined data types in your ABAP/4 programs using the TYPES
statement.
• In doing so you can refer to:
o pre-defined or user defined data types using TYPE or
o the type of data objects within the program or ABAP/4 Dictionary objects
using LIKE.
• Note that you can use the additions TYPE and LIKE for any type declarations.

Slide
32 of
47

Elementary Types

You can specify a length for data types P, N, C and X. You enter this in parenthesis
following the data type name.

• If there is no length specified, the standard length for the data type applies.
• For data type P you can specify the number of decimal places (up to a maximum
of 14) using the DECIMALS addition.

• If you do not specify a data type, the default type C will apply to the field.

Slide
33 of
47

Field String Types

A field string is used to group a set of variables.

You can define field string types using the syntax TYPES: BEGIN OF <type>,..., END
OF <type>. You define the field string components with length and any type as you
would any other data object.
Slide
34 of
47

Type Groups in the ABAP/4 Dictionary

You can define data types in a type group in the ABAP/4 Dictionary instead of defining
them within an ABAP/4 program.

• The type group name in the ABAP/4 Dictionary has a maximum of 5 characters.
Type names within type group <typepool> must begin with <typepool> followed
by an underscore.

• The types in a type group must be declared in ABAP/4 programs with the TYPE-
POOLS command.
Slide
35 of
47

Field Strings

You define field strings with the syntax DATA: BEGIN OF <field string>, ... , END OF
<field string>

• Of course, you can also refer to a field string type using TYPE.

• You address the individual fields with the name of the field string followed by the
field name.

• Table work areas declared with the TABLES statements are field strings. Thus the
statement TABLES <dbtab> is the same as the statement DATA <dbtab> LIKE
<dbtab>. However, the TABLES statement also makes the database table known
in the ABAP/4 program as well. This is why a SELECT statement without a
preceding TABLES statement leads to a syntax error.
Slide
36 of
47

Literals and Constants

You define constants using the ABAP/4 keyword CONSTANTS. The VALUE addition
is required for constants. It defines their value.

• ABAP/4 recognizes two types of literals: number literals and text literals. The
latter is always enclosed in apostrophes or inverted commas (‘).

• Whole numbers (with preceding minus sign if they are negative) are stored as
number literals with either type I (up to and including nine digits) or type P (ten or
more digits).
• All other literals (character, numbers with decimal places, floating point numbers)
are stored as text literals with data type C. The ABAP/4 processor carries out a
type conversion if necessary (see the type conversion slide).

• If you want to include an apostrophe or inverted comma (‘) in a text literal, you
must enter it twice.

• Text symbols are text literals.

Slide
37 of
47

Summary of Declarative Statements

The following declarative statements have been presented:


Statement Action
TYPES Definition of type
Definition of elementary fields, field strings and
DATA
internal tables
CONSTANTS Definition of constants
PARAMETERS Definition of input parameters
TABLES Definition of table work areas

• In a subsequent lesson, you will learn about the following declarative statement:

Statement Action
SELECT-OPTIONS Definition of selection options
• You can display a comprehensive overview of the declarative statements in
ABAP/4 by pressing the Editor pushbutton and then choosing ABAP/4
Overview Overview of the ABAP/4 programming language
Classification of keywords by type.

You may explore this Overview by examining these additional screens:

Overview of ABAP/4 programming language

Classification of keywords by type

DATA statement example


Slide
38 of
47

Type Conversion

If you assign data objects of different types to one another, ABAP/4 carries out a type
conversion as long as a conversion rule has been defined for the types concerned.

• The following slides examine these conversion rules.


Slide
39 of
47

Conversion Rule: Elementary Types

A comprehensive overview of the conversion rules for elementary types is contained in


the online documentation for the DATA command.

• Type C fields are saved left justified. When you use convert to type C fields, the
field is filled up with blanks if it is too short, and truncated if it is too long (see
examples 1 and 2 above).

• When you convert a type C field to a type P field, only digits, a plus or minus sign
and a decimal point are permitted (see example 3 above).

• When you convert a packed field to a type C field, the leading zeros are converted
into spaces (see example 4 above).
Slide
40 of
47

Conversion Rule: Field string Types

ABAP/4 recognizes rules for converting:

• field strings to field strings


• elementary fields to field strings
• field strings to an elementary field

• In each of the above cases, the ABAP/4 processor converts the field strings into
type C fields.

• Internal tables can only be converted into other internal tables. The appropriate
line types are then converted.

Das könnte Ihnen auch gefallen