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

Locking o Report

Former Member
0 Likes
1,923

hey can any one tell me how can i lock the Z Report, means i have mad report on MSEG and MKPF table, i want that if one user is processing that report at the same time other user shud not be able to process the same report, i hope i have cleared my query.

abhishek

hey can any one tell me how can i lock the Z Report, means i have mad report on MSEG and MKPF table, i want that if one user is processing that report at the same time other user shud not be able to process the same report, i hope i have cleared my query.

abhishek

6 REPLIES 6
Read only

Former Member
0 Likes
1,234

Hi Abhishek,

The following code will help you.

Regards,

Suvan

REPORT ZPROGRAM.

************************************************************************

*******

  • Prevent the program from having more than one instance running the

*same time.

  • Create this macro in TRMAC using SM31

  • Insert the following single line in the program right after the

  • REPORT statement: ZCHK_MYSELF_RUNNING SY-REPID.

************************************************************************

*******

define my_macro.

DATA: PRG LIKE INDX-SRTFD.

PRG = &1.

CALL FUNCTION 'ENQUEUE_ESINDX'

EXPORTING

*RELID = 'ZZ'

SRTFD = PRG

*SRTF2 = 0

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2.

IF SY-SUBRC NE 0.

WRITE: 'ERROR:', PRG, 'is already running'.

EXIT.

ENDIF.

end-of-definition.

my_macro 'ZPROGRAM'.

*******

Note that the program name is 'ZPROGRAM'.

Read only

Former Member
0 Likes
1,234
Read only

Former Member
0 Likes
1,234

Hi,

Use lock object ES_PROG and the relevant FMs

DEQUEUE_ES_PROG - setting lock object

ENQUEUE_ES_PROG - releasing lock object

Svetlin

Read only

Former Member
0 Likes
1,234
Lock/Unlock the ABAP Editor Lock Field 

REPORT ZEDITOR. 

TABLES: TRDIR. "System table TRDIR 

PARAMETERS: PROGRAM LIKE TRDIR-NAME. 
PARAMETERS: EDITOR  LIKE TRDIR-EDTX. 

SELECT SINGLE * FROM TRDIR WHERE NAME = PROGRAM. 

TRDIR-EDTX = EDITOR. 
MODIFY TRDIR. 
IF SY-SUBRC EQ 0. 
   WRITE: / 'Editor Lock update Successful ', TRDIR-NAME. 
   IF TRDIR-EDTX = 'X'. 
      WRITE: ' Lock'. 
   ELSE. 
      WRITE: ' UnLock'. 
   ENDIF. 
ELSE. 
   WRITE: / 'Editor Lock update Unsuccessful ', TRDIR-NAME. 
ENDIF.
Read only

0 Likes
1,234

Hi Judith,

This is editor lock that you are talking about here. Point in question is different. This will prevent other people from modifying the program whereas the point of discussion is how to prevent two user from simultaneously running the same program. This has been discussed several times on this forum and some of the solutions/links given above are valid.

Cheers,

Sanjeev

Read only

Former Member
0 Likes
1,234

ENQUEUE AND DEQUEUE FM's are related to locking concept.

Goto se37 enter these and press F4. you will get list of FM's. To see how a particular FM can be used , press 'WHERE USED LIST' button

just a tip not detail.try above suggestions.

regards