cancel
Showing results for 
Search instead for 
Did you mean: 

Locking from OData URI

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Hi Folks,

My requirement:

To Lock the document number from OData URI.

Locking concept is common everywhere. I already applied enqueue/dequeue mechanism in my back end logic and the document number is getting locked in the backend and as well as from oData URI, but here once I got the response from the OData URI, the lock is getting released for my document number where I did not applied the dequeue logic for this.


Questions:

1) Y the Lock is getting released?

2) is there anything related to eTag concept for this Lock Mechanism.

3) when I execute the OData URI, the lock should not be released, as I did not write the dequeue Logic, any suggestions?

4) From the back end its working as expected.

Please guide me and provide your inputs from gateway point of view.

Thanks & Regards,

Vijay Vegesana

Accepted Solutions (1)

Accepted Solutions (1)

ChandraMahajan
Active Contributor
0 Kudos

Hi Vijay,

You can have look at these threads related to locking mechanism for OData.

Regards,

Chandra

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Hi Chandrasekhar,

Thanks for quick response, let me try this..

Thanks.

Answers (1)

Answers (1)

AshwinDutt
Active Contributor
0 Kudos

Hello Vijay,

Define the property which you are using to lock as etag and use it when you fire GW services.

Please have a look at the below discussion with which you can implement locking mechanism.

Regards,

Ashwin

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Hello Ashwin,

Let me try this with etag functionality and will let you know the result.

Thanks.

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Hello Ashwin/Chandrasekhar,

Need some clarification.

Suppose,  if I  checked as eTag for my document number, I will be getting one eTag number as a response for my document number., now I am updating same document details provided in the header with this eTag key and at the same time how can I restrict the same document number from the SAP GUI..

As per my knowledge, same document should number be changed in two different places at the same time.

what exactly this meant by...

In order to write your service to provide an optimistic locking version in the ETag header, you first have to track the version number of the resource. Usually, this means adding another column to the database to hold this value. Then the client/server interaction goes like this:

  • Client: GET the resource
  • Server: return the representation of the resource, and the ETag header with the current version number for optimistic locking.
  • Client: PUT or POST the modified resource, and the If-Match header with the same version number.
  • Server: Check the database to see if the resource they want to change has that version number.
    • If so, save the resource.
    • If not, return a 412 “Precondition Failed” response, letting the client know that it couldn’t perform the update, and the client will have to start over.

How to get the version number of the server when I send a request to the server and how do I pass the same in the return..

Any suggestions?

Thanks.

AshwinDutt
Active Contributor
0 Kudos

Hello Vijay,

You need not to get any Version number explicitly when you fire your GET.

Once you define your property as etag , GW itself will send back you the etag value which is to be sent when you fire your any modifying request like update/delete by putting the obtained etag in the if-match header.

If this version number which you have sent in if-match is matching, then GW allows to modify or else it will reject.

I have not done anything like adding a new column in DB to maintain version and all.

I have just set that property as etag and using it during update/delete and its working fine for me.

As per my knowledge that is all to be done to implement this lock.

For this question i am not able to think solution for now ... i am still thinking will this really happen ... however i am not sure of this... '

Suppose,  if I  checked as eTag for my document number, I will be getting one eTag number as a response for my document number., now I am updating same document details provided in the header with this eTag key and at the same time how can I restrict the same document number from the SAP GUI..

As per my knowledge, same document should number be changed in two different places at the same time. '

Regards,

Ashwin

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Thanks Ashwin for the detail explanation.

Even for me it is working, when i set as etag, but I got confused, if i want to edit the same document number from GUI, how i need to restrict, am still not able to find the solution for this.

Anyway thanks for every one.

Please post your inputs, if you face these kind of issues.

Thanks & Regards,

Vijay V

Former Member
0 Kudos

Hi Vijay,

Have you find any solution for this to restrict the editing the same document number from GUI.

Thankyou.

Devi

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Hi Shobha,

We are handling the same in the backend with Enque/Deque

Thanks