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

Lock Se38 editor

Former Member
0 Likes
3,348

How to lock editing my program in SE38?

Please let me know.

Thanks in advance.

How to lock editing my program in SE38?

Please let me know.

Thanks in advance.

11 REPLIES 11
Read only

Former Member
0 Likes
2,246

From attributes of program, use editor lock check box to lock program for editing (for other users).

Goto --> Program Attributes --> Tick the checkbox for Editor Lock

~~Guduri

Read only

0 Likes
2,246

hi guduri,

Thats not working, In program attributes I already ticked the editor lock.

Read only

Former Member
0 Likes
2,246

hi,

ABAP Program to Lock/Unlock the ABAP Editor Lock Field .

REPORT ZEDITOR. 

TABLES: TRDIR. "System table TRDIR 

PARAMETERS: PROGRAM LIKE TRDIR-NAME. 
PARAMETERS: EDITOR  LIKE TRDIR-EDTX. 

SELECT SINGLE * FROM TRDIR WHERE NAME = PROGRAM. 

TRDIR-EDTX = EDITOR. 
MODIFY TRDIR. 
IF SY-SUBRC EQ 0. 
   WRITE: / 'Editor Lock update Successful ', TRDIR-NAME. 
   IF TRDIR-EDTX = 'X'. 
      WRITE: ' Lock'. 
   ELSE. 
      WRITE: ' UnLock'. 
   ENDIF. 
ELSE. 
   WRITE: / 'Editor Lock update Unsuccessful ', TRDIR-NAME. 
ENDIF.

regards,

Ashok Reddy

Read only

0 Likes
2,246

above given program only showing in output program is locked.

but when i am opening in se38, i can also change/erase manupulate my code,

i wish to lock it completely.

Read only

0 Likes
2,246

May be u can, because u created the code.

Is anybody else able to do that?

Thanks

Ganesh.S

Read only

Former Member
0 Likes
2,246

attribute screen set lock flag.

chech box->tick it

Read only

former_member189059
Active Contributor
0 Likes
2,246

try this program... but i warn you... you cannot get the source code back.. so make a backup first

REPORT  Z_HIDER.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE lv_frttl.
  PARAMETERS: program LIKE sy-repid.
SELECTION-SCREEN END OF BLOCK b1.

DATA: gt_code(72)  TYPE c OCCURS 0,
      gv_code      LIKE LINE OF gt_code,
      gt_code2(72) TYPE c OCCURS 0.

INITIALIZATION.
* sets the value for the title of the parameters block
  lv_frttl = 'Parameters'.

START-OF-SELECTION.

  READ REPORT program INTO gt_code.

  APPEND '*@#@@[SAP]' TO gt_code2.
  LOOP AT gt_code INTO gv_code.
    APPEND gv_code TO gt_code2.
  ENDLOOP.

  INSERT REPORT program FROM gt_code2.

* print unhidden source code for backup issues
  LOOP AT gt_code INTO gv_code.
    WRITE: / gv_code.
  ENDLOOP. "LOOP AT gt_code INTO gv_code

Read only

former_member196280
Active Contributor
0 Likes
2,246

GOTO SM01 where you can lock all tcodes.

Regards,

SaiRam

Read only

Former Member
0 Likes
2,246

Hi Anil....

see for first time it will be in unlock only ... there is no programatic to lock for the person how write the program even to lock for him ...

if you want really to lock .. the basis can do by not giving the Authorisation to se38 to chane ... only Display rights ... so that even the programmer who was developled can not be able to change it .

otherwise programmatically you can lock for others but it will be given to change mode to the program who has developed .

before that

'Reasons for Setting Locks

Suppose a travel agent want to book a flight. The customer wants to fly to a particular city with a certain airline on a certain day. The booking must only be possible if there are still free places on the flight. To avoid the possibility of overbooking, the database entry corresponding to the flight must be locked against access from other transactions. This ensures that one user can find out the number of free places, make the booking, and change the number of free places without the data being changed in the meantime by another transaction.

'Lock Mechanisms in the Database System

The database system automatically sets database locks when it receives change statements (INSERT, UPDATE, MODIFY, DELETE) from a program. Database locks are physical locks on the database entries affected by these statements. You can only set a lock for an existing database entry, since the lock mechanism uses a lock flag in the entry. These flags are automatically deleted in each database commit. This means that database locks can never be set for longer than a single database LUW; in other words, a single dialog step in an R/3 application program.

Physical locks in the database system are therefore insufficient for the requirements of an R/3 transaction. Locks in the R/3 System must remain set for the duration of a whole SAP LUW, that is, over several dialog steps. They must also be capable of being handled by different work processes and even different application servers. Consequently, each lock must apply on all servers in that R/3 System.

'SAP Locks

To complement the SAP LUW concept, in which bundled database changes are made in a single database LUW, the R/3 System also contains a lock mechanism, fully independent of database locks, that allows you to set a lock that spans several dialog steps. These locks are known as SAP locks.

