Get Example source ABAP code based on a different SAP table
ABAP_NATIVE_SQL - 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.
Latest notes: Unlike Native SQL, AB_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 AB-SQL interface can also execute platform-independent conversions between incompatible data types if they correspond to the conversion ru les in ABAP. For example, see the assignment rules> for reads. ABAP_HINT_END