03-02-2022 7:17 AM
Hello Experts,
We are trying to call multiple bapi's in a below sequence .
1) BAPI_BUS2054_CREATE_MULTI
2) BAPI_ALM_ORDER_MAINTAIN
As per requirement WBS created in step1 in have to pass to step2 and create the work order.
So for that I am committing the transaction after each bapi call.
But now the requirement is either we have to create WBS and Work order or none of them so I am using only one commit transaction at the end of the both the calls. which is not working.
Please let me know how to achieve this functionality.
Thanks in advance
03-02-2022 8:12 AM
That's the limit of LUW model. You must commit the first one to get the WBS number, and if the second BAPI fails you can't rollback the first one.
To avoid this issue, I think the best workaround is to define a restart procedure, to restart the second BAPI. You may reuse either existing mechanisms (bgRFC/tRFC/qRFC for instance), or remember the exact situation via a custom database table and define a restart program...
03-02-2022 8:10 AM
Hello!
You cannot use just a single commit work, because otherwise the 2nd BAPI cannot find the object from the 1st one, since without commit the changes are not pushed to the db (over semplified explaining).
What i'd do is something like:
- BAPI_BUS2054_CREATE_MULTI
- If error, message and exit
- else, commit
- BAPI_ALM_ORDER_MAINTAIN
- if ok, commit
-else, rollback and
BAPI_BUS2054_DELETE_MULTI
I hope i've been clear with what i've in mind.
03-02-2022 2:40 PM
Hi Simone
Thanks for suggestion, the issue after creating the Work order using it we are also creating some other dependent objects on it such as cu design, cu order etc.
So at the final step or after creating work order in further steps if any error happens as per my understand we can't delete the work order once it was commit which will be a problem.
If I am wrong please let me know I am new to this process.
03-02-2022 3:44 PM
Hello sai898.
As suggested by sandra.rossi , you have to find a method to keep track about the flow of object you are creating and give to the users a dashboard to reprocess the missing data or delete the created ones.
For work order, i think you can use the DELETE option (table method) of the BAPI_ALM_ORDER_MAINTAIN or, if you cannot, set the system status.
03-02-2022 8:12 AM
That's the limit of LUW model. You must commit the first one to get the WBS number, and if the second BAPI fails you can't rollback the first one.
To avoid this issue, I think the best workaround is to define a restart procedure, to restart the second BAPI. You may reuse either existing mechanisms (bgRFC/tRFC/qRFC for instance), or remember the exact situation via a custom database table and define a restart program...
03-02-2022 2:45 PM
Hi Sandra ,
Thanks for the response .
I understood the logging the details via custom table and using it while restarting process.
But I would like to know how can we use existing mechanisms (bgRFC/tRFC/qRFC for instance) as you mentioned.
If you elaborate it with an example it will be very helpful.