cancel
Showing results for 
Search instead for 
Did you mean: 

BSP data locking

Nigel_James
Active Contributor
0 Kudos

I have some table data that I want to update and I want to LOCK it. The standard enqueue/ dequeue method doesn't work across different user sessions in a BSP environment.

Has anyone else solved this issue? Is there a 'standard approach'? or is it a case of build your own locking table?

regards and thanks in advance,

Nigel

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

you mean, no one else may update it at the same time ?? or are you the only one to update it ?? This is a difficult case and you must think how you create it.

Is there any representation of the table in BSP ?? If so, then create a subroutine where you save in a variable the user name of the first one to call it and erase that variable when leaving the page. If some one else calls that page, he won´t be able to work with it in case there´s a value in your variable.

For the second option you can work with authorizations for calling transaction SE16:

AUTHORITY-CHECK OBJECT object

ID name1 FIELD f1

ID name2 FIELD f2

...

ID name10 FIELD f10.

Nigel_James
Active Contributor
0 Kudos

Thanks Jorge, It was the first case - that noone else can edit the data it. Your answer provides the most simple locking solution but it I would augment it to suggest if there is a user name all ready held that the user can only have read access to the data.

Thanks for responding.

Nigel

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

this can be acheived as follows:

if you are using MVC then you must be updating table in a model class.

declare a static variable say "TOKEN type int1" initially put its value as "TOKEN = 0".

now every time to access this table follow this protocol:

if you want to update it check the value of token. if its 0 get the token i.e TOKEN = 1 and update the table after updating change value of TOKEN = 0 ,else wait or so.

and if you are using simple flow layout you can acheive this by declaring a static variable in your Apllication class. simmilarly in this also check for the value of the variable prior to accessing the table.

cheers!

Nigel_James
Active Contributor
0 Kudos

Good solution but here is the kicker... we are using MVC AND we are stateless. I am now conviced we are going to have to implement a custom table to save the states for all the users.

Thanks for your answer.

Nigel