how to restrict the report execution for 5 times when users run at same time in parallel
As apart of performance i need to restrict the one custom report execution for 5 times only when users executed at the same time in parallel.
Kumar Gaurav replied
As Rajesh suggested limit the number of people having authoriztion.
I can think of a work around.
Create a customizing table say with just 2 key feilds
Report name and Lock index .
Say if you want the report to restrict to five user then matintain 5 rows and with same report name and lock index
Check the below code
DATA : v_key TYPE rstable-varkey,
v_flag_ok TYPE char1.
*zconfig has keys mandt repname lockindex.
SELECT * FROM zconfig
INTO TABLE it_zconfig WHERE repname = sy-repid.
IF sy-subrc = 0.
LOOP AT it_zconfig ASSIGNING <fs_zconfig>.
CONCATENATE <fs_zconfig>-mandt <fs_zconfig>-repname <fs_zconfig>-lockindex
CALL FUNCTION 'ENQUEUE_E_TABLE'
* MODE_RSTABLE = 'E'
tabname = zconfig
varkey = v_key
* X_TABNAME = ' '
* X_VARKEY = ' '
* _SCOPE = '2'
* _WAIT = ' '
* _COLLECT = ' '
foreign_lock = 1
system_failure = 2
OTHERS = 3
IF sy-subrc <> 0.
v_flag_ok = 'X'.
IF v_flag_ok IS INITIAL.
MESSAGE 'Max no. of user reached! cannot run report ' TYPE 'E'.