on ‎2006 Mar 03 8:47 AM
We have created a custom BSP-application to edit audit-objects (corrective/preventive actions). The objects are also to be edited in the SAP GUI. We need to make sure changes are not overwritten, and so need to lock the objects in some way.
We use one BAPI to read the details to display for the object, and one BAPI to execute the changes. The BAPI that executes the changes locks the object while it's changed. Editing the object in SAP GUI also locks the object.
Problem occurs with two concurrent web-users or concurrent users in SAP GUI and web. One user opens a object in the web-page and leaves it there. Meanwhile another user opens, changes and saves the object on web or in SAP GUI. The first user then executes his changes and saves them. The changes of the second user are overwritten.
I see three ways:
1/ lock the object as soon as it is viewed in web-browser, release when page is closed.
2/ compare the time the data was read into web-browser with the last time it was changed.
3/ compare the actual data when user tries to save with the actual data in the backend.
problems with these:
1/ preferred way, but can't figure out how to do it. i manage to lock (CL_CGPL_PROJECT->SET_CHANGE_MODE) the object while reading in from the backend, but the lock is gone as soon as the web-page finish execution.
2/ i don't have a last changed time, only date.
3/ a bit of a hassle as i use a free-text field mapped into a table to store in SAP. not sure if my functionality completely saves all spaces, etc...
BAPIS's used:
BAPI_BUS20370_GET_DETAIL
BAPI_BUS20370_CHANGE
appreciate any input!
Request clarification before answering.
hi,
for your first way,
you can define a static variable (at controller if mvc or at appication class if flowlayout) say "lock_bapi" now set and reset(lock/unlock) its value when the object is viewed by user.
since it is of static type it will change accross differrent instances of page.
this is similler to handling locking manually.
in second case also,
take variables static type like "bapi_timestamp_R" "bapi_timestamp_C" put the timestamp in it of last changed and read using server clock.
now compare these values accordingly.
in third i dont think there some problem, or may be i am not clear with it.
regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanx for your input.
using a static variable would solve the problem regarding concurrent updates on the web, but not when someone changes the values via SAP GUI while someone is editing via web. then i also need to implement a user-exit or something in the SAP GUI, which i really don't want to do at this stage.
#3 can probably be done, but i don't like the solution and with my current coding it could fail under certain circumstances.
peaceout
tom
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.