Ansicht
Dokumentation
ABENNATIVE_SQL_TYPE_MAPPING - NATIVE SQL TYPE MAPPING
ABAP Short Reference RFUMSV00 - Advance Return for Tax on Sales/PurchasesThis documentation is copyright by SAP AG.
- Mapping of ABAP Types
In Native SQL, data can be transferred from the database to ABAP data objects in reads and vice versa in writes.
- In ADBC, ABAP data objects are bound using data references.
- ABAP data objects are specified as host variables after EXEC SQL.
In assignments between ABAP data objects and fields in database tables, the ABAP data objects are bound to the database fields using the Native SQL interface. ABAP data objects should usually only be bound to suitable database fields. The following tables show which elementary ABAP types match which HANA types, using the SAP HANA database as an example. There are similar assignments for other database systems.
Numeric Types
ABAP Type | HANA Type |
b | SMALLINT |
s | SMALLINT |
i | INTEGER |
int8 | BIGINT |
p, length leng with dec decimal places | DECIMAL, length 2len-1 with dec decimal places |
decfloat16 | SMALLDECIMAL, length 16 |
decfloat34 | DECIMAL, length 34 |
f | DOUBLE |
Character-Like Types
ABAP Type | HANA Type |
c, length len | NVARCHAR, length len |
string | NCLOB |
n, length len | NVARCHAR, length len |
Byte-Like Types
ABAP Type | HANA Type |
x, length len | VARBINARY, length len |
xstring | BLOB |
Date Types, Time Types, and Time Stamp Types
ABAP Type | HANA Type |
d | DATE; \lbr NVARCHAR, length 8 |
t | TIME; \lbr NVARCHAR, length 6 |
utclong | TIMESTAMP |
If the data types match, the content can be passed unchanged without being checked. In all other cases, conversions are necessary. These conversions and the necessary checks are performed by the Native SQL interface. The conversions take place in the platform-dependent part (Client Library) of the Native SQL interface, and the following problems can occur:
- Unexpected conversion results
- Cutting off or padding of values for character-like and byte-like types
- Conversion rules different to those in ABAP
- SQL errors that raise exceptions
For this reason, conversions in the Native SQL interface should be avoided if possible. This is particularly relevant for the ABAP types n, d, and t and decimal floating point numbers.
Note
Unlike Native SQL, respects the column types of database tables and views defined in the ABAP Dictionary. These are based on the built-in data types of the ABAP Dictionary, which can all be mapped to a built-in ABAP type. Therefore, the interface can also execute platform-independent conversions between incompatible data types if they correspond to the conversion rules in ABAP. For example, see the assignment rules for reads.
Example
The example shows that if the data of a column with type NUMC is assigned in Native SQL to a host variable with the ABAP type n that is too short, it is truncated on the right. The rule that is applied in , however, passes the data right-aligned and truncated on the left.
The result in an SAP HANA database is:
ABAP SQL: 00123
Native SQL 00000
Example
The example shows that if a host variable with ABAP type n that is too long is assigned to a column with type NUMC in Native SQL, an exception is raised. The conversion rule that is applied in , however, passes the data right-aligned and truncated on the left.
The result in an SAP HANA database is:
ABAP SQL:
2222233333
Native SQL
An SQL error has occurred: inserted value too large for column
rdisp/max_wprun_time - Maximum work process run time TXBHW - Original Tax Base Amount in Local Currency
This documentation is copyright by SAP AG.
Length: 8126 Date: 20240417 Time: 223903 sap01-206 ( 78 ms )