Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BDC synchronisation problem.

Former Member
0 Likes
649

Hello !!

I have two "call transaction" calls in abap for the same production order (first - CO01, second CO02).

Unfortunatly very often when second one is triggered i have an error like : object is blocked / reserved for user....

Is there any way to trigger second one when first is really finished ?? (i have tried with different update modes but it doesn't solve the problem)

Br, Jacek

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
588

Couple of ways to do this. In the Call transaction CO01, use update 'L' for local. IF that doesn't help, put a delay in it using WAIT statement. If you want to ge a different way, you can use the lock object and keep trying to get a look before calling CO02.

Something like this.



* Keep waiting till the previous locks have been released.
while sy-subrc <> 0.

  call function 'ENQUEUE_ESORDER'
   exporting
*   MODE_AUFK            = 'E'
     mandt                = sy-mandt
     aufnr                = p_aufnr
*   X_AUFNR              = ' '
*   _SCOPE               = '2'
      _wait                = 'X'
*   _COLLECT             = ' '
   exceptions
     foreign_lock         = 1
     system_failure       = 2
     others               = 3
            .
  wait up to 1 seconds.

endwhile.


* Once you get a lock, release it and call transaction CO02
call function 'DEQUEUE_ESORDER'
 EXPORTING
   MANDT           = SY-MANDT
   AUFNR           = p_aufnr.


call transaction 'CO02'.

Regards,

Rich Heilman

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
589

Couple of ways to do this. In the Call transaction CO01, use update 'L' for local. IF that doesn't help, put a delay in it using WAIT statement. If you want to ge a different way, you can use the lock object and keep trying to get a look before calling CO02.

Something like this.



* Keep waiting till the previous locks have been released.
while sy-subrc <> 0.

  call function 'ENQUEUE_ESORDER'
   exporting
*   MODE_AUFK            = 'E'
     mandt                = sy-mandt
     aufnr                = p_aufnr
*   X_AUFNR              = ' '
*   _SCOPE               = '2'
      _wait                = 'X'
*   _COLLECT             = ' '
   exceptions
     foreign_lock         = 1
     system_failure       = 2
     others               = 3
            .
  wait up to 1 seconds.

endwhile.


* Once you get a lock, release it and call transaction CO02
call function 'DEQUEUE_ESORDER'
 EXPORTING
   MANDT           = SY-MANDT
   AUFNR           = p_aufnr.


call transaction 'CO02'.

Regards,

Rich Heilman

Read only

0 Likes
588

Thanks Rich !!

It works fine for me

BR, Jacek

Read only

Former Member
0 Likes
588

Use the synchronous update mode while calling the transaction CO01.

Documentation:

UPDATE upd

Effect

The UPDATE addition determines the processing mode for batch input processing. You can specify a character-type object for upd. Its possible content and its effect are displayed in the following table. Without use of one of the additions UPDATE or OPTIONS FROM, the effect is the same as if upd had the content "A".

upd Effect

"A" Asynchronous update. Updates of called programs are executed in the same way as if in the COMMIT WORK statement the AND WAIT addition was not specified.

"S" Synchronous processing. Updates of the called programs are executed in the same way as if in the COMMIT WORK statement the AND WAIT addition had been specified.

"L" Local update. Updates of the called program are executed in such a way as if the SET UPDATE TASK LOCAL statement had been executed in it.

Other As for "A".

-Kiran

Read only

Former Member
0 Likes
588

Hi Rich !!

Update L doesn;t help i have tried it.

Wait of course works but it isn't good solution for me (becose o large amount of data to be processed i should trigger CO02 as ssoon as possible).

So the third way....Could you provide more detailed information how to achive that ?