Skip to Content
Former Member
Nov 18, 2005 at 02:51 PM

Searching organizational structure in a background task


Hello, SAP experts.

This is my first post here in the SDN so hopefully you'll pardon if I make a few mistakes here and there.

I'm working as an internal workflow developer for my company, and I'm in the testing phase of a customized Purchase Requisition Overall Release workflow based on the standard model. The release process works by escalating the requisition up through the organizational structure depending on the most part on the total price of the requisition. During the release procedures, I've been informed that there might be cases where no user will belong to a particular release strategy in the organizational structure chain being considered.

For example, suppose user 001 has superiors 002, 003, and 004. 002 is responsible for release code AA, 003 for BB, and 004 for DD. Now suppose 001 releases a requisition that needs to go through a release strategy with necessary codes AA, BB, CC, and DD. Normally for this strategy there would always be a user to approve each of those levels. But in 001's case, no superior of his/hers exists that can approve with code CC.

The solution we've come up with for this is that in cases such as the one above, where no user exists in the current chain that can perform a specific release, then have the system automatically perform that release through a background task. First, though, the workflow should determine if indeed this background approval should take place. For this, a second background method was developed that performs this check by going up the organizational structure (using the SWX_GET_MANAGER and RH_STRUC_GET modules) and finding if a user with a given release code exists in the current chain. It is in this step where I run into problems.

I've already created a subobject of the standard BUS2105 purchase requisition business object which implements the two methods and delegates them to the standard. I've tested the two methods through object testing and instancing and they both work. For the check method, it correctly goes through the organizational structure and determines if the release task should be performed in background or dialog. However, when I actually start the workflow, the check method hangs. When I check the tRFC log in transaction SWU2, it says that the RFC call terminated via an error: "There is no chief position for US ." I've seen this error before, and it's when the SWX_GET_MANAGER is given no user and thus can't find any superior.

I have my suspicions as to what is causing the problem, but I'd like to hear any other thoughts as well. I think that in the logical destination being targeted by the tRFC, namely WORKFLOW_LOCAL_<client_no.>, there is no defined organizational structure. This would explain why the method can't find any agents and why I'm getting the above error. If this were the case, how would I go about fixing it, and if not, what else could be causing the problem or what other solutions could I adopt?

Pardon the long post, but as you can see it's a complicated process to meet the company's requirements and I want to make sure it's understandable, if not concise. Thanks in advance for your help, gurus.


Juan Ramos