2013 Sep 30 9:03 AM
Hello techies ,
i want to check that a tcode is locked or no in a particular line of a program .
i need to check first whether the tcode is locked or no , if locked i need to do some operation and if unlocked i need to do another operation .
Thanks and Regards ,
Praveen Bindla.
2013 Sep 30 9:29 AM
2013 Sep 30 2:26 PM
Hello mam,
The link u provided is for how to lock to tcode , but i need to check whether the tcode is locked or not .
2013 Sep 30 10:00 AM
Hi,
you can use this Fms 'RSAU_WRITE_SM01_LOG'
CALL FUNCTION 'RSAU_WRITE_SM01_LOG'
EXPORTING
TCODE = TSTC-TCODE
LOCK = 'X'
CALL FUNCTION 'RSAU_WRITE_SM01_LOG'
EXPORTING
TCODE = TSTC-TCODE
UNLOCK = 'X'
2013 Sep 30 2:23 PM
Hello Kiran,
i have a requirement to check whether a tcode is locked or no , but i dont need it to be locked or unlocked .
2013 Sep 30 10:12 AM
Hi,
the lock information is in table TSTC in field CINFO:
data: x20 type x value '20'.
if tstc-cinfo o x20. "Then tcode is locked
* execute some code
endif.
if tstc-cinfo z x20. "Then tcode isn't locked.
* execute some code
endif.
Regards,
Klaus
2013 Sep 30 2:22 PM
Hi Klaus ,
i had a same idea like you , but haven't tried yet , since i dont have an access to the tcode to which i need to check the lock .
So can you provide one example , like i created a tcode for a program and using that tcode in some and tried to test , but i have have no idea how to put a lock entry to my tcode created .
2013 Sep 30 2:29 PM
You can lock a transaction code with transaction SM01. ( Do not lock SM01 with this transaction for obvious reasons !!)
2013 Sep 30 2:46 PM
hello peter ,
i need to check whether the tcode is locked or no
2013 Sep 30 2:56 PM
I answered your question:
"but i have have no idea how to put a lock entry to my tcode created"
The answer where you can check the lock was already given (table TSTC) by
2013 Sep 30 3:27 PM
Hi Praveen Bindla,
You can use a standard program,(RSAUDITC), to check transaction is locked or not.
Mark the parameters is necessary to you and result is a ALV with status of transaction.
Regards.
2013 Sep 30 3:44 PM
hello rodolfo ,
the standard program which u have given is not existing in my system .
2013 Sep 30 3:50 PM
2013 Sep 30 3:53 PM
2013 Sep 30 4:04 PM
Try to call FM AUTHORITY_CHECK_TCODE on a transaction you locked with SM01, you will receive error NOT_OK, and in SY structure the message 348(s#) "Transaction &1 is locked (in transaction SM01)" (SY-MSGID = "S#" and SY-MSGNO = 348).
You could also read the documentation at the start of this FM.
Regards,
Raymond
2013 Sep 30 6:38 PM
Hi, Praveen Bindla
the code of this program is very simple.
* Declarations
SELECT-OPTIONS: TCODE FOR tstc-tcode.
PARAMETERS:
s_lock AS CHECKBOX DEFAULT gc_true,
S_UNLOCK AS CHECKBOX DEFAULT gc_false.
DATA:
lv_lock_sel TYPE x.
DATA:
gt_result TYPE tt_alv_list.
* First Step - Get data from TSTC
SELECT * FROM tstc
INTO CORRESPONDING FIELDS OF TABLE gt_result
WHERE tcode IN tcode.
* Second Step - Filtering registers
IF s_lock = 'X' AND s_unlock = 'X'.
lv_lock_sel = 0. "get both, unlocked and locked tcodes
ELSEIF s_lock = 'X'.
lv_lock_sel = 1. "show only locked tcodes
ELSE.
lv_lock_sel = 2. "show only unlocked tcodes
ENDIF.
CASE lv_lock_sel.
WHEN 1. "show only locked tcd
DELETE gt_result WHERE NOT ( cinfo O '20' ).
WHEN 2. "show only unlocked tcd
DELETE gt_result WHERE cinfo O '20'.
ENDCASE.
Regards.