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

Problem in Error Message

Former Member
0 Likes
552

Hi Abappers,

I have coded as

LOOP AT lt_toa01 INTO ls_toa01.

INSERT INTO toa01 VALUES ls_toa01.

IF sy-subrc NE 0.

MESSAGE ID 'ZIXMESSAGE' TYPE 'E' NUMBER '000'.

CONTINUE.

WRITE:/ ls_toa01-mandt,

ls_toa01-sap_object,

ls_toa01-object_id,

ls_toa01-archiv_id,

ls_toa01-arc_doc_id,

ls_toa01-ar_object,

ls_toa01-ar_date,

ls_toa01-del_date,

ls_toa01-reserve.

ENDIF.

CLEAR ls_toa01.

ENDLOOP.

Now, when the duplicate record exist in the database, it gives the error message as Duplicate entry.

and comes out of the program.

I want to do that if there are 100 records, and 51 st is the duplicate entry, then it list the 51st record and continue to upload the remaining records from the internal table to the Database table.

How to do this?

Please reply.

Regards,

Rahul

4 REPLIES 4
Read only

Former Member
0 Likes
504

first of all get all the entries from your table ..

read if an entry already exists .. if not then only append .

LOOP AT lt_toa01 INTO ls_toa01.

read table it_toa01 with key ....

if sy-subrc = 0.

write 😕 it_toa01-field1 ...

sy-tabix.

else.

INSERT INTO toa01 VALUES ls_toa01.

.

.

.

.endif.

Read only

0 Likes
504

Hi Srinivas,

This is of the case when the test data contains the duplicate record.

What if the database table contains a record previously and test data also has that one.

Please clearify.

Regards,

Rahul

Read only

0 Likes
504

in such cases also this will filter the record and will not

update the record ..

Read only

0 Likes
504

Hello,

Its not working.

Its replacing the database record with the new one.

Please suggest other solution with error msg

Regards,

Rahul