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 is not working- going to dump

Former Member
0 Likes
634

Hi

Insert command is not working.It's going to dump.pls help me

data :      I_ORG_DATA2  TYPE STANDARD TABLE OF YAU_ORG_STRUC,

SELECT *
      INTO TABLE I_ORG_DATA
      FROM YAU_ORG_STRUC.
    IF SY-SUBRC EQ 0.
      DELETE YAU_ORG_STRUC FROM TABLE I_ORG_DATA.
      COMMIT WORK.
      IF SY-SUBRC EQ 0.
        INSERT YAU_ORG_STRUC FROM TABLE I_ORG_DATA2.  
      endif.
endif.

Dump

The ABAP/4 Open SQL array insert results in duplicate database records.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
590

Hi Kumar,

The reason this is not working is cuz you are trying to insert duplicate primary keys into the table.

Looking at your code, you are deleting I_ORG_DATA and inserting I_ORG_DATA2

I_ORG_DATA2 has other data (already present in table) than I_ORG_DATA.

SELECT *
      INTO TABLE I_ORG_DATA
      FROM YAU_ORG_STRUC.
    IF SY-SUBRC EQ 0.
      DELETE YAU_ORG_STRUC FROM TABLE I_ORG_DATA. "You are deleting I_ORG_DATA
      COMMIT WORK.
      IF SY-SUBRC EQ 0.
        INSERT YAU_ORG_STRUC FROM TABLE I_ORG_DATA2. "You are inserting I_ORG_DATA2
      endif.
endif.

Regards,

Jovito.

Hi

Insert command is not working.It's going to dump.pls help me

data :      I_ORG_DATA2  TYPE STANDARD TABLE OF YAU_ORG_STRUC,

SELECT *
      INTO TABLE I_ORG_DATA
      FROM YAU_ORG_STRUC.
    IF SY-SUBRC EQ 0.
      DELETE YAU_ORG_STRUC FROM TABLE I_ORG_DATA.
      COMMIT WORK.
      IF SY-SUBRC EQ 0.
        INSERT YAU_ORG_STRUC FROM TABLE I_ORG_DATA2.  
      endif.
endif.

Dump

The ABAP/4 Open SQL array insert results in duplicate database records.

3 REPLIES 3
Read only

former_member196280
Active Contributor
0 Likes
590

The dump is mainly because of duplication. Make sure the primary key key field are not same.

Regards,

SaiRam

Read only

Former Member
0 Likes
590

use ..INSERT YAU_ORG_STRUC FROM TABLE TABLE I_ORG_DATA2 ACCEPTING DUPLICATE KEYS.

Read only

Former Member
0 Likes
591

Hi Kumar,

The reason this is not working is cuz you are trying to insert duplicate primary keys into the table.

Looking at your code, you are deleting I_ORG_DATA and inserting I_ORG_DATA2

I_ORG_DATA2 has other data (already present in table) than I_ORG_DATA.

SELECT *
      INTO TABLE I_ORG_DATA
      FROM YAU_ORG_STRUC.
    IF SY-SUBRC EQ 0.
      DELETE YAU_ORG_STRUC FROM TABLE I_ORG_DATA. "You are deleting I_ORG_DATA
      COMMIT WORK.
      IF SY-SUBRC EQ 0.
        INSERT YAU_ORG_STRUC FROM TABLE I_ORG_DATA2. "You are inserting I_ORG_DATA2
      endif.
endif.

Regards,

Jovito.