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

About commit and rollback

Former Member
0 Likes
658

Hi All,

I am writing one program to post two FI documents simultaneously.Either post all or nothing.Fo rthat i have created Z one function module in update task and calling the function module two time in update task. After that i am writing the commit work.If second one contains error then it is posting first document but giveing updation termination for the second one. But i dont want to post any of the document if anyone contains error. Please suggest me .

How can i proceed further.

Thanks a lot

Lincon

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
571

Hi Lincon,

How are you posting the FI documents? Using a BAPI or ?!? In case you are using a BAPI, then please check in the import parameters for an option like NO_COMMIT, if it exists, please pass 'X' to it. What it will ensure is the DB update wont happen until you call BAPI_TRANSACTION_COMMIT, on second thoughts, if you are using a BAPI, it wont write to DB until you call the above FM. Hence do let me know whether u are using BAPI's and if not try finding a suitable BAPI from transaction BAPI.

Regards,

Aditya

4 REPLIES 4
Read only

Former Member
0 Likes
572

Hi Lincon,

How are you posting the FI documents? Using a BAPI or ?!? In case you are using a BAPI, then please check in the import parameters for an option like NO_COMMIT, if it exists, please pass 'X' to it. What it will ensure is the DB update wont happen until you call BAPI_TRANSACTION_COMMIT, on second thoughts, if you are using a BAPI, it wont write to DB until you call the above FM. Hence do let me know whether u are using BAPI's and if not try finding a suitable BAPI from transaction BAPI.

Regards,

Aditya

Read only

0 Likes
571

Hi Aditya,

No i am using the function module AC_DOCUMENT_DIRCT_INPUT for posting the FI document. Actually i am calling this function module in the Z function module in update task.I am calling the function module in the Z report two times and after that i am doing the commit work.So if error is there in second one it is posting first one and Termination for second one. So can i rollback the work after the commit ar any way to do it.

Please suggest.

Thanks

Lincon

Read only

0 Likes
571

Hi Lincon,

What you can do is call both FMs in TESTRUN (I_TESTRUN = 'X') mode and only if both are successful then call them in actual mode. Hence in this way you can prevent a false update.

-Adi

Read only

0 Likes
571

Hi Aditya,

I have cotrolled by checking the test run flag. I solved my problem.

Thank you very much.

Lincon