Hide source code of a report

Problem: you want to hide source code of your program.

Solution: There is a special string of characters, that put in front of the ABAP source code makes the code unreadable.

This string is ’*@#@@[SAP]’.

The only problem is that this string cannot be added to the report in the ABAP editor. You need to write a special program that will add this string to each of the selected reports automatically.

REPORT Z_HIDE_SOURCE.

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

PARAMETERS: p_program TYPE syrepid.

START-OF-SELECTION.
  READ REPORT p_program INTO gt_code.
* READ REPORT returns SY-SUBRC = 8 on a hidden source code
  IF sy-subrc <> 0.
    MESSAGE e398(00) WITH 'Report' p_program 'not found.'.
  ENDIF.

  gv_code = ‘*@#@@[SAP]‘.
  INSERT gv_code INTO TABLE gt_code INDEX 1.
  INSERT REPORT p_program FROM gt_code.

Watch out though, as after adding this special string no one, not even you, will be able to see the source code. Neither in the editor nor in the debugger.

Komentowanie jest zakończone.