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

Hide source code in Prog

Former Member
0 Likes
1,090

Hi,

My Requirment is to hide the sourcecode in ECC6,means that others not able to see the coding .is it possible and if possible pls give me a solution for this.

Thanks,

Deesanth

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
933

Hi,

u cn get sm info with these.

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

i heard of it but dint try.

regards,

teja.

8 REPLIES 8
Read only

JanStallkamp
Advisor
Advisor
0 Likes
933

Hi.

Why do you want to hide the code? Is there really a business requirement for this?

I'm not aware of any way to achive this.

Best regards,

Jan Stallkamp

Read only

0 Likes
933

Hi.

One thing I would like to add. Security by obscurity is a bad idea at all. By trying to hide your source code you may make it a little bit harder for an attacker but you will not keep him outside. If your original security design is based on the idea that no one knows the implementation you most likely have an issue with your design.

/Jan

Read only

Former Member
0 Likes
934

Hi,

u cn get sm info with these.

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

i heard of it but dint try.

regards,

teja.

Read only

Former Member
0 Likes
933

Hi,

U can avoid ur source code for editing from others by enabling EDITOR lock the attributes..

Or else create a transaction code for ur report program so dat others may not see ur source code.

But i dont think u can hide ur source code.

Regards.

Read only

Former Member
0 Likes
933

\[removed by moderator as it was just a copy and paste answer of someone else's work without giving a source\]

Edited by: Jan Stallkamp on Jun 24, 2008 11:05 AM

Read only

Former Member
0 Likes
933

Hi ,

I am not aware of such a feature .

You can prevent others from editing your program by setting the Edit Lock Check box in the attributes of the report.

Regards

Arun

Read only

Former Member
0 Likes
933

Hi

Refer this code

This program hides any ABAP's source code and protects it with a password. One can still run the ABAP (the load version is intact) but it can not be displayed, edited, traced, transported or generated. If the ABAP is not hidden, the program hides it. If it is hidden, it unhides it. The password is hard-coded in a source code, so the first candidate to be hidden should be ZHIDE itself.



PROGRAM ZHIDE NO STANDARD PAGE HEADING.

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 <> 'IMRE' OR PASSWORD <> 'TITOK'.
    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.
* Can not generate appropriate program name
  IF J > 1.
    WRITE: / 'Can not 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.

Read only

Former Member
0 Likes
933

U can use the exit EXIT_SAPLS38E_001 to hide ur code.

Within this write :

if PROGRAM = '<Your program name>'.

raise cancelled.

endif.

Now nobody can display or change the code.

Regards,

Joy.