Documentation View

We are hiring and constantly growing! Have a look through our vacancies to find the right role for you!

ABAPCREATE_DATA_BUILT_IN - CREATE DATA BUILT IN

ABAPCREATE_DATA_BUILT_IN - CREATE DATA BUILT IN

ROGBILLS - Synchronize billing plans   rdisp/max_wprun_time - Maximum work process run time  
This documentation is copyright by SAP AG.
SAP E-Book

CREATE DATA, TYPE abap_type

Short Reference



CREATE DATA dref $[area_handle$]
                 TYPE ${abap_type$|(name)$}
                      $[LENGTH len$] $[DECIMALS dec$].

Effect

Creation of a data object with an explicitly specified data type. For the data type, all built-in data types, apart from b and s, can be used that are more specific than the static type of dref or are identical to it. The name of the type can be specified as follows:

  • abap_type
Direct static specification as abap_type.
  • (name)
Specification as the content of a character-like data object name without case-sensitivity. The following can be specified for name:
  • Literal or constant

    If the data object name is specified as a character literal or as a constant, it can be evaluated statically and the specified type is recognized as the used object.

  • Variable

    If the data object name is specified as a variable, it is specified only dynamically and the content is not evaluated statically.

When the statement is executed, name is not evaluated until runtime (in both cases).

For the ABAP types c, n, p, and x, the length of the data type dtype can be determined by specifying a numeric data object len after the addition LENGTH, which, when the statement is executed, contains a value within the length range specified for the respective type. If the addition LENGTH is not specified, the standard length from the table is used. For all other ABAP types, the length is determined by the value in the table and the addition LENGTH cannot be specified.

For the ABAP type p, the number of decimal places can be determined by specifying a numeric data object dec after the addition DECIMALS. If DECIMALS is specified, the same applies as to the statement TYPES. If the addition DECIMALS is not specified, no decimal places are created. For the decimal separator to be respected in operations with packed numbers, the program attribute fixed point arithmetic must be set. Otherwise, the addition DECIMALS only affects the formatting of dynpros and the statement WRITE $[TO$]. For all other ABAP types and if name is specified dynamically, the addition DECIMALS is not allowed.

Note

If a data type abap_type is used, the instance operator NEW acts like the statement CREATE DATA dref TYPE abap_type and can be used in general expression positions. The dynamic specification of name is not possible here.

Example

Creation of an anonymous data object of the type of a packed number with length specification and decimal places. Since the static data type of the data reference variable is generic, dereferencing is only possible by assignment to a field symbol.

Creating Elementary Data Objects






TXBHW - Original Tax Base Amount in Local Currency   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.

Length: 4738 Date: 20221203 Time: 172706     sap01-206 ( 81 ms )