Skip to Content
Author's profile photo Charlie Lin

Have you encountered “Error obtaining concurrency lock (foreign_lock)”?

I see a lot of people encountered error “Error obtaining concurrency lock (foreign_lock)” when running data package, even when sending data from EPM Add-in.  If you are on BPC on HANA, you may see the error “Database returned the SQL code 131. Error text: transaction rolled back by lock wait timeout: Lock timeout occurs while waiting RECORD_LOCK of mode EXCLUSIVE(TRANSACTION_ID=70,UPDATE_TRANSACTION_ID=325118715)

By searching SAP KBA/Note, you may get solution that increase value of RECLEVEL_NR to make it larger than another parameter PACKAGE_SIZE. Actually, this is wrong, make it even worse. (Therefore, this kba is not visible to customer, but you still can find it by Google. On other websites, see ).

Now, let’s see what RECLEVEL_NR means. Below is the description from BPC admin guide.

7-23-2014 9-42-04 AM.png

See what you found, the default value is 10. Not like what is mentioned in that KBA – it should be bigger than PACKAGE_SIZE(which is wrong). According to the description, the record-based locking will be performed if the number of the records is less or equal to the value you set. If you change RECLEVEL_NR larger(e.g. 42000) than package_size(which has default value 40000) , every time the data generated by your package or EPM Add-in nearly reaches to 42000, 42000 records locking will be performed on your BI server. If your BI server is not strong enough, the locking may fail to implement the lock.  As a result, you will see error “Error obtaining concurrency lock (foreign_lock)”.

So next time you see this error, you can try to change the value of RECLEVEL_NR to default value 10. To change the value, you can follow the steps below.

  1. Logon ABAP server.
  2. Execute transaction SPRO ->SAP reference IMG ->Planning and consolidation ->Configuration parameters ->Set model parameters
  3. Find Environment/Model.
  4. Edit parameter RECLEVEL_NR

By the way, changing the parameter doesn’t release the lock. It just prevents the lock issue from happening again. As an option, you can restart the BW server to release the lock.

If this error still persists, this error may be caused by product bugs. You can try to apply notes.

Note 1923357 – DM packages failed due to concurrency lock

Note 1748701 – Deadlock RSPCSYNCLOG/RSPCLOGCHAIN for parallel InfoPackages.

BW Note fix updated on Nov 26, 2016.

Note 2169532 – P35: DTP: Deadlock DTPREQUEST check state with H observer

Note 2172634 – P35: ENQUE: Lock manager: Check_Tstate when checking request

Note 2179576 – 730SP14:SQL error 131 when accessing table “RSDD_TMPNM_ADM” during master data update (2)

Note 2091899 – P34: DTP: Deadlock between loading and extracting with DTP

There are two KBAs as well regarding this error.

1960682    RUN_LOGIC : Error obtaining concurrency lock (foreign_lock) – BPC NW

2015143 – Error obtaining concurrency lock (foreign_lock) – the latest version in BPC 10.0 NW

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Giovanni Leggio
      Giovanni Leggio
      Author's profile photo Former Member
      Former Member

      Hi Charlie,

                  I got the same issue which you had mentioned above. But the solution is different this issue may also occur when you are "DEBUGGING" the script logic in the ABAP level that is

      Reason For issue(Error obtaining concurrency lock (Foreign_Lock)):-

      •           If we are in "UJKT" for debugging purpose & if we are running the "DM Package" or "SEND DATA" for the same Environment & Model in EPM (Excel) which we mentioned in "UJKT" then this issue (Error obtaining concurrency lock (Foreign_Lock)) will occur.


      • Consultants who are facing this issue due to above reason can resolve it by just "Exiting" of "UJKT" .
      Author's profile photo Charlie Lin
      Charlie Lin
      Blog Post Author

      Thanks for sharing this Aravind.

      Author's profile photo Gersh Voldman
      Gersh Voldman

      Hi Aravind,

      Those are 2 completely different cases: real locking and false locking. What you described - is real locking, i.e. 2 processes are trying to write same set of data. What Charlie was describing - is false locking, when it's reported that locking happened, but it didn't. And it can be a lot of cases why false locking happens. Charlie just described one of them; and I wish it would be that easy as setting RECLEVEL_NR = 10. User has to analyze why locking happened and then decide how to avoid it.



      Author's profile photo Giovanni Leggio
      Giovanni Leggio

      Also if you get concurrency lock issues if you run DM packages at the same time users submit data, these notes may also alleviate concurrency lock (foreign_lock) issues:

      2193723 - Deadlock with RSPCSYNCLOCK & RSPCPROCESS

      2236636 - RSPCENQUEUE is locked always during Synchronous Execution

      Author's profile photo B. Jef
      B. Jef

      Hi John,

      Does SAP BPC NW support multiple 'locking attempts' and 'wait time' functionality (as configured in RSPLSE expert mode) if the target data region is the same?

      e.g. When 2 users are planning data on the exact same data set. Or script logic is trying to write to the same target region?