2012 Aug 28 3:09 PM
Hi All,
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 "UPDATE_TABLES" "(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.)
Below is the code:-
DATA: z_subrc_header_pres LIKE sy-subrc,
z_subrc_item_pres LIKE sy-subrc,
z_dbcnt_header_pres LIKE sy-dbcnt,
z_dbcnt_item_pres LIKE sy-dbcnt,
z_subrc_header_wip LIKE sy-subrc,
z_subrc_item_wip LIKE sy-subrc,
z_dbcnt_header_wip LIKE sy-dbcnt,
z_dbcnt_item_wip LIKE sy-dbcnt,
z_subrc_dealitem_txt LIKE sy-subrc,
z_dbcnt_dealitem_txt LIKE sy-dbcnt.
DATA: t_head_wip TYPE TABLE OF /tmw/header_wip,
t_item_wip TYPE TABLE OF /tmw/item_wip,
z_head_wip LIKE LINE OF t_head_wip,
z_item_wip LIKE LINE OF t_item_wip.
LOOP AT t_ztmw_header_pres INTO z_ztmw_header_pres.
MOVE-CORRESPONDING z_ztmw_header_pres TO z_head_wip.
APPEND z_head_wip TO t_head_wip.
ENDLOOP.
LOOP AT t_ztmw_item_pres INTO z_ztmw_item_pres.
MOVE-CORRESPONDING z_ztmw_item_pres TO z_item_wip.
APPEND z_item_wip TO t_item_wip.
ENDLOOP.
*updata pristine tables .
>>>> INSERT /tmw/header_pres FROM TABLE t_ztmw_header_pres. " In this sentence it is showing dump
z_subrc_header_pres = sy-subrc.
z_dbcnt_header_pres = sy-dbcnt.
INSERT /tmw/item_pres FROM TABLE t_ztmw_item_pres.
z_subrc_item_pres = sy-subrc.
z_dbcnt_item_pres = sy-dbcnt.
*update WIP tables
INSERT /tmw/header_wip FROM TABLE t_head_wip.
z_subrc_header_wip = sy-subrc.
z_dbcnt_header_wip = sy-dbcnt.
INSERT /tmw/item_wip FROM TABLE t_item_wip.
z_subrc_item_wip = sy-subrc.
z_dbcnt_item_wip = sy-dbcnt.
*update partner pres and wip tables
INSERT /tmw/part_pres FROM TABLE t_ztmw_part_pres.
z_subrc_part_pres = sy-subrc.
INSERT /tmw/part_wip FROM TABLE t_ztmw_part_pres.
z_subrc_part_wip = sy-subrc.
| DATA: z_subrc_header_pres LIKE sy-subrc, | ||||||
| z_subrc_item_pres LIKE sy-subrc, | ||||||
| z_dbcnt_header_pres LIKE sy-dbcnt, | ||||||
| z_dbcnt_item_pres LIKE sy-dbcnt, | ||||||
| z_subrc_header_wip LIKE sy-subrc, | ||||||
| z_subrc_item_wip LIKE sy-subrc, | ||||||
| z_dbcnt_header_wip LIKE sy-dbcnt, | ||||||
| z_dbcnt_item_wip LIKE sy-dbcnt, | ||||||
| z_subrc_dealitem_txt LIKE sy-subrc, | ||||||
| z_dbcnt_dealitem_txt LIKE sy-dbcnt. | ||||||
| DATA: t_head_wip TYPE TABLE OF /tmw/header_wip, | ||||||
| t_item_wip TYPE TABLE OF /tmw/item_wip, | ||||||
| z_head_wip LIKE LINE OF t_head_wip, | ||||||
| z_item_wip LIKE LINE OF t_item_wip. | ||||||
| LOOP AT t_ztmw_header_pres INTO z_ztmw_header_pres. | ||||||
| MOVE-CORRESPONDING z_ztmw_header_pres TO z_head_wip. | ||||||
| APPEND z_head_wip TO t_head_wip. | ||||||
| ENDLOOP. | ||||||
| LOOP AT t_ztmw_item_pres INTO z_ztmw_item_pres. | ||||||
| MOVE-CORRESPONDING z_ztmw_item_pres TO z_item_wip. | ||||||
| APPEND z_item_wip TO t_item_wip. | ||||||
| ENDLOOP. | ||||||
| *updata pristine tables | ||||||
| INSERT /tmw/header_pres FROM TABLE t_ztmw_header_pres. | ||||||
| z_subrc_header_pres = sy-subrc. | ||||||
| z_dbcnt_header_pres = sy-dbcnt. | ||||||
| INSERT /tmw/item_pres FROM TABLE t_ztmw_item_pres. | ||||||
| z_subrc_item_pres = sy-subrc. | ||||||
| z_dbcnt_item_pres = sy-dbcnt. | ||||||
| *update WIP tables | ||||||
| INSERT /tmw/header_wip FROM TABLE t_head_wip. | ||||||
| z_subrc_header_wip = sy-subrc. | ||||||
| z_dbcnt_header_wip = sy-dbcnt. | ||||||
| INSERT /tmw/item_wip FROM TABLE t_item_wip. | ||||||
| z_subrc_item_wip = sy-subrc. | ||||||
| z_dbcnt_item_wip = sy-dbcnt. | ||||||
| *update partner pres and wip tables | ||||||
| INSERT /tmw/part_pres FROM TABLE t_ztmw_part_pres. | ||||||
| z_subrc_part_pres = sy-subrc. | ||||||
| INSERT /tmw/part_wip FROM TABLE t_ztmw_part_pres. | ||||||
| z_subrc_part_wip = sy-subrc. | ||||||
| Database commit failed. |
2012 Aug 28 3:18 PM
2012 Aug 28 3:29 PM
Hi Sirisha,
Check the existing records in the table. If a record with an existing set of primary keys is inserted, you will get a dump.
Regards,
Gautam.
2012 Aug 28 3:50 PM
I checked it .No duplicate records are there. Other than this is there any other issue for this dump.
2012 Aug 28 4:14 PM
Hi Sirisha,
That is the only issue I can interpret from the dump. I believe it is caused by either of the following:
1. The database table contains records with the same set of key fields which you are trying to insert.
2. The internal table with which you are trying to update the database table contains multiple records with the same set of primary keys. Kindly check this in the debug mode.
Let us know if this helps you.
Regards,
Gautam
2012 Aug 28 4:48 PM
Hey, can you post the DUMP as showed in ST22? (Please post as an image)
2012 Aug 28 5:32 PM
'Hi Sirisha,
Yes the error is due to same record exists.
use MODIFY databse_table FROM wa
MODIFY database_table FROM TABLE internal_table
It is always safe to use modify .. it adds a row if no such record exists ele modifies the record.
In debugging if no duplicate record is there then may be database table contains the same record already.
Thanks
Rahul