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

locking the editor

Former Member
0 Likes
731

experts,

even after using the editor lock in the attirbutes of a program the souce code when in change mode is being opened in the change mode through sm12 (by deleting lock entry for the report) how to restrict the source code when being in change mode should not be opened in change mode

with regards.

5 REPLIES 5
Read only

Former Member
0 Likes
667

try this...

REPORT z_deep_hide .

************************************************************************

  • This program hides any ABAP's source code and protects it with a

  • password in this source code.

*

  • After hiding, you can still run the abap (the load version is intact)

  • but it cannot be displayed, edited, traced, transported or generated.

*

  • If the ABAP is not hidden, the program hides it, if it is hidden, it

  • unhide it.

  • Remember to hide this program first

************************************************************************

TABLES:tstc.

TABLES: trdir.

SELECTION-SCREEN BEGIN OF BLOCK block.

PARAMETERS: program(30) OBLIGATORY.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(8) pwd.

SELECTION-SCREEN POSITION 35.

PARAMETERS: password(8) MODIF ID aaa.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK block.

DATA: message(60) TYPE c.

********************************************

INITIALIZATION.

pwd = 'Password'.

********************************************

*********************************************

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF screen-group1 = 'AAA'.

screen-invisible = '1'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

START-OF-SELECTION.

  • User name and password check

IF password <> sy-uname.

WRITE: / 'Wrong password'.

EXIT.

ENDIF.

  • Check for SAP owned

IF NOT program CP 'Z' AND NOT program CP 'Y'.

WRITE: / 'Do not hide original SAP programs!'.

EXIT.

ENDIF.

    • check if program exists

*select single * from trdir where name = program.

*if sy-subrc <> 0.

*write: / 'Program does not exists!'.

*exit.

*endif.

*

    • Does it have a current generated version?

*data: f1 type d, f3 type d.

*data: f2 type t, f4 type t.

*EXEC SQL.

*SELECT UDAT, UTIME, SDAT, STIME INTO :F1, :F2, :F3, :F4 FROM D010LINF

*WHERE PROG = :PROGRAM

*ENDEXEC.

*

*if f1 < f3 or ( f1 = f3 and f2 < f4 ).

*write: / 'The program has no recent generated version!'.

*exit.

*endif.

  • Compose a new program name

DATA: new_name(30), i TYPE i, j TYPE i.

new_name = program.

DO 30 TIMES.

i = sy-index - 1.

new_name+i(1) = '_'.

  • Search for acceptable program name variations

j = 0.

SELECT * FROM trdir WHERE name LIKE new_name.

j = j + 1.

ENDSELECT.

IF j = 1.

EXIT.

ENDIF.

new_name = program.

ENDDO.

  • Cannot generate appropriate program name

IF j > 1.

WRITE: / 'Cannot generate appropriate program name'.

EXIT.

ENDIF.

  • Check if it is already hidden

DATA: f5(30).

EXEC SQL.

SELECT PROG INTO :F5 FROM D010SINF WHERE PROG = :NEW_NAME

ENDEXEC.

IF f5 IS INITIAL.

  • There is no such hidden program, hide it

EXEC SQL.

UPDATE D010SINF SET PROG = :NEW_NAME WHERE PROG = :PROGRAM

ENDEXEC.

CONCATENATE 'Program' :program 'was hidden.'

INTO message SEPARATED BY space.

ELSE.

  • There is already a hidden program there, unhide it

EXEC SQL.

UPDATE D010SINF SET PROG = :PROGRAM WHERE PROG = :NEW_NAME

ENDEXEC.

CONCATENATE 'Program' :program 'was restored.'

INTO message SEPARATED BY space.

ENDIF.

WRITE message.

  • The same thing can also be done using TADIR table and TSTC table.

Reward point if helpful

Read only

Former Member
0 Likes
667

Hello,

In this case, do not give the un authorized users the development access/ or access to txn SE38/SE80.

The development obj is S_DEVELOP.

Reward, if this helps.

Rgds,

Raghu.

Read only

Former Member
0 Likes
667

you can use the user exit EXIT_SAPLS38E_001(enhancement SEUED001).

Within this exit write:

if PROGRAM = '<Your prog. name>'.

raise cancelled.

endif.

Now no body can see the code in display or in change mode.

Regards,

Joy.

Read only

vinod_vemuru2
Active Contributor
0 Likes
667

Hi Ramesh,

When ever u open any object a lock entry will be created. If u r deleting lock means u are intended to allow some one else to modify the code. so u are already in change mode. If some one else try to go in change mode the system will check whether any lock created for this program(TRDIR table). Since u already deleted the lock status will be space. As soon as some one save the program again lock will be created.

Coming to editor lock irrespective of u r in change mode or not no one else can modify ur object unless they are using same unser ID(your's). With same user ID it is possible if u dont have lock on this object as explained above.

Hope it is clear.

Thanks,

Vinod.

Read only

former_member189059
Active Contributor
0 Likes
667

I like Joy's idea

Perhaps if you want to be able to edit your code yourself (but not allow others to) you can add the method to that user exit cl_gui_frontend_services=>get_ip_address to get the current ip address

only if it is your own, then allow editing