cancel
Showing results for 
Search instead for 
Did you mean: 

JCO: How to lock Object in Backend for edit

Former Member
0 Kudos

Hi,

i'm developing an JAVA application wich retrieves data from CRM backend.

i wont to lock an order in backend after reading data ,and keep this lock

until data schould be write back .

I've tried to use JCO.Cient.execute(function,tid) but it doesn't work

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Oleg,

SAP uses logical locks, which are set by the application modules. E.g. a sales order uses lock object EVVBAKE, which is set via function module ENQUEUE_EVVBAKE. Unfortunately the (generated lock) function modules are not RFC capable. Assuming that your order means sales order, you could utilize RFC function modules ISA_LOCK_SALESDOCUMENTS for locking the order and ISA_UNLOCK_SALESDOCUMENTS for unlocking the sales order. If you're using JCo3, then I'd do this in one session/context, i.e. when starting your program logic use

JCoContext.begin(jcoDest);

where jcoDest is your JCoDestination object. Now you could lock the sales order, execute whatever other logic you need, then unlock the sales order again and finally end the context via

JCoContext.end(jcoDest);

Note though that this approach is a bit risky, because any connection problems might result in stale lock entries in SAP, which prevent any user from updating the locked sales order...

Best wishes, harald