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

Need to lock tcode in program .

Former Member
0 Likes
2,895

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.

15 REPLIES 15
Read only

Former Member
0 Likes
2,372

This message was moderated.

Read only

0 Likes
2,372

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 .

Read only

Former Member
0 Likes
2,372

Hi,

you can use this Fms 'RSAU_WRITE_SM01_LOG'   

  • For locking

  CALL FUNCTION 'RSAU_WRITE_SM01_LOG'    

EXPORTING       

  TCODE           = TSTC-TCODE         

  LOCK              = 'X'

  • For unlocking

CALL FUNCTION 'RSAU_WRITE_SM01_LOG'

      EXPORTING

          TCODE           = TSTC-TCODE

          UNLOCK            = 'X'

Read only

0 Likes
2,372

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 .

Read only

Former Member
0 Likes
2,372

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

Read only

0 Likes
2,372

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 .

Read only

0 Likes
2,372

You can lock a transaction code with transaction SM01. ( Do not lock SM01 with this transaction for obvious reasons !!)

Read only

0 Likes
2,372

hello peter ,

                      i need to check whether the tcode is locked or no

Read only

0 Likes
2,372

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

Silver

Read only

0 Likes
2,372

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.

Read only

0 Likes
2,372

hello rodolfo ,

                     the standard program which u have given is not existing in my system .

Read only

0 Likes
2,372

What is your version ?

Regards,

Raymond

Read only

0 Likes
2,372

Hello raymond ,

                         The issue is in BW system . mine is 720 v

Read only

0 Likes
2,372

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

Read only

0 Likes
2,372

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.