Application Development and Automation 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: 
Read only

Lock in parameter/select-options field

Former Member
0 Likes
2,049

Hi,

How can we block another user from executing report with the same value of parameter/select-option field entered on screen by user?

for example:

Report ZZZ, parameter field sales org = A, run by user 1.

Another user, say B, attempts to run the report by entering the same sales org = A. In these second execution of the report, I need to display error message saying that user A is running the report then report cant be run by user B.

Do i need to put lock object for these?

thanks alots

Alia

1 ACCEPTED SOLUTION
Read only

Vinod_Chandran
Active Contributor
0 Likes
1,243

Hi Alia,

Try creating a lock object with the parameters you want to check. This can be from different database tables. Then in the start of selection call the lock object with the parameters given. If another user run the program with the same parameters, the locking will fail and you can give an error message and exit from the program.

Cheers

Vinod

5 REPLIES 5
Read only

Former Member
0 Likes
1,243

No, there is no mechanism to restrict in that way.

but you can create a Z-table with one column (vkorg)

now make a little change in the report..

1.check if any entry of vkorg is there in that z-table.

if not proceed, else error msg.

2.craete an entry of that vkog in that z-table.

3.Normal processing of this report.

4.at end delete that entry of vkorg from z-table.

thus you can achieve mutual exclusion.

cheers.

Message was edited by: Anid

Read only

Vinod_Chandran
Active Contributor
0 Likes
1,244

Hi Alia,

Try creating a lock object with the parameters you want to check. This can be from different database tables. Then in the start of selection call the lock object with the parameters given. If another user run the program with the same parameters, the locking will fail and you can give an error message and exit from the program.

Cheers

Vinod

Read only

0 Likes
1,243

Hi all,

thanks alots for the given solution. I use lock object and can work perfectly.

again, huge thanks

Alia

Read only

andreas_mann3
Active Contributor
0 Likes
1,243

Hi ,

otr try that (without lock object):


  sptab-TABNAME = 'TVKO'.
  concatenate sy-mandt 'A' into sptab-VARKEY .

  CALL FUNCTION 'ENQUEUE_E_TABLE'
       EXPORTING
            TABNAME        = sptab-TABNAME
            VARKEY         = sptab-VARKEY
       EXCEPTIONS
            FOREIGN_LOCK   = 1
            SYSTEM_FAILURE = 2
            OTHERS         = 3.

Andreas

Read only

0 Likes
1,243

Hi Andreas.

Thanks alots. I have tried your solution, can work. I no need to create own lock object.

Thanks!!

Alia