Application Development 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: 

ABAP/4 Open SQL array insert results in duplicate databaserecordsfor pk13

Former Member
0 Kudos

Hi Experts, when I am working with pk13n tranaction iam getting an error message stating that update was terminated by user. when i am checking with st22 it gives the following message. please give the solution , iam sending the code as well.

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught

in

procedure "SAVE_DATA" "(FORM)", nor was it propagated by a RAISING clause.

Since the caller of the procedure could not have anticipated that the

exception would occur, the current program is terminated.

The reason for the exception is:

If you use an ABAP/4 Open SQL array insert to insert a record in

the database and that record already exists with the same key,

this results in a termination.

(With an ABAP/4 Open SQL single record insert in the same error

situation, processing does not terminate, but SY-SUBRC is set to 4.) please find the below code please give the solution for this error message.

1 *eject

2 *----


*

3 * Verbuchen der Daten *

4 *----


*

5 FORM SAVE_DATA.

6

7 DATA: lf_menge LIKE ekpo-menge VALUE 0, "717464

8 lf_netwr LIKE ekpo-netwr VALUE 0.

9

10 * Einteilungen löschen --> Array Delete aus Tabelle DEKET

11 DESCRIBE TABLE DEKET LINES SY-TFILL.

12 IF SY-TFILL GT 0.

13 DELETE EKET FROM TABLE DEKET.

14 IF SY-SUBRC NE 0.

15 MESSAGE A865.

16 ENDIF.

17 EKET_DELETE = EKET_DELETE + SY-DBCNT.

18 REFRESH: DEKET.

19 CLEAR : DEKET.

20 ENDIF.

21

22 * Einteilungen hinzufügen --> Array Insert aus Tabelle IEKET

23 DESCRIBE TABLE IEKET LINES SY-TFILL.

24 IF SY-TFILL GT 0.

>> INSERT EKET FROM TABLE IEKET.

26 IF SY-SUBRC NE 0.

27 MESSAGE A864.

28 ENDIF.

29 EKET_INSERT = EKET_INSERT + SY-DBCNT.

30 REFRESH: IEKET.

31 CLEAR : IEKET.

32 ENDIF.

33

34 * Check whether the qty in EKPO-MENGE is correct: note 717464

35 SELECT SUM( menge ) FROM eket INTO lf_menge

36 WHERE ebeln = ekpo-ebeln

37 AND ebelp = ekpo-ebelp.

38 IF sy-subrc = 0 AND ekpo-menge <> lf_menge.

39 IF ekpo-ktmng <> 0.

40 refe1 = ekpo-zwert * lf_menge / ekpo-ktmng.

41 ELSE.

42 refe1 = ekpo-zwert * lf_menge / 1000.

43 ENDIF.

44 IF refe1 > maxwert.

2 REPLIES 2

Former Member
0 Kudos

Hi,

Well I don't know why you have duplicates, this is a functionnal issue. But you get the dump due the the message number 864 that triggers the abend... Changing the message type to 'E', 'S' or 'I' will prevent the dump but I guess this message has a good reason to be

Kr,

Manu.

Sm1tje
Active Contributor
0 Kudos

This is a standard transaction that should basically work. Did you do some additional developments on this? User exit, BAdI, modification?