08-01-2005 3:40 PM
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
08-01-2005 3:58 PM
Here some code that works for me.
* Make sure that no one else is running this program
* This is the locking mechanism for this program.
PROGRAM = SY-REPID.
CALL FUNCTION 'ENQUEUE_ESINDX'
EXPORTING
SRTFD = PROGRAM_NAME
SRTF2 = 0
_WAIT = 2
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2.
IF SY-SUBRC <> 0.
* Give message that someone is running the program
ENDIF.
Regards,
Rich Heilman
08-01-2005 3:58 PM
Here some code that works for me.
* Make sure that no one else is running this program
* This is the locking mechanism for this program.
PROGRAM = SY-REPID.
CALL FUNCTION 'ENQUEUE_ESINDX'
EXPORTING
SRTFD = PROGRAM_NAME
SRTF2 = 0
_WAIT = 2
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2.
IF SY-SUBRC <> 0.
* Give message that someone is running the program
ENDIF.
Regards,
Rich Heilman
08-02-2005 6:39 AM
08-02-2005 7:03 AM
dear rich
this function i working fine where name of programe is less than 22 chars but gives dump when it crosses 22 chars.
abhishek
08-02-2005 7:23 AM
Hi abhishek,
import-parameter SRTFD of fm is defined
as INDX-SRTFD (= char 22)
i don't know if it's useful to copy and modify fm (?)
can't you rename your program ?
regards Andreas
08-02-2005 7:28 AM
ya i can do that renaming programe name but i have to again assign to the same t-code renaming the programe option is there but can't we do it for more than 22 chars.
abhishek
08-02-2005 9:35 AM
Hi
Don't copy the function module! It's a generated lock object one.
The technique being used here is to re-use a lock object that relates to a generic system table.
As SAP locking is logical, not physical, it doesn't really matter that a generic system table is used here,
as there is very low likelihood of people conflicting with the lock argument.
However, the INDX table has only a 22 character key.
Why don't you create your own 'Z' lock object. Do a where-used list on view TRDIR for other
lock objects using it. Use one of them as a template.
It'll take you 15 minutes and you'll learn all about locking.
Then just call your new generated lock function module as above.
Cheers
Dom
Reference:
http://help.sap.com/saphelp_nw04/helpdata/en/a2/3547360f2ea61fe10000009b38f839/frameset.htm
08-01-2005 4:00 PM
Hi,
Just use the standard Lock object : http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/frameset.htm
(see also The SAP Lock Concept (BC-CST-EQ) )
Regards
Frédéric
08-02-2005 4:42 AM
Check this link
http://help.sap.com/saphelp_nw04/helpdata/en/41/7af4c8a79e11d1950f0000e82de14a/content.htm
http://www.geocities.com/SiliconValley/Grid/4858/sap/ABAPCode/LockUsers.htm
Message was edited by: Judith Jessie Selvi
08-02-2005 4:56 AM
Hello Judith,
Please do spend some time reading and understanding the question. Editor Lock has got a different functionality. It allows only the creator of the program to modify it. Which is certainly not what is being asked.
And further it is not a good idea to mainuplate the TADIR/TRDIR and other such tables directly.
Once again, I must tell you to make sure that your response is relevant. Irrelevant and misleading answers may be subject to censoring. And I don't generally want to do that.
Regards,
Anand Mandalika.