2016 Mar 10 9:13 AM
I have a scenario where I have a table of all the ABAP Dictionary Types.
Dictionary types include (ACCP,CHAR,CLNT,CUKY,DF16_DEC,DF34_DEC,DF16_RAW,DF34_RAW,DATS,DEC,FLTP,INT1,INT2,INT4,INT8,LANG,
NUMC,PREC,RAW,RAWSTRING,SSTRING,STRING,TIMS,UNIT,LCHR)
The Table doesn't exist in dictionary but it exists in the underlying Database.(DB2)
I want to insert data into the table.
As the table doesn't exist in dictionary,I cannot use open SQL.
As per my knowledge,I have to use native SQL to insert into such table.
The problem is when I use native SQL ,I am getting many datatype mismatch exceptions.
Is there a way where I can insert data into such tables without any issue?
I have a scenario where I have a table of all the ABAP Dictionary Types.
Dictionary types include (ACCP,CHAR,CLNT,CUKY,DF16_DEC,DF34_DEC,DF16_RAW,DF34_RAW,DATS,DEC,FLTP,INT1,INT2,INT4,INT8,LANG,
NUMC,PREC,RAW,RAWSTRING,SSTRING,STRING,TIMS,UNIT,LCHR)
The Table doesn't exist in dictionary but it exists in the underlying Database.(DB2)
I want to insert data into the table.
As the table doesn't exist in dictionary,I cannot use open SQL.
As per my knowledge,I have to use native SQL to insert into such table.
The problem is when I use native SQL ,I am getting many datatype mismatch exceptions.
Is there a way where I can insert data into such tables without any issue?
2016 Mar 10 9:58 AM
Yes there is.
You just need to proper match ABAP data type to your DB (DB2) data type. For some you will need conversion (you can use SQL "conversions"/"functions" or convert data in ABAP before inserting).
For example SAP date format to SQL:
INSERT INTO table_name
( DATE_FIELD )
VALUES
( to_date(:sy-datum, 'YYYYMMDD'))
Here is nice list of types compatibility:
Native SQL for DB2 Common Server - ABAP Programming (BC-ABA) - SAP Library
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |