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

Database record duplication error

Former Member
0 Likes
1,815

Dear all,

I am getting error "SAPSQL_ARRAY_INSERT_DUPREC" "CX_SY_OPEN_SQL_DB" for Transaction MD01 in procedure "INSERT_MDSBI_IN_MDSB" "(FORM)".

I have checked the same. But, eventhough the record with same key is not exists in the database table, system gives this error.

Can anyone pls help me on this?

Thanks a lot in advance.

14 REPLIES 14
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,550

Hi,

Try it this way:-


      TRY.
          INSERT <DB_TABLE> FROM TABLE <INTERNAL_TABLE>.
          IF sy-subrc <> 0.
            MESSAGE e001(zmm).
          ENDIF.
        CATCH cx_sy_open_sql_db.
              MESSAGE e001(zmm).
         ENDCASE.
      ENDTRY.

Hope this helps you.

Regards,

Tarun

Read only

0 Likes
1,550

Hi Tarun , the error is in MD01.

Read only

Former Member
0 Likes
1,550

yes, error is for 'MD01', so we cannot modify the code.

Read only

Former Member
0 Likes
1,550

Can anyone give me any idea to resolve this ?

Read only

Former Member
0 Likes
1,550

Statement which gives error is

INSERT MDSB

FROM TABLE MDSBI.

Read only

0 Likes
1,550

Hi,

It seems like the error is due to duplicate primary key. Can you please double check if an entry already exists in RESB for the key in MDSBI? Put a break point at that stmt and check it out.

Regards,

Ganga

Read only

Former Member
0 Likes
1,550

Yes, I have checked the same. But, there is no entry with same key in RESB; still it gives error.

Read only

0 Likes
1,550

Check if MDSBI internal table contains multiple entries with same primary key.

Read only

0 Likes
1,550

Hi,

There is an OSS note "138108". Please check. Symptom is

Symptom

Material requirements planning, master production scheduling: Termination with "SAPSQL_ARRAY_INSERT_DUPREC" in program SAPLM61U, Include LM61UF20, FORM routine INSERT_MDSBI_IN_MDSB.

Long-term planning: Termination with "SAPSQL_ARRAY_INSERT_DUPREC" in program SAPLM61U, Include LM61UF20, FORM routine INSERT_MDSMI_IN_MDSM.

Hope this helps you!!!

Regards,

Ganga

Read only

Former Member
0 Likes
1,550

We are using ECC6.0. Is this note applicable for this too?

Read only

0 Likes
1,550

This is applicable till 4.6C. As per your problem, it seems like this is not corrected in ECC6.0. May be team from SAP can help us.

Ganga

Read only

0 Likes
1,550

i guess you can statement as : "Insert dbtab from itab accepting duplicate keys" ....

use it one and check i think it should work fine

regards,

Shravanthi

Read only

0 Likes
1,550

It's a standard program...Not custom development !!!

Read only

cervantes_nicols
Participant
0 Likes
1,550

The problema is "...when array inserts to view MDSB failed with SAPSQL_ARRAY_INSERT_DUPREC. The underlying table RESB had a number of fields on the database NOT NULL but without default. Some of these fields were missing in the projection view MDSB so each insert via this view resulted in a SQL515 erroneously displayed as duplicate key error...

Solution

Now this new dbsl will correct only the misleading error message. The inserts will still fail.

If you encounter such a problem you should run a forced conversion via SE14 (SE14, edit table, Extras->Forced Conversion). This will recreate the table and all the NOT NULL columns will be defined with a default bound. So the SQL515 won't occur anymore.

Please be aware: if the table is huge then the conversion will take a longer time.

Reference Note 1340371