Hello,
You can accomplish what you want by running the following program and specifying the program name you want to protect.
Bear in mind thou that after being protected, no one - even you! - will be able to acess the protected source code anymore. And thats also include viewing the source code in debugger!
The program will continue to run, naturally...
Good luck!
REPORT zprotect.
PARAMETERS: p_prog TYPE programm OBLIGATORY,
p_linsiz TYPE i DEFAULT 255 OBLIGATORY.
DATA: o_line_type TYPE REF TO cl_abap_elemdescr,
o_prog_type TYPE REF TO cl_abap_tabledescr,
r_prog TYPE REF TO data.
FIELD-SYMBOLS: <fs_t_prog> TYPE STANDARD TABLE.
START-OF-SELECTION.
o_line_type ?= cl_abap_elemdescr=>get_c( p_linsiz ).
o_prog_type ?= cl_abap_tabledescr=>create( o_line_type ).
CREATE DATA r_prog TYPE HANDLE o_prog_type.
ASSIGN r_prog->* TO <fs_t_prog>.
READ REPORT p_prog INTO <fs_t_prog>.
IF sy-subrc = 4.
MESSAGE `Specified program was not found` TYPE `S` DISPLAY LIKE `E`.
EXIT.
ELSEIF sy-subrc = 8.
MESSAGE `Specified program is already protected` TYPE `S` DISPLAY LIKE `E`.
EXIT.
ELSEIF sy-subrc <> 0.
MESSAGE `Error reading the specified program` TYPE `S` DISPLAY LIKE `E`.
EXIT.
ENDIF.
INSERT '*@#@@[SAP]' INTO <fs_t_prog> INDEX 1.
INSERT REPORT p_prog FROM <fs_t_prog>.
IF sy-subrc <> 0.
MESSAGE `Error protecting the specified program` TYPE `S` DISPLAY LIKE `E`.
ELSE.
MESSAGE `The specified program was protected successfully` TYPE `S`.
ENDIF.