‎2007 Mar 19 10:00 PM
Hi,
I read a little bit in the forum but didn't find exactly what I am looking for.
I have a couple of test cases that change data using RFCs from Ruby.
Is there a way I can lock a particular table or field.
Here is my test case
- read ADDRESSDATA.HOUSE_NO from BAPI_BUPA_ADDRESS_GETDETAIL
- change ADDRESSDATA.HOUSE_NO
- assert if ADDRESSDATA.HOUSE_NO was changed
- change ADDRESSDATA.HOUSE_NO back to the previous value
- assert if re-change was performed
I would like to prevent reading and writing the HOUSE_NO in between to avoid lost updates or dirty reads. What can I do?
Best,
Stefan
‎2007 Mar 19 10:24 PM
Hi Stefan,
You can lock a table using FM:' ENQUEUE_E_TABLE' <b>or</b> if you want to a particular record, then you need to find out the lock object and the corresponding FMs for that table.
Example: To lock a reaord in PO item table EKPO ( Lock Object EMEKPOE),
CALL FUNCTION 'ENQUEUE_EMEKPOE'
EXPORTING
ebeln = ls_ekpo-ebeln
ebelp = ls_ekpo-ebelp.
write your update statements
CALL FUNCTION 'DEQUEUE_EMEKPOE'
EXPORTING
ebeln = ls_ekpo-ebeln
ebelp = ls_ekpo-ebelp.
Thanks,
Chandra
‎2007 Mar 19 11:28 PM
Hi Chandra,
I tried to use ENQUEUE_E_TABLE with the structure name as parameter
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
TABNAME = "BAPIBUS1006_ADDRESS"
but it gives me the following error from which I don't know if it is an ABAP error or generated by the Ruby saprfc library.
Error: TABLE_NOT_ACTIVE
Might that be because BAPIBUS1006_ADDRESS isn't a table but a structure?
There is a second parameter for this function, namely VARKEY, that many people are using. But I couldn't find out what to give as a value. Do you have any ideas on this one?
Where can I find out how the explicit enqueue function for my structure is called (I am talking about the equivalent to ENQUEUE_EMEKPOE)?
thanks
Stefan