Skip to Content

Lock a transaction and afterwards call in in BDC

Jan 19, 2017 at 11:38 AM


avatar image
Former Member

Hello together,

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

        aufnr          = iv_aufnr
        _SCOPE         = '2'
        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

      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?


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

2 Answers

avatar image
Former Member Jan 21, 2017 at 05:43 AM

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

Raghu Govindarajan Jan 20, 2017 at 04:09 PM

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.

10 |10000 characters needed characters left characters exceeded