cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow - Purchase Contract Issue

Former Member
0 Kudos

Hi Ramki / Mikko / Workflow Gurus,

I need your help to resolve my following issue -

I am working on N step contract approval workflow.

I copied standard SAP workflow and added a new task to determine approver based on screen entries ( There are two bespoke fields for approvers).

I created a subtype for my business object BUS2000113 added a method to get approvers.

When I test my workflow, it works fine but when I create a purchase contract using EBP, I am getting following erros in workflow log.

1.Error handling for workitem 000000007470.

2.Object with runtime number 0 not defined.

3.<b>Work item 000000007475: Object BUS2000113 method ZGETAPPROVERDETAILS cannot be executed </b>

ZGETAPPROVERDETAILS is a method in subtype ZBUS200113.

My binding for task container and method container also seems to be fine.

Task----


Method

&UserID& -> &UserID&

&Approver& <- &Approver&

I have gone through all SAP documentations related to workflow / task / method bindings but could not resolve this.

Please add your tips.

Thanks and Warm Regards.

Pras

Accepted Solutions (0)

Answers (3)

Answers (3)

ramki_maley
Active Contributor
0 Kudos

Hi Pras,

<i>When I test my workflow, it works fine</i>

How exactly did you test your workflow? By simulating the event or starting the task directly?

Is an object reference for BUS2000113 is available in the WF container when you create a purchase contract using EBP?

Thanks,

Ramki Maley.

Former Member
0 Kudos

Hi Ramki,

I am testing my workflow using SWUS i.e. by starting the task directly.

I also checked, object reference for BUS2000113 is available in WF container.

Seems there is a binding problem between Task and Method.

I checked everything but could not figure out this problem.

I am still getting following error log -

<i>Work item 000000007483: Object BUS2000113 method ZGETAPPROVERDETAILS cannot be executed

Message no. WL821

Diagnosis

The calling of the object method for the work item ended with a return value for which no handling is modeled in the workflow.

Procedure for System Administration

Also check the binding between the task container and the method container.</i>

Any tips Ramki ?

Warm Regards.

Pras

ramki_maley
Active Contributor
0 Kudos

Hi Pras,

Does the Workflow behave correctly if you were to start it using SWUS for the same purchase contarct that is erroring out? If it does not, then in your method you may not be checking for an exception after a call to an FM or method.

You can also try some debugging by switching on the WF trace and the Container monitor.

Cheers,

Ramki Maley.

Former Member
0 Kudos

Hi Ramki,

Thanks for your tips.

I will check this on Monday. I am travelling back home to Swindon which is about 4 hours drive from Manchester.

Thanks once again for your quick response.

Warm Regards.

Pras Durafe

Former Member
0 Kudos

Hi Ramki,

Thanks for the update.

Yes my workflow behaves correctly if start it using SWUS.

Now as suggested by you, I am going to switch on WF trace and container monitor and will give another try.

Warm Regards.

Pras

Former Member
0 Kudos

Hi Ramki,

How to do container monitoring.

Regards.

Pras

Former Member
0 Kudos

Hi Ramki,

I defined exception in my method, now it is not giving any dump but it is also not finding agent.

Let me explain my method -

Parameters are -

UserID Import Parameter

ApproverUser Export Parameter

Program : (which I suspect).

BEGIN_METHOD ZGETAPPROVERDETAILS CHANGING CONTAINER.

DATA : lo_user TYPE swc_object.

DATA : lv_user_id TYPE xubname .

SWC_GET_ELEMENT CONTAINER 'UserID' lv_user_id.

IF lv_user_id CS 'US'.

SHIFT lv_user_id LEFT BY 2 PLACES.

ENDIF.

*Get the Approver's user details

SWC_CREATE_OBJECT lo_user 'USR01' lv_user_id.

SWC_SET_ELEMENT CONTAINER 'ApproverUser' lo_user.

Binding in Task :

Task to Method

&UserID& -> &UserID&

&ApproverUser& <- &ApproverUser&

My task container details are

Userid ( Import)

ApproverUser (Export).

I think now you can figure out what's wrong with this.

Please advise.

Thanks and Warm Regards.

Pras

ramki_maley
Active Contributor
0 Kudos

Transaction SWUD. Execute Test Environment option, then Click the execute icon for the Switch on container monitor.

To switch the container monitor off, choose Debug off in the container monitor.

Cheers,

Ramki Maley.

Former Member
0 Kudos

Hi Ramki,

I need your help to get this fix.

There are two bespoke fields on Purchase Contract Header

- Legal Approver

- Treasurer Approver

If user enteres Legal approver or treasurere approver or both, the work item should be sent to legal approver or treasurer approver or both.

Next step will be - work item should be sent to the Manager ( which is available in org structure).

I created a subtype for business object BUS2000113 ( Purchase Contract) as ZBUS200113. I created new attributes Z_legal_approver and z_tr_approver. Also created a method zGetApprovers.

I tried to insert a step in my subflow which is a copy of standard workflow but it seems there is a binding problem.

I tried SWUD / SWUS to test this but still can't figure it our. I will need your guidance to make it work.

Thanks and Warm Regards.

Pras

ramki_maley
Active Contributor
0 Kudos

Pras,

I assume you have delegated the sub type and the approver attributes are user ids and are getting populated when the object is instantiated.

One way to do this is:

Step 1: Condition step to check Legal Approver is entered.

If No - Continue

If Yes -

Step 2: Approval Step with Agent Assignment by Rule with function module.

Step 3: Condition step to check Treasurer Approver is entered.

If No - Continue

If Yes -

Step 4: Approval Step with Agent Assignment by Rule with function module.

Step 5: Work item to the Manager.

You could have two rules and two FMs or one rule that has a container parameter to indicate which approver should be read and the function module should use it to return the appropriate approver.

This gives the flexibility to change the approvers on the contract and re-evaluating the rule will put the WI in the new approver's inbox.

If you want to continue without using agent rules:

There is no need for the zGetApprovers method.

In Steps 2 and 4, Assign Agents by selecting 'US' (for user) and assign the BUS2000113.Z_legal_approver and BUS2000113.z_tr_approver fields respectively.

The disadvantage with this approach is that once work item is created, the only way to reroute to a different approver is by forwarding the WI.

Hope this makes sense to you.

Cheers,

Ramki Maley.

Former Member
0 Kudos

Thanks Ramki,

Ok, I will go with your approch but one quicky, when I create a task for Approval step, I need to enter a method, what method should I use. As per your suggestions, I do not need zGetApprover method ?

Please revert.

Thanks and Warm Regards.

Pras

ramki_maley
Active Contributor
0 Kudos

Pras,

I assumed zGetApprover method is getting the approvers and you have a separate task to get the approval. The approval task should have a method that calls the same process that one would use to approve tha contract outside of workflow.

Cheers,

Ramki Maley.

Former Member
0 Kudos

Pardon my asking but just to make sure, in your task, I hope u have selected the proper Object Category, Object Type and Method.And the relationships of the object type is maintained correctly.

Former Member
0 Kudos

Hi Linkin,

Yes, relationships of the object type is maintained but still there seems to be binding problem between Task and Method.

Any suggestions ?

Warm Regards.

Pras

Former Member
0 Kudos

Hi all,

Addition to above topic, I also deligated my subtype to supertype.

Regards.

Pras