cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to trigger workflow without BOR instance and without created SO object in the system?

Astashonok
Participant
0 Kudos

As I got it from documentation for BOR events, the events, both standard and custom ones, can be defined only when BOR objects change theirs status and/or state: CREATE, CHANGE, DELETE, APPROVE, RELEASE, etc.

But what about simulation of BORs? Do the workflow triggered in that case?

By simulation I mean running some business-functions without creating object: for example BAPI_SALESORDER_SIMULATE or BAPI_SALESORDER_CREATEFROMDAT2 with testrun = X?

Do BUS2032 events are triggered in that case? If not, can we somehow enable them?

Sandra_Rossi
Active Contributor
0 Kudos

You may trigger the events manually (SWUE), but it will not be in test mode, it will be for real.

Astashonok
Participant
0 Kudos

so SWUE creates BOR objects and commits them to DB? without commit the workflow will not be triggered?

Sandra_Rossi
Active Contributor

Sorry. Didn't see your comment. You're correct.

NB: If you want to target someone, if this person has posted an Answer, use the button COMMENT, if this person is the Original Poster of the question he/she will be automatically informed, otherwise copy/paste their hyperlinked name so that the person receives a warning (NB: @ doesn't work/but typing this character will suggest hyperlinked names).

Accepted Solutions (0)

Answers (2)

Answers (2)

keohanster
Active Contributor
0 Kudos

Hi Pavel,

As sandra.rossi said, you can trigger events manually with transaction SWUE. To do this, you need to fill in the business object key (so the Sales Order must already exist).

Events are triggered all the time in SAP. It only matters when you are trying to react to an event. Since I'm not familiar with Sales Orders or those BAPIs, you could always run them with the 'X' and without the 'X' in the testrun parameter, and then look in the event log using transaction SWEL.

(The Event Log must first be turned on using transaction SWELS).

Good luck,

Sue

Astashonok
Participant
0 Kudos

I ran the SWELS trace and I see that neither BAPI_SALESORDER_CREATEFROMDAT2 (with or without TEST_RUN) nor BAPI_SALESORDER_SIMULATE invokes Workflow start (BOR creation?). Is it the normal behavior or I have some inconsistency in my system. That is the question. Thx in advance.

Astashonok
Participant
0 Kudos

> To do this, you need to fill in the business object key (so the Sales Order must already exist)

that is the problem, I want to start workflow for simulation, which means object does not exist and will not be created. So you saying this is impossible?

keohanster
Active Contributor
0 Kudos

I apologize if what I've written below seems basic, but I wanted to be sure you and I are on the same page regarding the definitions of some terms.

A Workflow is different from a BOR object. A BOR object is the technical representation of a business 'document' or transaction. To view this functionality, I recommend that you go to transaction SWo1, and enter a business object type - perhaps BUS2032. Then you will have to instantiate the business object - that is, give it a key for a document that already exists in your system. You will see a list of Keys, Attributes, Methods, and Events on your BOR Object. This is the information and activities that are defined for this BOR Object. You can extend a BOR object (as delivered by SAP) by copying it into a Z-Version.

A Workflow is a set of tasks and decisions that determines what should be done with that object. Workflows can be started from events - but only if they are linked to the designated event. You can see which Workflows SAP has delivered by clicking on the where-used button from transaction SWo1.

As for your event trace, please ensure that you have turned it on first - events will only be written to your event log if you have turned the trace on. Then you can test your BAPI, or run various SAP transactions. You will only see workflows started if they are linked to an event (via transaction SWETYPV).

Example of SWELS - to turn event trace on or off - attachment 1

Example of Event Trace (or log) - attachment 2.

Note that many events are logged, but only BUS2038 CREATED started a workflow.

Hope this helps,

Sue

Astashonok
Participant
0 Kudos

susan.keohan > I apologize if what I've written below seems basic

it's okay, but As for your event trace, please ensure that you have turned it on first is indeed too basic, I am not so newbie to conduct the tracing without switching on the trace switch ��

> Then you will have to instantiate the business object - that is, give it a key for a document that already exists in your system

That is the key to my problem I am struggling to explain to you. I am afraid that running BAPI_SALESORDER_SIMULATE/BAPI_SALESORDER_CREATEFROMDAT2 does not result in instantiation of BOR object. And I am seeking your confirmation is it true or not.

Compare these two trace screenshots I attached to this comment, the first one is from tracing after BAPI_SALESORDER_CREATEFROMDAT2 01-bapi.jpg

and the second one is from tracing VA01 transaction. 02-va01.jpg

The first variant didn't triggered Workflow, the second did. Why?

Is it more clear now what I am asking?

keohanster
Active Contributor
0 Kudos

Hi Pavel,

Sorry, I just wanted to be clear about terminology.

When you run the BAPI, does it actually create a new Sales Order? If so, I definitely expect that the BUS2032 CREATED would show up in the Event Trace after running. Have you called BAPI_TRANSACTION_COMMIT?

Astashonok
Participant
0 Kudos

No, I didn't commit and this is reason, thank you. But my original question as per the title was: can we invoke Workflow without object creation, particularly I am interested in simulation, but running the BAPI w/o commit and in test-run also fits that description. From your understanding I got that it is impossible, and Workfow is never triggered in that case, correct?

keohanster
Active Contributor
0 Kudos

I suppose you always *could* get a workflow to run with no object, but I don't understand why you'd want to do that. If there is no object, what is the purpose?

Astashonok
Participant
0 Kudos

any ideas about that, dear experts?