Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Lock a Table for Test Case

Former Member
0 Likes
676

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

2 REPLIES 2
Read only

Former Member
0 Likes
468

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

Read only

0 Likes
468

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