Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Can't update a Service call using DI Server

when i try to update a Service Call using DI Server i get a fault:

Cannot modify unassigned service call. [-5002]

however, the service call is already assigned to a queue.

Tags:
Former Member
Former Member replied

SAP B1 "business logic", in its infinite wisdom, dictates that a service call can be modified only if it is assigned to a person, and cannot be updated when it is assigned to a Queue (even though it is technically assigned, no one person is responsible for this).

The (easy, and possibly only) solution that I found to this problem is that you must assign the service call to someone, update it, and assign it back. This is especially annoying when adding activities to a service call, because then the steps become

1. assign call to self

2. create activity (through the service calls link)

3. add activity

4. update service call

5. assign it back to the queue

6. update service call.

Assuming you want to do this programatically (given that this IS the SDK forum), you can use something like this (the code is PHP, but the logic should be self-evident)

[code]

private function DISUpdate_basic( ... ) {

// returns the service call ID of the call which was updated or created, or null on error

// this update is a straightforward XML interaction with the DI Server, after

// creating the necessary XML envelopes.

}

public function DISUpdate( $addNotUpdate = false ) {

// First, move the call to $me instead of Queue, only if needed

$isInQueue = $this->inQueue;

$queue = $this->queue;

$prefs = SapToolsmysettings();

$myuid = $prefs['UserId'];

if( $isInQueue ) {

debug( "Call is in a queue, moving it to myself ($myuid) before making changes" );

$this->inQueue = false;

$this->assignedTo = $myuid;

// *** bug *** if $addNotUpdate is passed along, then TWO calls will be created

// one without the queue, the other WITH. Noticed when adding activities (monitoring) along with a call

// solution: store the resulting callid, and reuse that when updating.

if( ! ($aucallid = $this->DISUpdate_basic($addNotUpdate)) ) {

debug( "Moving call to myself and updating - it failed!" );

return false;

}

// put it back into a queue only if the call remains open - a closed call must be

// assigned to a person

if( $this->status != variable_get( 'SAP_DIS_ClosedStatus', null ) ) {

debug( "Call updated, putting it back into the rightful queue ... " );

// We dont really need to reload the service call information - all I need to do is

// set the callid so that the update works

$this->callId = $aucallid;

$this->inQueue = true;

$this->queue = $queue;

return $this->DISUpdate_basic(); // always UPDATE at this point

} else {

// The call has been closed, so I cannot move it back into a queue

return $this->callId;

}

} else {

// Not in a queue, just pass through to DISUpdate_basic()

return $this->DISUpdate_basic($addNotUpdate);

}

}

[/code]

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question