cancel
Showing results for 
Search instead for 
Did you mean: 

Handling object locking in R/3 from WD through RFC

Former Member
0 Kudos

Hi all,

We implements application which uses R/3 backend to store and retrieve data, and to make application logic at that level in ABAP. We are experiencing problems how to solve locking of tables in such a scenario. We are accessing R/3 through Adaptive RFC from Webdynpro application.

We tried function for locking 'ENQUEUE_E_TABLEE', but it seems that lock expires with the end of RFC function.

Can anyone point me to some material or better simple tutorial with this issue ? How can I properly solve the problem of accessing common resource (in this case table or RFC function) ?

Thanks for any help,

Best Regards,

Miroslav Koskar

Accepted Solutions (0)

Answers (1)

Answers (1)

lajitha_menon
Contributor
0 Kudos

Hi there,

You said that the lock expired at the end of RFC session. Why would you need the lock to exist after end of processing of the RFC function anyway? I think that you have to handle the processing steps concerned within the enqueue and dequeue functions inside the RFC function itself.

Does it make sense?

LM

Former Member
0 Kudos

Hi Miroslav,

This is an snippet from this blog,

/people/sap.user72/blog/2005/01/08/adaptive-rfc-models-in-web-dynprosome-pointers

"It is possible for Web Dynpro to lock records using standard SAP provided Function modules. But to ensure that the record remains locked it is necessary reserve the connection that was used for locking and be made unavailable for other models and also the connection should remain open as long as the lifetime of the screen. This becomes similar to locking records through SAP Gui . This can be easily achieved by having separate models for locking RFCs defined with APPLICATION_SCOPE and isolating its connection by not grouping with other model objects. "

Former Member
0 Kudos

Hi there,

Precisly we need in our application to ensure this behavior:

One user enter form for editing such a application object (for example customer order) and other user in try to edit this order gets message that he is not allowed to edit.

So we need to implement some locking mechanizm. How to do that ? Has anyone experiences in this, it seems me a general problem which has to be solved in many Webdynpro VS Abap application. Is there some general material or tutorial about the possibilities and solutions ?

Thanks

Regards,

Miroslav Koskar

lajitha_menon
Contributor
0 Kudos

Hi Miroslav,

The blog reference which Raj had given in his reply is a very useful one. Did you try implementing the solution mentioned in the blog?

I think these are the steps you need to follow to implement it. Anybody please correct me if I am wrong.

-Create a RFC function in SAP exclusively for calling the locking function. Similarly, one function for unlocking as well.

-Import this RFC as an adaptive RFC model, using your own custom controller, having only one model class(I am suggesting this as per the blog snippet which says that you have to reserve the connection by not grouping it with any other model objects. Please correct me again, if thats not the case).

-In your WD application, before the user enters in form editing for customer order, call this Adaptive RFC function, by explicitly mentioning APPLICATION_SCOPE in the constructor.

eg:ZBapi_lock_order_input in = new ZBapi_lock_order_input(WDModelScopeType.APPLICATION_SCOPE);

-Go to SM12 in R/3 and check whether lock is created for the key.

-After user saves/exits the order, call the adaptive RFC function for unlocking.

I have not tried it, so please let me know if this solves the problem.

Cheers,

LM