cancel
Showing results for 
Search instead for 
Did you mean: 

want any suggestion or code

Former Member
0 Kudos

hi all,

Please suggest a way or give me some code which will prevent another user from accesing my work unfortunately i share the same user name & password with some people and i cant get a new user name & password as it is some license problem.

i willbe highly grateful if any body could provide me with a solution if u have any code plz let me know.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

tahnx a lot jessie can u plz tell me if i have 10 programs then how can i lock them at once.

& the program which u gave me wouldnt allow any other user with my user name & password to access any program which i created.

Iam really grateful to u & all the people who have replied ill be giving award points.

Former Member
0 Kudos

U can change the select in such a way that u create an internal table or range table with those 10 program names and specify in the where condition as

WHERE name IN r_name.

OR

FOR ALL ENTRIES IN the itab.

U can do so.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Checkt his sample code which I got from SDN once.

PROGRAM ZHIDE NO STANDARD PAGE HEADING.

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

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

  • password in this source code. So the first candidate to be hidden

  • should be ZHIDE itself.

*

  • 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

  • unhides it.

*

  • To execute this program, change the user name and password in this

  • source code first.

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

SELECTION-SCREEN BEGIN OF BLOCK BLOCK.

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.

PARAMETERS: PROGRAM(8).

SELECTION-SCREEN END OF BLOCK BLOCK.

*

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'AAA'.

SCREEN-INVISIBLE = '1'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

*

INITIALIZATION.

PWD = 'PASSWORD'.

*

START-OF-SELECTION.

TABLES: TRDIR.

  • User name and passsword check

IF SY-UNAME <> 'SAP' OR PASSWORD <> 'PASSWORD'.

WRITE: / 'Wrong password'.

EXIT.

ENDIF.

  • SAP owned?

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

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

EXIT.

ENDIF.

  • 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(8), I TYPE I, J TYPE I.

NEW_NAME = PROGRAM.

DO 8 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 in d010s (already hidden)

DATA: F5(8).

EXEC SQL.

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

ENDEXEC.

IF F5 IS INITIAL.

  • There is no such hidden program, hide it

EXEC SQL.

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

ENDEXEC.

ELSE.

  • There is already a hidden program there, unhide it

EXEC SQL.

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

ENDEXEC.

ENDIF.

      • end of program

Former Member
0 Kudos

hi jessie,

i know iam taking an awfull lot of time i have made a program ztest how should i make my coding of ztest invisible to other users.

The program which u mailed should i copy it in my program ztest & then start coding for ztest.

& when iam runing the program which u gave me even after changing user name & password iam getting message wrong password

Former Member
0 Kudos

Hi,

DO as below.

First create a program

SELECTION-SCREEN BEGIN OF BLOCK BLOCK.
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.
PARAMETERS: PROGRAM LIKE TRDIR-NAME.
SELECTION-SCREEN END OF BLOCK BLOCK.
*
AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF SCREEN-GROUP1 = 'AAA'.
      SCREEN-INVISIBLE = '1'.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
*
INITIALIZATION.
  PWD = 'PASSWORD'.
*
START-OF-SELECTION.
  TABLES: TRDIR.
* User name and passsword check
  <b>IF SY-UNAME <> 'ur user name' AND PASSWORD <> 'some pwd'.</b>
    WRITE: / 'Wrong password'.
    EXIT.
  ENDIF.
* SAP owned?
  IF NOT PROGRAM CP 'Z*' AND NOT PROGRAM CP 'Y*'.
    WRITE: / 'Do not hide original SAP programs!'.
    EXIT.
  ENDIF.
* 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(8), I TYPE I, J TYPE I.
  NEW_NAME = PROGRAM.
  DO 8 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 in d010s (already hidden)
  DATA: F5(8).
  EXEC SQL.
    SELECT PROG INTO :F5 FROM D010S WHERE PROG = :NEW_NAME
  ENDEXEC.
  IF F5 IS INITIAL.
* There is no such hidden program, hide it
    EXEC SQL.
      UPDATE D010S SET PROG = :NEW_NAME WHERE PROG = :PROGRAM
    ENDEXEC.
  ELSE.
* There is already a hidden program there, unhide it
    EXEC SQL.
      UPDATE D010S SET PROG = :PROGRAM WHERE PROG = :NEW_NAME
    ENDEXEC.
  ENDIF.

Then copy the rest of the code in the link.

Run this report.

While running the report give the pwd and the program u want to lock ok?

Then the program will get locked.

IF u run for the second time the program will get unlock.

So this may help u to prevent ur code even others cant see in display mode.

Hope ur problem got solved.

Former Member
0 Kudos

hi,

jessie & amit thanx a LOT for taking time out to help me.

amit can u just guide me regarding the code any further.

when i run tcode smod it takes me to "enhancement" now where iam suppose to write all the code & how can i find user exits ??

regards

Former Member
0 Kudos

Hi again,

1. First we need to create a project

using CMOD tcode.

2. in cmod enter, ZDEV02 (OR ANY Z NAME)

3. cREATE

4. eNTER DESCIRPTION

