cancel
Showing results for 
Search instead for 
Did you mean: 

Scheduling Locking/unlocking of t-codes

Former Member
0 Kudos

Hi all,

I would like to ask - can we schedule locking/unlocking of specific tcode (say "stms")?? if yes, please describe procedure to do so.

waiting for reply.

Thanks and regards,

Meghan

Accepted Solutions (1)

Accepted Solutions (1)

manu_susankar
Active Contributor
0 Kudos

Hi Meghan Kambli,

You can do it with SHDB t code which record the action and create abap code by editing the code you can customize.... but you should have expert ABAP knowledge to do this.

Regards,

S.Manu.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Meghan,

I hope you got the solution by my latest program.

If yes then please close this question.

Regards,

Alpesh Patel

Former Member
0 Kudos

Hey Alpesh,

Thanks for the reply. But I followed the reply of Manu (since it was simpler). Thanks Manu

Thanks and regards,

Meghan Kambli

Former Member
0 Kudos

Hi

To lock a particular tcode we can do it from SM01

Regards

Bhaskar

Former Member
0 Kudos

Hi bhaskar,

I know tcode can be locked using SM01, but I want to eliminate human interaction.

I want to schedule this particular activity.

Thanks and regards,

Meghan

Former Member
0 Kudos

Hi,

Actually you are not clear what you want. Why you need this type of activity, please provide the reason so that we can give the solution.

Anil

Former Member
0 Kudos

Hi,

Execution of tcodes like COGI in peak hours causes the problem like performance issue (since, lock table becomes full)

I know there are many alternatives like increasing the size of lock table.

But again "I don't want any user to execute tcode COGI in time slot 10 am to 4 pm.". Is it possible???

I hope I'm clear now.

-Thanks and regards

Meghan

Former Member
0 Kudos

Hi,

Use below program and function group.

Program:-

REPORT Z_LOCK_UNLOCK_TRANSACTIONS

LINE-SIZE 80

MESSAGE-ID 00.

TABLES: TSTC.

DATA: LOCK_TEXT(30).

*SELECTION-SCREEN begin.

SELECT-OPTIONS: S_TCODE FOR TSTC-TCODE OBLIGATORY NO INTERVALS.

PARAMETERS: P_LOCK RADIOBUTTON GROUP A,

P_UNLOCK RADIOBUTTON GROUP A DEFAULT 'X'.

AUTHORITY-CHECK OBJECT 'S_TCODE'

ID 'TCD' FIELD 'SM01'.

IF SY-SUBRC NE 0.

MESSAGE E172 WITH TEXT-010.

STOP.

ENDIF.

IF P_LOCK = 'X'.

LOCK_TEXT = TEXT-008.

ELSE.

LOCK_TEXT = TEXT-009.

ENDIF.

LOOP AT S_TCODE.

CALL FUNCTION 'Z_LOCK_UNLOCK_TRANSACTIONS'

EXPORTING

TCODE = S_TCODE-LOW

LOCK = P_LOCK

UNLOCK = P_UNLOCK

EXCEPTIONS

FAIL_TO_LOCK = 1

FAIL_TO_UNLOCK = 2

INVALID_TCODE = 3

INVALID_OPTIONS = 4

TRANSACTION_ALREADY_LOCKED = 5

TRANSACTION_ALREADY_UNLOCKED = 6

OTHERS = 7.

CASE SY-SUBRC.

WHEN 0.

WRITE:/ TEXT-001, S_TCODE-LOW, LOCK_TEXT.

WHEN 1.

WRITE:/ TEXT-002, S_TCODE-LOW.

WHEN 2.

WRITE:/ TEXT-003, S_TCODE-LOW.

WHEN 3.

WRITE:/ TEXT-004, S_TCODE-LOW.

WHEN 4.

WRITE:/ TEXT-005, S_TCODE-LOW.

WHEN 5.

WRITE:/ TEXT-006, S_TCODE-LOW.

WHEN 6.

WRITE:/ TEXT-007, S_TCODE-LOW.

ENDCASE.

ENDLOOP.

Tell your abaper to make a function Z_LOCK_UNLOCK_TRANSACTIONS which lock the tcode in table tstc. To lock any tcode set value of CINFO in table tstc to 20 and to unlock set value 00.

After that create two variant for locking and unlocking and schedule a job in background.

Former Member
0 Kudos

Hi Alpesh,

Thanks for reply, but while executing the program, an error is thrown -the function module "Z_LOCK_UNLOCK_TRANSACTIONS" can not be found in library.

Please let me know source code of this functional module.

Thanks and regards

Meghan

Former Member
0 Kudos

Hi,

Use below program. Create variant and schedule it accordingly.

===============================================

REPORT ZTCODE_LOCKUNLOCK.

  • Program to lock and unlock transactions

*

TABLES: TSTC.

DATA: LOCK_TEXT(30).

*----


  • selection screen

*----


SELECTION-SCREEN begin of block b1 with frame title text-001.

SELECT-OPTIONS: S_TCODE FOR TSTC-TCODE OBLIGATORY NO INTERVALS.

SELECTION-SCREEN end of block b1.

SELECTION-SCREEN begin of block b2 with frame title text-002.

PARAMETERS: P_LOCK RADIOBUTTON GROUP A,

P_UNLOCK RADIOBUTTON GROUP A DEFAULT 'X'.

SELECTION-SCREEN end of block b2.

*----


  • check authority

AUTHORITY-CHECK OBJECT 'S_TCODE'

ID 'TCD' FIELD 'SM01'.

IF SY-SUBRC NE 0.

MESSAGE 'You have not authorization' type 'E'.

STOP.

ENDIF.

IF P_LOCK = 'X'.

PERFORM DATA_LOCK.

ELSEIF P_UNLOCK = 'X'.

PERFORM DATA_UNLOCK.

ENDIF.

&----


*& Form DATA_LOCK

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DATA_LOCK .

LOOP AT S_TCODE.

update tstc set cinfo = 'A4' where tcode = s_tcode-low.

ENDLOOP.

ENDFORM. " DATA_LOCK

&----


*& Form DATA_UNLOCK

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DATA_UNLOCK .

LOOP AT S_TCODE.

update tstc set cinfo = '84' where tcode = s_tcode-low.

ENDLOOP.

ENDFORM. " DATA_UNLOCK

===============================================

Regards,

Alpesh