2012 Jan 27 10:21 AM
Dear Guys ,
i have made a custom screen that has 2 buttons that shows the previous and the next record.
IMy scanario is the following :
Two users logon to the screen and hit the previous button that shows that previous record.
The first locks the record with the Enque_...... .
How can i show the record to the second user without the message "the record is locked .....".
I try the following
CALL FUNCTION 'ENQUEUE_EYPROJECTS'
EXPORTING
MODE_YPROJECTS = 'S'
MANDT = SY-MANDT
BUKRS = yprojects-bukrs
PROJECT = yprojects-project
* X_BUKRS = ' '
* X_PROJECT = ' '
* _SCOPE = '2'
* _WAIT = ' '
* _COLLECT = ' '
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
2012 Jan 27 10:33 AM
The idea is to check if the lock already exists using ENQUEUE_READ( referring the field GTARG ) instead of trying it to lock again
2012 Jan 27 10:27 AM
When first record is seen it is locked and when 2nd user will try to lock it this lock will fail and he will see error message.
2012 Jan 27 10:33 AM
The idea is to check if the lock already exists using ENQUEUE_READ( referring the field GTARG ) instead of trying it to lock again
2012 Jan 27 11:13 AM
The idea is to check if the lock already exists using ENQUEUE_READ( referring the field GTARG ) instead of trying it to lock again
I don't think this is completely correct! All ENQUEUE modules have an exception FOREIGN_LOCK which is raised when lock requests are rejected.
EXPORTING
MODE_YPROJECTS = 'S' "--> (S)hared
OP has used the lock mode as 'S' hence requests for subsequent locks are processed successfully ->
Requests for further shared locks are accepted, even if they are issued by different users
source: SAP F1 help.
He should use the mode as (E)xclusive so that further locks for the same object are rejected.
Let me know your thoughts!
BR,
Suhas
2012 Jan 27 11:40 AM
Suhas .. When you question it .. I always feel that there would be something in it. .Frankly speaking.. I did not notice that it was shared lock used.
He should use the mode as (E)xclusive so that further locks for the same object are rejected.
Thumbs up. Hope OP is listening what is being commented here.
Kesav