Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Insert into a Table not in Dictionary

former_member284942
Discoverer
0 Likes
563

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?

1 REPLY 1
Read only

Tomas_Buryanek
Product and Topic Expert
Product and Topic Expert
0 Likes
509

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

-- Tomas --