Skip to Content
author's profile photo Former Member
Former Member

How to lock transaction codes in ABAP report

Hello all,

I'm now planning to lock several transaction codes as a batch job to prevent end users from using locked tr-cds while processing batch jobs during online service period.

I found out tr-cd: SM01 to lock tr-cds, but I don't get what I can do with this tr-cd when you want to execute this as a background job.

I suppose I can make it by using transaction recorder or call transaction.

But I want to do this in smarter manner (like executing certain report PGM with a variant containing tr-cds to be locked).

I rather prefer using FM or BAPI to using transaction recorder etc if possible...

If you know anything on this issue, please please help me..

Hozy

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Sep 17, 2009 at 01:57 PM

    Hi

    Use

    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'

      Regards,

      Sreeram

      Add a comment
      10|10000 characters needed characters exceeded

      • Hi Mark,

        i tried using your code, it locked my table, but unfortunately it didnt help me with my problem
        i wanted to lock TCODES so that user can not access the tcodes while batch is running.
        using above code, locked all users from accessing this tcode however my batch process calls this tocde internaly and process was not unable to access this.
        can we somehow restrict to all users except one ID thyough which process has been started.

        Thanks,

        Rishabh

    • author's profile photo Former Member
      Former Member
      Posted on Sep 17, 2009 at 01:48 PM

      Hi,

      Well you can use the Function Module 'RSAU_WRITE_SM01_LOG' in your program. SM01 uses this FM internally to lock/unlock the Tcodes.

      Regards,

      Sachin.

      Add a comment
      10|10000 characters needed characters exceeded

    • author's profile photo Former Member
      Former Member
      Posted on Sep 17, 2009 at 02:06 PM

      Hi, thank you all !

      But I tried the following and couldn't make it....

      -


      DATA: VL_TCODE TYPE TSTC-TCODE.

      VL_TCODE = 'SU3'.

      CALL FUNCTION 'RSAU_WRITE_SM01_LOG'

      EXPORTING

      TCODE = VL_TCODE

      LOCK = 'X'

      • UNLOCK = ''

      EXCEPTIONS

      PARAMETER_ERROR = 1

      OTHERS = 2

      .

      -


      After executing the above, I could go to SU03 unfortunately...

      I'm using ECC6.0 with SAP_BASIS 700-18 or SAP_ABA 700-18.

      Could you give me a bit more help?

      thanks in advance,

      Hozy

      Add a comment
      10|10000 characters needed characters exceeded

    Before answering

    You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
    You must be Logged in to submit an answer.

    Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.