cancel
Showing results for 
Search instead for 
Did you mean: 

Background task is not being executed

marcin_cholewczuk
Active Contributor
0 Kudos
1,581

Hi all,

It's been  some time since I've played with workflows and I have forgotten quite a lot, so I assume that this is a simple matter and I'm just forgetting something.

Background: In response to changes that are being made to one of objects in system I'm trying to an update z-tables. I've decided to use workflow events that are being fired during creation of change document.

What I did:

- I've created ABAP class that implements IF_WORKFLOW interface and implemented all Methods (especially BI_PERSISTENT~FIND_BY_LPOR and BI_PERSISTENT~LPOR, rest have only EXIT inside), added Contructor, event and my own method that do all work.

- I've prepared Workflow that was started with event that I've declared in my class and added one activity that is calling method (that do all work)

- I made all customizing that was necessary for this to run (like in transaction SWEC). Since this is SAP object and change object already exists, I did no changes in SWED

- for first test I've set it task work in dialog and added me as an agent

Result:

I'm changing an object. In effect in SWIA workflow is getting status STARTED and automatically a dialog step is added with status READY. I can execute it in business workplace. Dialog step is being set to COMPLETED, but workflow has still status STARTED - I've to click button "manualy end" in SWIA to make it change into COMPLETED. What could be the reason?


Next:

I've deleted agent for my task and I've set it to "background task"

Result:

I'm changing an object. In effect in SWIA workflow is getting status READY. No background task is being created automatically, why? When I click "execute workitem" and refresh then workflow status is STARTED and background task is being created, however It's not being executed, again why? When I go in details of this task then I can see that its start date/time and creation date/time are equal, so it should be executed right after creation.

Any ideas are welcome

Best Regards

Marcin Cholewczuk

View Entire Topic
ronen_weisz
Active Contributor
0 Kudos

have you defined the task as background processing? if you changed this option in the task and it was not set in the first time, try running transaction swu_obuf it sometimes solves strange system behaviors.

also, if your only requirement is to update z-tables, why not use a receiver function module in swe2 instead of a workflow it is easier and has not requirements from the DB (workflow logs,head,linked object etc.) .

marcin_cholewczuk
Active Contributor
0 Kudos

So in transaction SWE2 I should use as a "receiver function module" my own FM instead of standard SWW_WI_CREATE_VIA_EVENT_IBF, do my stuff inside and call no workflow. Is this what you meant?

ronen_weisz
Active Contributor
0 Kudos

Yes, call your own function module instead of the sww_wi_create_via_event_ibf. you need only to have the same type for importing parameters. if you look in swe2 you will see there is at least one standard link of this type you can use as an example (draw.changed)

marcin_cholewczuk
Active Contributor
0 Kudos

Unfortunatelly I still don't know why wf was not triggered I suspect that system is not enough configured. That way or other your solution works fine for me.

thanks