Application Development 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: 

Locking a transaction based on profit center.

Former Member
0 Kudos
126

The exact requirement is as follows.

We have an application in which there are some reports. We want that when a user works on a particular profit center in one particular report, no one should be able to work on the same profit center in any report at that particular time. How can this be done?

We tried one solution - a table was made in which profit centers are stored when a user executes a particular report. But the problem is that the profit center should be deleted or unchecked when the report is stopped. This does not happen in all scenarios. When we use Back, it works but when we close the session, it doesn't. The profit center is still locked. This can be solved by checking whether the transaction through which profit center was locked is open or not. For this transaction like SM04 can be useful, but then how to use it for our purpose? Is there some table which we can refer? SM04 works on a structure, then how can we use the structure?

Also, is it possible to solve the issue totally by ABAP? Till what extent can BASIS be of help?

Please suggest possible solutions. Thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
76

Hi,

Try this.

Create a lock object for the table which stores the profit centre details.

Whenever a particular profit centre is changed, it will be locked. Once the session is closed, unlock it. Locking/Unlocking can be done with the help of the function modules generated by the lock objects (using ABAP).

Hope this may be helpful.

Regards,

Sharin.

4 REPLIES 4

Former Member
0 Kudos
76

well.. when one person starts editing a profit center ... using one report .. you can set the parameter id : PRC to the value he is using..

when other persons starts editing... get the parameter id PRC value .. and check if this is the same or not.. if yes...stop editing..

after one person is done iwth editing.. the report can clear the parameter..for next use

0 Kudos
76

Thanks for the reply Soumya.

But there are two probs here.

1) There are can be a range of profit centers and not just one.

2) The parameter should be cleared when the report is closed (not just by using BACK, but even if it is closed abruptly). The set/get parameter method will not work then.

Former Member
0 Kudos
77

Hi,

Try this.

Create a lock object for the table which stores the profit centre details.

Whenever a particular profit centre is changed, it will be locked. Once the session is closed, unlock it. Locking/Unlocking can be done with the help of the function modules generated by the lock objects (using ABAP).

Hope this may be helpful.

Regards,

Sharin.

0 Kudos
76

Thanks Sharin, for the reply.

Actually we have a range of profit centers. The above solution will not work for range case.