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: 

Restricting users using the same transaction at the same time to display

Former Member
0 Kudos

Hello Experts,

My requirement is user will put a value in one field on selection screen. In case the current user is running the report, the same time any other user should not be able to display the report for the same value entered in the field on the selection screen.

How it could be done? I could not use table lock because the field is not a key in the table.

Whether the authority check could be used in this case? If yes,how.

Please suggest.

Thanks,

Rahul

7 REPLIES 7

Clemenss
Active Contributor
0 Kudos

Hi Rahul,

you can set just any lock on the program name. There is one generic lock object which is used for customizing tables: Edit anything in customizing, check lock object in SM12 lock overview. Use this l,ock object with parameter table pass your program name.

If lock fails because of foreign lock (someone else uses report), finish with E message.

Regards

Clemens

Former Member
0 Kudos

Hello Clemens,

Thanks for the reply. But i do not want to set the lock on the program based on the program name only.

My requirement is to check if the entry in selection screen entered by two users are same.

If yes, only the first user should be able to display the report while for the other it should through the error messeage.

Please suggest a way in which i could check for the field values in the selection screen and restrict the access based on the same.

That means parameters in which i could pass the field name and field values.

Thanks,

Rahul

Former Member
0 Kudos

Hi ,

you can use order save badi where u can use enque concept to prevent 2 user using at the same time

Best regards,

sarveshvaran

Former Member
0 Kudos

Hi,

do one this :

1. After enter value in selection screen , you should the save the values in global field for each field, if any another person try to enter the same values before u can check the global values and display error message.

or u should lock the report by using the following function.

CALL FUNCTION 'THUSRINFO'

TABLES

usr_tabl = itab.

regards,

moon

Clemenss
Active Contributor
0 Kudos

Hi Rahul,

I hope I get your request right:

You do not want more than one user to have exactly the same values in selection screen.

Are you aware that a selection screen may have rather complex values in extended selections? That means even if the selection screen is filled in a different way, the same data may be selected.

Example: You have 4 document types in system, A, B, C, D. One users excludes A B C and the other one selects only D. Result is same. And what abaout one users wants A and B, the other one B and C. Allowed?

If it is only required that the selection screen content is different, I'd know a solution but do not see any comprehensible business reason.

If you want to restrict the results, it will be far more complex, then you have still the question of allowed Disjoint or Intersection union of results.

And here I do not see any possible reason not allowing two users to see the same data. What if one is lokking over the other's shoulder???

The best thing will be, you give one or two simple examples of what is allowed and what is not and why - best is using specific tangible things.

Regards

Clemens

StMou
Active Participant
0 Kudos

Hi,

Create a structure and put a lock on it.

Se lock object E_BGRFC_I_SERV_R for example.

Rgds

deepak_dhamat
Active Contributor
0 Kudos

Hi Rahul ,

You can do what you required but for that you have to take little more effort .

step to follow

1) Create one table ZPROGRAM_LOCK

MANDT MANDT CLNT 3 0 Client

PROGRAM_NAME PRGNAME CHAR 40 0 Program Name

VARIANT_NAME VARNA CHAR 14 0 ABAP variant name

IS_RUNNING CHAR 1 0 Running or not

USNAM USNAM CHAR 12 0 User Name

CPUDT CPUDT DATS 8 0 Day On Which Accounting Document Was Entered

ACTUSER N2_UTERM CHAR 20 0 Terminal Identification

2) IN your report Write logic to check entry in table whether the program is running or not

select single actuser

into p_terminal

from zprogram_lock

where program_name in ('ZPR133_A2_OUTPUT_BOOKING','ZPR133_F3_OUTPUT_BOOKING','ZPR133_IQ_OUTPUT_BOOKING').

if not p_terminal is initial.

concatenate 'Program already running on termial-' p_terminal '. Please try after some time.!!!' into p_run .

message p_run type 'I'.

is_ok = 'N'.

else.

wa_itab-mandt = sy-mandt.

wa_itab-program_name = sy-repid.

wa_itab-variant_name = ''.

wa_itab-is_running = 'Y'.

wa_itab-usnam = sy-uname.

wa_itab-cpudt = sy-datum.

call function 'ISH_N2_GET_TERMINAL_ID'

importing

ss_terminal = wa_itab-actuser.

insert into zprogram_lock values wa_itab.

commit work.

endif.

3) Then you can pass program name and varient to another function module to get tdetails of parameter so that you can check with your program .

YOu can use function module RS_COVERPAGE_SELECTIONS or RS_REFRESH_FROM_SELECTOPTIONS .

i hope this will help .

Regards

Deepak.