abap session – 2_2-data types

Upload: kiriku-jrc

Post on 14-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 ABAP session 2_2-Data Types

    1/8

  • 7/30/2019 ABAP session 2_2-Data Types

    2/8

  • 7/30/2019 ABAP session 2_2-Data Types

    3/8

    1.Fields- A transparent table contains different fields/ columns to allow you to storeand manage data records in a structured way

    2. Data Elements-They are total description of the field. This includes the semanticsas well as the technical attributes of the field. The semantic field attributes includefield documentation and field labels. They are stored directly in the data elementdefinition. In contrast, the technical field attributes data type and length are arespecified with reference to a domain.

    3. Data elements can be used to define programinternal variables or for describingfields in the transparent tables

    4. Where-Used option in the data dictionary allows us to see where (programs,subroutines etc) each of the fields in the table are used

  • 7/30/2019 ABAP session 2_2-Data Types

    4/8

    1. In the ABAP dictionary, a transparent table is an implemented description of the correspondingdatabase table that contains the actual application data.

    1. The fields of the transparent table form the identically-names columns of the

    corresponding DB table.2. Transparent tables- Allows secondary indexes, Can be buffered (SE11->Display Table-

    >technical settings) Heavily updated tables should not be buffered.

    2. Structures-are made of fields from various tables.

    1. Can be used to define data objects in an ABAP Program that either serve as temp datastorage in the program or as an interface for the field transport system between the screenand ABAP Program.

    2. Structures dont have Key Fields like in transparent tables

    3. Structures are composed of components and component types rather than field anddata elements as in trans. Tables.

    4. They are called as components because it is possible to have a structure as a componentof another structure (unlike in trans.tables)

    5. Such nested structures are called as complex structures and structures with simplecomponents are called as flat structures

    3. Cluster tables and Pooled tables: Table pools (pools) and table clusters (clusters) are special table

    types in the ABAP Dictionary1. The data from several different tables can be stored together in a table pool or table

    cluster.

    2. Tables assigned to a table pool or table cluster are referred to as pooled tables or clustertables.

    3. A table pool or table cluster should be used exclusively for storing internal controlinformation (screen sequences, program parameters, temporary data, continuous textssuch as documentation)

    4. Data of commercial relevance is usually stored in transparent tables.

    4. Differences between Pooled and Cluster tables:

    1. Pooled tables:

    1. Should be accessed via primary key or

    2. Should be buffered (SE11->Display Table->technical settings)

    3. No secondary indexes

    4. Select * is Ok because all columns retrieved anyway5. Examples: match codes, look up tables

    2. Cluster Tables:

    1. Should be accessed via primary key - very fast retrieval otherwise very slow

    2. No secondary indexes

    3. Statistical SQL functions (SUM, AVG, MIN, MAX, etc) not supported

    4. Can not be buffered

    5. Examples: BSEG,BSEC

  • 7/30/2019 ABAP session 2_2-Data Types

    5/8

    Data Types can be used to

    define the technical and semantic attributes of a data object

    Define type of actual parameter that is passed in the interface parameterwhen the modularization unit is called

    Type of an input/output field can provide further information in addition totechnical chars, such as the field help and value input help

    Data Objects-

    Are always defined with the DATA keyword

    You can refer to an already defined data object when defining additionalvariables (LIKE option)

  • 7/30/2019 ABAP session 2_2-Data Types

    6/8

    Numeric Types

    You can use type I data for counters, numbers of items, indexes, time periods, and

    so on.You can use type P data for such values as distances, weights, amounts of money,and so on.

    You use type F fields when you need to cope with very large value ranges androunding errors are not critical.

    Using I and F fields for calculations is quicker than using P fields

    Arithmetic operations using I and F fields are very similar to the actual machinecode operations, while P fields require more support from the software.Nevertheless, you have to use type P data to meet accuracy or value rangerequirements.

    Character types

    Of the five non-numeric types, the four types C, D, N, and T are character types

    Fields with these types are known as character fields.Each position in one of these fields takes up enough space for the code of onecharacter.

    Currently, ABAP only works with single-byte codes such as ASCII and EBCDI.

    As of Release 6.10, Web Application Server supports both unicode and non-unicode systems

    Hexadecimal Type

    The remaining non-numeric type - X - always interprets individual bytes inmemory.

    One byte is represented by a two-digit hexadecimal display.

    The fields with this type are called hexadecimal fields.

    In hexadecimal fields, you can process single bits.

    Incomplete data Types The data types that are circled in RED are also called asINCOMPLETE data types because the do not have a standard fixed length. The length of thevariable has to be specified for data object definitions

    http://help.sap.com/saphelp_nw70/helpdata/en/b6/e7d716f46711d195200000e8353423/content.htmhttp://help.sap.com/saphelp_nw70/helpdata/en/b6/e7d716f46711d195200000e8353423/content.htm
  • 7/30/2019 ABAP session 2_2-Data Types

    7/8

    STRING- for character strings

    A string is a sequence of characters with variable length.

    A string can contain any number of alphanumeric characters.

    The length of a string is the number of characters multiplied by thelength required for the internal representation of a single character.

    XSTRING for byte strings

    A byte string is a hexadecimal type with variable length.

    It can contain any number of bytes.

    The length of a byte string is the same as the number of bytes.

    When you create a string as a data object, only a string header is createdstatically.

    This contains administrative information.

    The actual data objects are created and modified dynamically at runtime byoperational statements.

    The initial value of a string is the empty string with length 0.

  • 7/30/2019 ABAP session 2_2-Data Types

    8/8

    ABAP system fields are always available in ABAP programs.

    The runtime system fills them according to context.

    They can then be used in programs to query the system status.

    System fields are variables but you should always treat them as though they wereconstants, and only read them.

    If you change their values, important information for the flow of the program may belost.

    In exceptional circumstances, system fields may be overwritten in an ABAPprogram to control the system for example, SY-LSIND (for navigating to a detaillist).