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

Persistence Class causes Excpetion when commiting work

former_member616330
Discoverer
0 Likes
1,747

Hello folks,
today I tried to implement my first persistence class.
Reading data from the database works flawlessly but updating rows is not working.
After using the set_attribute method of the persistence object I immediately commit the work

lo_persistence->set_creation_date( i_creation_date = sy-datlo ).
COMMIT WORK.

But unfortunately I get an CX_OS_DB_UPDATE exception.

--------Error--------
"UNCAUGHT_EXCEPTION" CX_OS_DB_UPDATE
"ZCB_ZTESTMFSERIALIZE=====CP" bzw. ZCB_ZTESTMFSERIALIZE=====CM00F
"MAP_SAVE_TO_DATABASE"
--------Environment-------- SAP kernel....... 742
 Created on....... Nov 26 2014 20:36:14
 Created at....... Linux GNU SLES-11 x86_64 cc4.3.4 use-pr141031
 Database version Sybase ASE 15.7.0.1300
 Patch level....... 28
 Patch text.......
 Database............. 15.7
 SAP database version. 742
 Operating system... Linux 2.6, Linux 3

--------Info on where terminated--------
The termination occurred in ABAP program "ZCB_ZTESTMFSERIALIZE=====CP",
 in "MAP_SAVE_TO_DATABASE". The main program
was "RSM13000".
In the source code, the termination point is in line 169 of (Include)
program "ZCB_ZTESTMFSERIALIZE=====CM00F".
The program "ZCB_ZTESTMFSERIALIZE=====CP" was started in the update
 system.

--------Source code extract--------
 166 * * DB Updates
 167   update ZTESTTABLE FROM TABLE DB_UTB_ZTESTTABLE.
 168   if SY-SUBRC <> 0.
>>>>     raise exception type CX_OS_DB_UPDATE
 170       exporting
 171         TABLE = 'ZTESTTABLE'.
 172   endif.

Here are some class information:

Friends: ZCB_ZTESTMFSERIALIZE
persistence mapping was simply adding all available fields and using defaults.
When activating the class I accept creating the managing class.

I did not find any help in the knowledge base or in any google search results.
I hope you can help me.
Please ask if you have further questions

Thank you very much and kind regards!

Hello folks,
today I tried to implement my first persistence class.
Reading data from the database works flawlessly but updating rows is not working.
After using the set_attribute method of the persistence object I immediately commit the work

lo_persistence->set_creation_date( i_creation_date = sy-datlo ).
COMMIT WORK.

But unfortunately I get an CX_OS_DB_UPDATE exception.

--------Error--------
"UNCAUGHT_EXCEPTION" CX_OS_DB_UPDATE
"ZCB_ZTESTMFSERIALIZE=====CP" bzw. ZCB_ZTESTMFSERIALIZE=====CM00F
"MAP_SAVE_TO_DATABASE"
--------Environment-------- SAP kernel....... 742
 Created on....... Nov 26 2014 20:36:14
 Created at....... Linux GNU SLES-11 x86_64 cc4.3.4 use-pr141031
 Database version Sybase ASE 15.7.0.1300
 Patch level....... 28
 Patch text.......
 Database............. 15.7
 SAP database version. 742
 Operating system... Linux 2.6, Linux 3

--------Info on where terminated--------
The termination occurred in ABAP program "ZCB_ZTESTMFSERIALIZE=====CP",
 in "MAP_SAVE_TO_DATABASE". The main program
was "RSM13000".
In the source code, the termination point is in line 169 of (Include)
program "ZCB_ZTESTMFSERIALIZE=====CM00F".
The program "ZCB_ZTESTMFSERIALIZE=====CP" was started in the update
 system.

--------Source code extract--------
 166 * * DB Updates
 167   update ZTESTTABLE FROM TABLE DB_UTB_ZTESTTABLE.
 168   if SY-SUBRC <> 0.
>>>>     raise exception type CX_OS_DB_UPDATE
 170       exporting
 171         TABLE = 'ZTESTTABLE'.
 172   endif.

Here are some class information:

Friends: ZCB_ZTESTMFSERIALIZE
persistence mapping was simply adding all available fields and using defaults.
When activating the class I accept creating the managing class.

I did not find any help in the knowledge base or in any google search results.
I hope you can help me.
Please ask if you have further questions

Thank you very much and kind regards!

2 REPLIES 2
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,623

The short dump indicates an error with UPDATE. The only reason I am aware of is that it leads to breaking a unique key constraint. In debug, what do you see in DB_UTB_ZTESTTABLE, and what contains the database table?

Read only

former_member616330
Discoverer
0 Likes
1,623

Helllo Sandra,
thanks for your reply.
Checking the DB_UTB_ZTESTTABLE gave me the problem, but unfortunately not the answer.
My table contains the field "CLIENT" of type "MANDT" which is, in this case, not used to differ between our system but to safe from which client the information came.
In my persistence - table mapping within the CL_CLASS I am not able to map the "CLIENT" field. So it does not contain the field as attribute, and it is not given to the DB_UTB_ZTTESTTABLE. But "CLIENT" is part of the primary key and as I want to update the record it does not find any matching in the database table.

So I need to know how to add the client field to the persistence - table mapping within my CL_CLASS.

My key mapping in the CL_Class is complete.

The CLIENT field is not available to add to the mapping: