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 DATA IN DB TABLE PROBLEM

vallamuthu_madheswaran2
Active Contributor
0 Likes
1,356

Hi Friends.

p_i_zproj TYPE ty_i_zproj.

ty_i_zproj TYPE TABLE OF zproj_cost.

-


> INSERT zproj_cost FROM table p_i_zproj.

COMMIT WORK.

I got a following dump to execute the insert query.

-


Error analysis

An exception occurred. This exception is dealt with in more detail below

. The exception, which is assigned to the class 'CX_SY_OPEN_SQL_DB', was

neither

Since the caller of the procedure could not have expected this exception

to occur, the running program was terminated.

The reason for the exception is:

Thanks & Regards,

Vallamuthu.M

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,313

1) This error you get when you are updating records which already exists(Key fields exists).SO try using:

Accepting Duplicate Keys addition with Insert statement.

2) Check the structure on the internal table you are uploading.

Regards,

Gurpreet

11 REPLIES 11
Read only

Former Member
0 Likes
1,313

Hi,

INSERT zproj_cost FROM table p_i_zproj.

in above statement p_i_zproj is considered as work area not an internal table. So try after declare it is an internal table.

Read only

0 Likes
1,313

Its not a work area, i used that syntax also bot it shows the error "its not a work area"

Read only

Former Member
0 Likes
1,314

1) This error you get when you are updating records which already exists(Key fields exists).SO try using:

Accepting Duplicate Keys addition with Insert statement.

2) Check the structure on the internal table you are uploading.

Regards,

Gurpreet

Read only

0 Likes
1,313

INSERT zproj_cost FROM TABLE p_i_zproj ACCEPTING DUPLICATE KEYS.

but i got got the same error.

Read only

0 Likes
1,313

Just check the structure you are using,Check the sequence of the fields in internal table and Ztable.

Just debug and check the format of data that your internal table is Holding at runtime.

Regards,

Gurpreet

Read only

Former Member
0 Likes
1,313

Hi Madheswaran,

because of the duplicate entrins of the same KEY its getting dump

so instead of INSERT use the MODIFY satement.

of if you want use the INSERT you have use the "ACCEPTING DUPLICATE" as well for not getting dump.

Thanks!

Read only

Former Member
0 Likes
1,313

Hi,

Could you try with following logic:

types: ty_zproj type zproj_cost.

data: wa_zproj type ty_zproj,

it_zproj type standard table of ty_zproj.

INSERT zproj_cost FROM wa_zproj. "For single record

or

INSERT zproj_cost FROM TABLE it_zproj. "Mass insert

If key fields are duplicating, then add extention 'ACCEPTING DUPLICATE KEYS' which is not advisable.

By using MODIFY statement rather than INSERT, new values will be updated is key fields exist. Otherwise new record will be created in table.

Regards,

Prasanth

Read only

Former Member
0 Likes
1,313

Hi Vallamuthu,

I guess there is structure mismatch between zproj_cost and p_i_zproj.

Regards,

Jaya rama kumar

Read only

Former Member
0 Likes
1,313

This message was moderated.

Read only

Former Member
0 Likes
1,313

Hi,

It may be because of duplicate entries or might be due to structure mismatching.

Try it by declaring it as TYPE STANDARD TABLE and use MODIFY instead of INSERT.

Regards

Read only

vallamuthu_madheswaran2
Active Contributor
0 Likes
1,313

Solved own. it's a basis problem