cancel
Showing results for 
Search instead for 
Did you mean: 

How check a BOR instance in a WF?

Former Member
0 Kudos

Helo,

i have a problem with my workflow:

I have created a task and it needs a instance of an BOR-object (Is-U contract).

The Problem is, that i don't know how to create a precheck. That means, before starting Task it must be checked, exist a instance of this object?

sometimes, the object-instance  could be not exist an then the workflow fails.

Do someone know, how to create an existence Check for BOR-object-instances?

I thought about to use a Container Operation, but i don't know, how to use it for this case.

Thank you very much,

bye

Adalbert

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

What do you want to do when the object does not exist? Would you just skip the following step, or what?

You could add an condition step (before the problematic step) in your workflow. In the condition step editor you have all the different comparison possibilities, and some of them should work also for "IF INITIAL" situation. You could for example just check if some of the object attributes is initial, or whatever.

Also, I am not completely sure what you mean here. There is no contract at all in the database (and thus the object was not instantiated) or the contract is there, but the BOR object was not instantiated? How is the object is instantiated at the first place? Couldn't you add the relevant logic already to this instantiation phase?

Kind regards,

Karri

Former Member
0 Kudos

Hi,

thank you for your answer.

I mean, that the bor-object is not instantiated, and using it in a Task fails.

Your solution with the condition is good. i think it solve my Problem

i'll try it and give you a Feedback.

thanks a lot,

adalbert

Answers (3)

Answers (3)

StephaneBailleu
Active Contributor
0 Kudos

Hi

BOR can only be instanciated if they exist unlike of class object.

They nearly all implement the interface IFSAP wich has method existence check


So if you are working with a standard BOR you can use this method, it is not instance independant.

Either you can use this standard and capture the return code or build your own on a Z delegated BOR

in order not to exit but  to return a parameter (make it instance independant in order to just provide the key and return a parameter)


Then based on that build your own task and include it in your workflow .


I hope this helps


Cheers

Stephane

SandySingh
Active Contributor
0 Kudos

Hello

If the  BOR object instance(which is also a WF triggering instance) does not exist because the Object (document) is deleted or Cancelled, then the workflow instance should also get cancelled. Just add the deleted or Cancelled event for BOR object  in SWDD> Basic data >Version Dependent Tab> Events tab. Receiver Type : Cancel workflow

Regards

Sandy

SandySingh
Active Contributor
0 Kudos

Hello

You can use following FM to check the existing WF instance for a BOR object

CALL FUNCTION 'SAP_WAPI_WORKITEMS_TO_OBJECT'

    EXPORTING

*     OBJECT_POR                     =

      OBJTYPE                        = IV_OBJECT_TYPE

      OBJKEY                         = IV_OBJECT_KEY

*     TOP_LEVEL_ITEMS                = 'X'

      SELECTION_STATUS_VARIANT       = 0000

*     TIME                           =

*     TEXT                           = 'X'

      OUTPUT_ONLY_TOP_LEVEL          = 'X'

      LANGUAGE                       = IV_LANGU

    IMPORTING

      RETURN_CODE                    = lv_return_code

    TABLES



      WORKLIST                       = lt_worklist

      MESSAGE_LINES                  = lt_message_lines

*     MESSAGE_STRUCT                 =

Regards

Sandy