The SAP lock concept is based on lock objects. Lock objects allow you to set an SAP lock for an entire application object. An application object consists of one or more entries in a database table, or entries from more than one database table that are linked using foreign key relationships.

Before you can set an SAP lock in an ABAP program, you must first create a lock object in the ABAP Dictionary. A lock object definition contains the database tables and their key fields on the basis of which you want to set a lock. When you create a lock object, the system automatically generates two function modules with the names ENQUEUE_<lock object name> and DEQUEUE_<lock object name> . You can then set and release SAP locks in your ABAP program by calling these function modules in a CALL FUNCTION statement.

Unlike the database, which sets physical locks, the SAP lock mechanism sets logical locks. This means that

A locked database entry is not physically locked in the database table.

The lock entry is merely entered as a lock argument in the central R/3 lock table. The lock argument is made up of the primary key field values for the tables in the lock object. These are import parameters of the enqueue function module. The lock is independent of database LUWs. It is released either implicitly when the database update or the SAP transaction ends, or explicitly, using the corresponding dequeue function module. You can use a special parameter in the update function module to set the exact point at which the lock is released during the database update.

A locked entry does not necessarily have to exist in a database table.

You can, for example, set a lock as a precaution for a database entry that is not written to the database until the update at the end of the SAP LUW.

The effectiveness of the locks depends on cooperative application programming.

Since there are no physical locks in the database tables themselves, all programs that use the same application objects must look in the central table themselves for any locks. There is no mechanism that automatically prevents a program from ignoring the locks in the lock table.

Lock Types

"There are two types of lock in the R/3 System:

'Shared lock

Shared locks (or read locks) allow you to prevent data from being changed while you are reading it. They prevent other programs from setting an exclusive lock (write lock) to change the object. It does not, however, prevent other programs from setting further read locks.

'Exclusive lock

Exclusive locks (or write locks) allow you to prevent data from being changed while you are changing it yourself. An exclusive lock, as its name suggests, locks an application object for exclusive use by the program that sets it. No other program can then set either a shared lock or an exclusive lock for the same application object.

'Lock Duration

When you set a lock, you should bear in mind that if it remains set for a long time, the availability of the object to other transactions is reduced. Whether or not this is acceptable depends on the nature of the task your program is performing.

Remember in particular that setting too many shared locks without good reason can have a considerable effect on programs that work with database tables. If several programs running concurrently all set a shared lock for the same application object in the system, it can make it almost impossible to set an exclusive lock, since the program that needs to set that lock will be unable to find any time when there are no locks at all set for that object. Conversely, a single exclusive lock prevents all other programs from reading the locked object.

At the end of an SAP LUW, you should release all locks. This either happens automatically during the database update, or explicitly, when you call the corresponding dequeue function module. Locks that are not linked to a database update are released at the end of the SAP transaction.

<b>SAP Lock Entries</b>

If there is a sudden power failures, some of the users update entries might still be locked.

You can check or release the locked entries using transaction SM12.

You can check the lock entries of individual users or key an * at the user name to check all the users lock entries.

The lock entry list shows you the users who is locking the entry, the time when the lock was initiated, the table that was locked as well as the locked records.

If possible, asked the user to logoff first before deleting the locked.entries.

For locking individual transactions code,used SM01. Putting a tick at the Locked columns will prevent allusers from using the transactions code.

To lock individual user goto transactionSU01. Click the Lock/Unlock button.

To lock multiple users (ver 4.6x)

SU10 - User Maintenance Mass Changes

click Address

Execute

Select all -> untick users you are not changing

click Transfer

Select users

click Lock/Unlock - depending whether you want to Lock or Unlock (Pleasebe careful because once you lock all the users including yourself, youwill not be able to Unlock it.)

RSUSR006 - List of UsersMaster Records Locked Due to Incorrect Logon

List of all Users Locked

SE16 - Data Browser

Table -> USR02

Field -> UFLAG <> 0

In 4.6x, you can used the SAP standard lock/unlockprogram EWULKUSR ortransaction EWZ5.

reward points if it is usefull ...

Girish

Read only

Former Member
0 Likes
2,246

Hi Anil,

<b>Very simply you cannot lock editing of program for yourself.</b>

You can lock it from being edited by other by Selecting 'EDITOR LOCK' in Attributes.

As some people said you can remove authorization for SE38 itself but I guess you want to access SE38.Since in that case you will not be able to access the transaction. Ya but in case you are wondering or you want a transaction to just execute the program and not do anything else then you can use <b>SA38</b>

But Just for curiosity, why do you want to lock the code for yourself?

Hope this helps

Regards

Nishant

Read only

Former Member
0 Likes
2,246

hi,

in se38 goto --> attributes ---> check editor lock. By doing this your code would be visible to different developers(with different user id's & password) but they cant edit it.

hope it helps u.

thnx & rgds.

plz reward points if it helps