Skip to Content
0

How to integrate SAP Business Workflow and BOPF?

Feb 16, 2017 at 11:39 AM

562

avatar image

Hi,

my question is simple: how do you change BOPF objects in background activities of SAP Business Workflow? The problem is that the workflow runtime performs COMMIT WORK which is not conistent with BOPF transaction handling. How do you solve the problem?

I think there are two possible solutions:

  • use the standard transaction manager
  • use the slave Transaction manager

Using the standard transaction manager might problematic since it throws an own COMMIT WORK or ROLLBACK WORK which is not the usual COMMIT WORK/ROLLBACK WORK of the workflow runtime - those commands com later from the workflow runtime. My question is whether this can lead into trouble.

The second solution could be as follows:

Create an object implementing IF_WORKFLOW, call it from the workflow activity and span your own transaction: https://archive.sap.com/documents/docs/DOC-74901 . In this solution you can control the execution and then create a workflow event that informs the workflow. The only problem might be that you trigger a COMMIT WORK in the background activity before creating workflow events which control the execution of the workflow. Usually I don't do this and use COMMIT WORK of the SAP Business Workflow runtime instead so that everything is done in single LUW. My question is whether this works or will / might lead to problems with the workflow.

I also thought about moving everything into a parallel context by performing updates and transaction handling a function module IN DESTINATION NONE and giving the results back to create events that guide the workflow but I don't know whether this makes everything worse, even if you trigger the BOPF transaction handling also IN DESTINATION NONE using PERFORM ON ... COMMIT (which will lead to other problems).

I know that SAP seems to have a solution for this problem (see
http://help.sap.com/saphelp_ehsext30/helpdata/de/b4/07cb5f7c7c402a93744fda1bbad88d/content.htm?frameset=/de/03/57f5a9e2b3479b94a4b5c381984e20/frameset.htm¤t_toc=/de/89/8a926b052548beb49841a2732700bb/plain.htm&node_id=10 ) but you won't find implementation details here.

How do you solve this challenge? Or is above mentioned solution working?

Cheers,
Tobias

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Tobias Trapp
Mar 10, 2017 at 08:56 PM
1

Today I heard an answer from developers who solved the problem. In fact they used the slave transaction Manager in the following way: they perform CALL FUNCTION '/BOBF/TRA_DUMMY_UPDATE_TASK' IN UPDATE TASK and then let the workflow runtime do the COMMIT WORK. Of course the after save phase can't be performed this way. If the save is not possible they throw an exception and let the workflow runtime perform a ROLLBACK WORK.

Share
10 |10000 characters needed characters left characters exceeded
Martin Fischer
Feb 16, 2017 at 12:52 PM
1

Hi Tobias,

the link to the SAP help is currently not working for me. So I hope you didn't link to my suggestion ;-)

I'm not an workflow expert, but for me the scenario sounds suitable for the slave transaction manager.

Tilmann wrote a blog post about it:

https://blogs.sap.com/2015/01/17/integration-of-bopf-business-objects-and-existing-applications-part-12/

I hope, that helps!

Cheers,

Martin

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Yes, I think the same. In fact the first link in my question is just a link to the second part of the description of the slave transaction Manager which you mentioned in a link. So the main question is whether doing a COMMIT WORK inside a background method in SAP Business Workflow. Usually I try to avoid this so I don't have much experience with it.

But let's discuss the usage of the slave transaction manager. I thougth about this solution and I have two questions: If the COMMIT WORK is performed by the workflow runtime you can't perform the post save phase. Do you consider this as a problem? I think in many cases this phase is not important. The second question is: What do I have to do when lo_slave_manager->do_save() fails? Do I really have to do a ROLLBACK WORK? If yes, could this lead to problems with the workflow runtime?

Best Regards,
Tobias

P.S.: Yes, help.sap.com experiences some trouble since yesterday. But the link doesn't a provide solution for this problem. It links to a software solution which is an addon to SAP Business Suite in an own software component so I can't analyze the implementation.

0
avatar image
Former Member May 18 at 01:34 AM
0

I would say, definitely use the slave transaction manager. In fact, that would be the case in all enhancement/user-exit scenarios. In one of my recent development, in a certain enhancement implementation, I first prepare the BOPF instance (i.e. generate the key) and send it to the slave transaction manager. Next, I prepare the workflow event with the BOPF instance key to be create in update task, and end my enhancement. When the SAP process decides to trigger the COMMIT WORK, the workflow event is trigger with the key I prepared, the (custom) workflow takes on and finished off any post-processing tasks I want. See Function module BOPF_COMMIT for some details.


However, I am not sure I understand your statement about "The only problem might be that you trigger a COMMIT WORK in the background activity before creating workflow events which control the execution of the workflow.".

Share
10 |10000 characters needed characters left characters exceeded