Skip to Content
0

Lock a transaction and afterwards call in in BDC

Jan 19, 2017 at 11:38 AM

138

avatar image

Hello together,

I want to lock a transaction / Object ( in my case Production order ):

    CALL FUNCTION 'ENQUEUE_ESORDER'
      EXPORTING
        aufnr          = iv_aufnr
        _SCOPE         = '2'
      EXCEPTIONS
        foreign_lock   = 1
        system_failure = 2
        OTHERS         = 3.

Afterwards I want to do an BDC in CO02

    DATA: lt_call_msg TYPE tab_bdcmsgcoll,
          lt_return   TYPE bapirettab,
          ls_options  TYPE ctu_params.

    ls_options-dismode    = 'N'.  " A= Hell abspielen, N = Dunkel, E = Stoppen nur bei Error
    ls_options-updmode    = 'A'.  " S = Synchron; A = Asynchron
    ls_options-defsize    = 'X'.  " Standarddynprogröße

    CALL TRANSACTION 'CO02'
      USING me->mt_bdcdata
       OPTIONS FROM ls_options
       MESSAGES INTO lt_call_msg.   " Fehlertabelle

In This way I lock myself. Do I necessarily need to DEQUEUE the Production oder just bevore the Call Transaction andd afterwards
ENQUEUE again or is there another, better possibility?

Thanks

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

abid ali Jan 21, 2017 at 05:43 AM
-1

Your Lock mode is empty....set LOCK_MODE = 'E' OR 'X'.

after your BDC you must DEQUE your table as it is Recommended by SAP.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

If the lock mode is empty, then it is 'E' by default.

Would like to share where SAP recommends doing a manual DEQUEUE after a BDC or Call Transaction - I have never seen that recommendation before

0
Raghu Govindarajan Jan 20, 2017 at 04:09 PM
0

Not a definitive answer here - but did you try with the update mode set to synchronous "S" or Local "L"? They change the way the LUW (logical unit of work) behaves with the call transaction. Your lock object is in your original program's LUW and your goal is to keep the called transaction in the same LUW.

In your ENQUEUE call, also make sure that the mode is 'E' so that it allows cumulative locks. I think that is the default, but it is worth double checking.

Share
10 |10000 characters needed characters left characters exceeded