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

Data Consistency

Former Member
0 Likes
1,093

There are three table it_a, it_b, It_c in the Sap DB, I have to keep the consistency of all the records. If there’s an error occurs, which may be trigger by the program, or by the independency,

How can I realize it, Very thanks in advance..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
927

Hi, F.J. Brandelik said is right, if you want to maintanence tables manually, the critical point is you should update the serveral tables in a LUW.

You'd better to lock the table, use the ENQUEUE_XXX and DEQUEUE_XXX.

And some FM is also helpful, TRANSACTION_BEGIN, TRANSACTION_END and other TRANSACTION_XXXX. You can write code between the BEGIN and END. They will be runned in a LUW.

7 REPLIES 7
Read only

christian_wohlfahrt
Active Contributor
0 Likes
927

Hi!

Best way to have consistent data: don't change any table independent of the others.

If you talk about standard tables, use only standard functions to add / change / delete data (like transactions, IDOC or BAPI).

If you design own tables, write a function module (or method in OO) which updates all three tables correctly. Then all updates have to be done with this function module.

Regards,

Christian

Read only

0 Likes
927

And make sure you do your updates in logical unit of work.

This allows you to either update all 3 or rollback if any of the 3 fails....

Enjoy

Read only

Former Member
0 Likes
928

Hi, F.J. Brandelik said is right, if you want to maintanence tables manually, the critical point is you should update the serveral tables in a LUW.

You'd better to lock the table, use the ENQUEUE_XXX and DEQUEUE_XXX.

And some FM is also helpful, TRANSACTION_BEGIN, TRANSACTION_END and other TRANSACTION_XXXX. You can write code between the BEGIN and END. They will be runned in a LUW.

Read only

0 Likes
927

hello, zhenglin gu

I see your message, and it's helpful to me,

But to the FM TRANSACTION_BEGIN ETC. I can't find any document, may you kindly give me soem detailed information, or some samples, thanks very much.

Read only

Former Member
0 Likes
927

hello, zhenglin gu

I see your message, and it's helpful to me,

But to the FM TRANSACTION_BEGIN ETC. I can't find any document, may you kindly give me soem detailed information, or some samples, thanks very much.

Read only

Former Member
0 Likes
927

Hi, sorry for the slowly reply.

These FMs is actually start a LUW, launch it, or rollback it.

The usage of it is list as following:

1. Start with the FM TRANSACTION_BEGIN

2. write your code for table populate

3. if some error occur, call FM TRANSACTION_ABORT

4. when you ready to start the DataBase manipulate, call FM TRANSACTION_END

These are the mainly steps to use this mechanism.

Hope it will be helpful

In addition, about the sample code, you can reference to some BAPI, SAP using these FM in their standard BAPI, like BAPI_REQUISITION_CREATE.

Message was edited by: zhenglin gu

Read only

0 Likes
927

very thanks.