5. PRESS SAVE AND SAVE.

6. THEN PRESS 'ENHANCE ASSIGNMENTS'

7. IN THE FIRST LINE, ENTER SEUED001

8. THEN PRESS 'COMPONENTS'.

9. IN THE LIST OF FM, SELECT DOUBLE-CLICK

EXIT_SAPLS38E_001

10. IN THE FM SCREEN,

U WILL SEE

INCLUDE ZXSEUU08.

11. DOUBLE CLICK-ON IT (OR ENTER BUTTON - RIGHT CORNER)

TO CREATE IT.

12. THERE U NEED TO WRITE ALL YOUR CODE

13. NOW AGAIN IN CMOD,

PRESS 'ACTIVATE BUTTON'

14. COME OUT OF EVERYTHING, AND THEN TEST.

10.

regards,

amit m.

Former Member
0 Kudos

hi,

thanx a LOT. can u tell me one more thing:

there are 2 users who share the same user id & password.

if user1 creates a program ztest ,

then in se38 when user2 presses f4 all the program names are visible including ztest.

what should user1 do if he doesnt want ztest to be visible to user2 in f4 help.

your program is very well coded but unfortunately i cant run it coz i dont have the right to use INCLUDE ZXSEUU08.

Former Member
0 Kudos

Hi again,

1. should user1 do if he doesnt want ztest to be visible to user2 in f4 help

Please don't try to be SO SECRETIVE.

Even ABAP is open source code

and SAP does not try to be secretive about it.

2.unfortunately i cant run it coz i dont have the right to use INCLUDE ZXSEUU08.

As a developer right,

we can create it by double-clicking on it.

or Place cursor on it

and presss ENTER button

(enter button, on the right corner, not the middle one)

regards,

amit m.

Former Member
0 Kudos

hi amit,

sdn itself is open source code iam in favour of open code thats how linux was created .

the problem is if 2 or more people share the same user name & pswd then sometimes it is possible to erroneously delete or add a few lines of code so if u have created a program then the other may not ask you before copy pasteing it coz he/she wuldnt be knowing who originally created it.

regards.

Message was edited by: annie siddiqi

Former Member
0 Kudos

Hi annie,

1.

hen the other user should at least ask you before copy pasteing it & then saying tht he/she has done it where as the work was orginally done by u .

Well, i agree what u say.

But, that depends upon

the DISCIPLINE AND MORALE

of the particular person in question,

and that,

we have not much control over it.

(i suppose u shall agree on this point)

regards,

amit m.

Former Member
0 Kudos

hi once again,

Thank you all the folks who helped me i do hope i have give the prized "points" to everybody.

regards.

Message was edited by: annie siddiqi

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi annie,

1. IT CAN BE DONE.

2. There are two important things :

a) We can restrict by IP ADDRESS (of your machine)

b) We have to utilise user-exit of se38

3. In smod (and using cmod for user-exit)

use this exit provided :

SEUED001

4. In that utilise the FM

EXIT_SAPLS38E_001 - Exit for ABAP Editor

5. Double click on the include to Create it.

6. copy paste this code

(change / add your program names,

and your IP address to RESTRICT)

&----


*& Include ZXSEUU08 *

&----


*----


Data

DATA : terminal LIKE usr41-terminal.

DATA : BEGIN OF itab OCCURS 0,

myprog LIKE sy-repid,

END OF itab.

*----


My prog

itab-myprog = 'ZAM_TEMP174'.

APPEND itab.

itab-myprog = 'ZAM_TEMP173'.

APPEND itab.

*----


Check

CALL FUNCTION 'TERMINAL_ID_GET'

  • EXPORTING

  • USERNAME = SY-UNAME

IMPORTING

terminal = terminal

  • EXCEPTIONS

  • MULTIPLE_TERMINAL_ID = 1

  • NO_TERMINAL_FOUND = 2

  • OTHERS = 3

.

*----


Detect

LOOP AT itab.

IF program = itab-myprog.

IF terminal CS '10.101.8.101' AND operation = 'EDIT'.

MESSAGE e999(yhr) WITH 'Not Allowed'.

ENDIF.

ENDIF.

ENDLOOP.

7. Activate the full user-exit .

8 I have just tried this,

and it works FANTASTIC !

regards,

amit mittal.

Former Member
0 Kudos

I dont think u can, as u have given ur username to other users so when other users enter in ur login they can access ur code too.

http://www.sap-basis-abap.com/sapab022.htm

U can try this way else

Hiding ABAP Source code

http://www.sap-basis-abap.com/sapab028.htm

Kindly reward points and mark the thread as closed.

Message was edited by: Judith Jessie Selvi

Former Member
0 Kudos

Hi annie,

1. I don't think there is anything

which we can do directly,

to achieve such thing.

2. USER ID is the lowest level of key information

available in the system.(for development objects)

regards,

amit m.

hymavathi_oruganti
Active Contributor
0 Kudos

create lock objects in se11, and call the fn modules in ur program.

Former Member
0 Kudos

hi,

can u plz elaborate how should i do it? & if possible can u plz give me the code.

thanx & regards