Professional Documents
Culture Documents
Proprietary Information. DCDM Consulting. Not to be disclosed without express written consent.
Definition
Syntax Example
Copyright 2012 DCDMC All Rights Reserved.
1. Data Types
1. Data Types
Templates used to describe data objects. Data objects are instances of data types. Further divided into elementary, reference and complex types. There are predefined (built-in) data types or can be defined locally in the program. Do not use any memory space for work data.
Predefined elementary types are the smallest indivisible unit of types. They are data types which are predefined in the R/3 System Kernel. They can be grouped as fixed length variable length
Syntax Forms TYPES { {dtype[(len)] TYPE abap_type [DECIMALS dec]} | {dtype TYPE abap_type [LENGTH len] [DECIMALS dec]} }. Example TYPES: text10 TYPE c LENGTH 10, text20 TYPE c LENGTH 20, result TYPE p LENGTH 8 DECIMALS 2.
9 CONSULTING TECHNOLOGY OUTSOURCING
C
D F I N P T X String xstring
Character Date
Floating Point
Integer Numeric Text
Packed Decimal
Time Hexadecimal Variable-length Variable-length Hexadecimal
1 16 bytes
6 characters 1 65535
Variable
Variable
CONSULTING TECHNOLOGY OUTSOURCING
1. Fixed-Length Elementary Types: There are eight predefined types in ABAP with fixed length: A. Predefined Character-like types: 1. 2. 3. 4. Character (C), Numeric character (N), Date (D), Time (T).
C. Predefined Numeric types: 1. 2. 3. Integer (I), Floating-point number (F) Packed number (P).
11 CONSULTING TECHNOLOGY OUTSOURCING
Syntax: Types<t>[<length>]<<type>[<decimals>]
Example: TYPES: NUMBER TYPE I. DATA: NO_FLIGHTS TYPE NUMBER You use the TYPES statement to create elementary data types and structured data types. You can use data types defined by the TYPES statement in the same way you use predefined data types for declaring data objects.
Used for grouping together work areas that logically belong together.
Example TYPES: BEGIN OF street_type, name TYPE c LENGTH 40, no TYPE c LENGTH 4, END OF street_type. TYPES: BEGIN OF address_type, name TYPE c LENGTH 30, street TYPE street_type, BEGIN OF city, zipcode TYPE n LENGTH 5, name TYPE c LENGTH 40, END OF city, END OF address_type. TYPES zipcode_type TYPE address_type-cityzipcode.
Syntax: TYPES BEGIN OF struc_type. ... TYPES comp ... TYPES comp TYPE struc_type BOXED. INCLUDE {TYPE|STRUCTURE} ... ... TYPES END OF struc_type.
Syntax: TYPES dtype { {TYPE tabkind OF [REF TO] type} | {LIKE tabkind OF dobj} } [tabkeys] [INITIAL SIZE n].
Syntax TYPES dtype { {TYPE REF TO type} | {LIKE REF TO dobj} }. Example INTERFACE i1. ... ENDINTERFACE. CLASS c1 DEFINITION. PUBLIC SECTION. INTERFACES i1. ENDCLASS. TYPES: iref TYPE REF TO i1, cref TYPE REF TO c1, dref TYPE REF TO iref.
2. Object types
2. Object Types
Instances of types. Take up memory space Divided into Classes and Interfaces. Contain the above data types and functions. Define which data types and which functions an object contains. Not predefined, instead must be defined in the program or in the class library.
Chained Statements
Successive statements that have the same string segment can be combined to form a single chained statement To do so, you specify the identical starting segment once and conclude it with a colon (:), the remaining segments are then listed, separated by commas (,) and concluded with a period (.) At runtime, a chained statement is treated like an equivalent sequence of individual ABAP statements
Example
TYPE C, TYPE I, TYPE P DECIMALS 2 VALUE 1.50. TYPE N,
Reference
Sap Library
Thank You.