cancel
Showing results for 
Search instead for 
Did you mean: 

How to integrate SAP Business Workflow and BOPF?

ttrapp
Active Contributor
0 Kudos

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?frame... ) but you won't find implementation details here.

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

Cheers,
Tobias

Accepted Solutions (1)

Accepted Solutions (1)

ttrapp
Active Contributor

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.

mudassir_saad
Explorer
0 Kudos

Hello Tobias,

i am also facing the same issue which is really strange for me. i have developed one custom workflow in which i have created one background activity which is calling one method. there i have written code to execute action "/scmtms/if_tor_c=>sc_action-block-overrule_block" this is TMS module action which is used to unblock freight Unit. When i execute this code directly using class in se24 it is working fine and data gets reflected in the database as well. But when this activity is being executed after workflow approval window it is not reflecting the data in the database. If i am debuging the same thing then every step is same without any error but i am not sure why data is not being reflected in database. Please let me know if you have any clue about this issue. P.S. i have also tried slave transaction manager as well but this also does not work.

Answers (2)

Answers (2)

cyclingfisch_
Active Contributor

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...

I hope, that helps!

Cheers,

Martin

ttrapp
Active Contributor
0 Kudos

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 Kudos

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.".