‎2006 Dec 11 12:35 PM
Hi all,
i use the above FMs in this case.
REPORT ZGRO_TEST1 MESSAGE-ID ZZ.
*
PARAMETERS: P_LOCK RADIOBUTTON GROUP PRI1 DEFAULT 'X',
P_UNLOCK RADIOBUTTON GROUP PRI1.
*
DATA: TABLE LIKE RSTABLE-TABNAME VALUE 'MSEG'.
START-OF-SELECTION.
*
CASE P_LOCK.
*
WHEN 'X'.
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
TABNAME = TABLE
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
*
IF SY-SUBRC <> 0.
WRITE: / 'P_LOCK', SY-SUBRC.
EXIT.
ENDIF.
*
WHEN OTHERS.
*
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
TABNAME = TABLE
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
*
IF SY-SUBRC <> 0.
WRITE: / 'P_UNLOCK', SY-SUBRC.
EXIT.
ENDIF.
*
ENDCASE.
*
END-OF-SELECTION.
When i run with P_LOCK = 'X' and look in SM12 nothing is locked.
What mistake is in my report?
Regards, Dieter
‎2006 Dec 11 12:41 PM
Hello Dieter,
The problem is that SAP will automatically release all the locks if the program/transaction has terminated sucessfully. So by the time you look in transaction SM12, ZGRO_TEST1 has ended and the locks are released.
Regards,
Manoj
‎2006 Dec 11 12:58 PM
Hi Manoj,
thanks for your answer.
Do you see another possibility to lock/unlock a table
after the report ends?
Regards, Dieter
‎2006 Dec 11 1:04 PM
‎2006 Dec 11 1:37 PM
Hi Manoj,
what i want is this.
We have our Inventory. I don't whant to lock Tcodes via SM01.
I will lock MKPF and MSEG for about 12 hours.
Therefor i tried it via a report.
Your answer show to me, that this isn't possible.
Therefore i look for another possibility to lock MKPF/MSEG.
Regards, Dieter
‎2006 Dec 12 4:41 AM
Hello Dieter,
Your tables (In this case MKPF/MSEG) can be locked only for the duration of your program. If your program is running for 12 hours (say a monthly report or so), then you can lock your tables at the beginning of your program and they will remain locked till the program ends. But once the program ends the locks will be released and the tables will be accessible to other programs/users. If you want to lock your tables even after the program ends, then you have to lock the transaction with SM01.
Regards,
Manoj
‎2006 Dec 11 12:58 PM
As soon as program execution is finished all locks will be realeased..
You debug the program and check in sm12 simultaneously , at one point of program table will be locked and it will be released as soon as program execution is finished..
Reward if usefull..
Let me know if you want more clarification..
‎2006 Dec 11 1:13 PM
Hi
i executed ur program and checked the entries in sm12.
there exists an entry in sm12 for the program code in TRDIR table .
it shows an exclusive lock placed on the table which could be deleted as well
by checking the other radiobutton.
i suggest you to check the locked entry in TRDIR table , by entering your program name in the selection screen .
plz revert if the issue persists
Regards
Pankaj