Application Development 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: 

encrypt data in ABAP

Former Member
0 Kudos

Hallo,

ich will send data from HR via an email-attachment (.txt) to an external Company. The data are selected and send in a Abap-Report. Because there sensitive Data, i will encrypt them in Abap. The Receiver shell decrypt the attachment without Abap, only in Windows by a special Key, Pin etc.

Has anyone an Idea to solve this Problem?

Thanks for help.

Regards,

Dieter

5 REPLIES 5

Former Member
0 Kudos

may be u can use function module

SSFS_ENCODE_TEXT to encrypt data from text to UTF-8 format.

Sharath.

former_member181962
Active Contributor
0 Kudos

Refer this link:

REgards,

Ravi

Peter_Inotai
Active Contributor
0 Kudos

Hi Dieter,

You can try CL_BSP_UTILITY=>ENCODE_STRING, it was mentioned in the BSP Advanced Programming book, but I don't have with me now and I don't remember the details:-(

As far as I remember it uses a commonly used encryption type, so probable you can find a windows based decrypter application.

Peter

Former Member
0 Kudos

Hallo,

sorry Sharath and Peter but we have 4.6C, and the Class/Function isn't in our System.

I think i have to describe my problem in more detail.

First i read in Abap some Data and put it in an internal table. Then i send it via "SO_DOCUMENT_SEND_API1" with

Receiver Typ "U" to an external Receiver as an Attachment. This Attachment shell be secuered by Cryptation or by Password.

The Receiver shell open this Attachment with Password

or any other Key.

Thanks for Help.

Regards,

Dieter

chaithanya_mk
Participant
0 Kudos

Hi Dieter,

I had a similar problem and the below code worked for me.

you can try this.

REPORT  ztest_encrypt_test.

DATA: o_encryptor        TYPE REF TO cl_http_utility.

DATA: v_ac_string  TYPE string VALUE 'Chaithanya',
      v_dc_string TYPE string,
      p_file TYPE string,
      x_file TYPE string.

DATA: BEGIN OF i_data OCCURS 0,
      data TYPE string,
      END OF i_data.
DATA: BEGIN OF i_dedata OCCURS 0,
      data TYPE string,
      END OF i_dedata.

PARAMETERS: l_file TYPE rlgrap-filename,
            e_file TYPE rlgrap-filename.
PARAMETERS: encode RADIOBUTTON GROUP g1,
            decode RADIOBUTTON GROUP g1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR l_file.
  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
      field_name = l_file
    CHANGING
      file_name  = l_file.

  p_file = l_file.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR e_file.
  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
      field_name = e_file
    CHANGING
      file_name  = e_file.

  x_file = e_file.

START-OF-SELECTION.

* Create object for Encryption
  CREATE OBJECT o_encryptor.
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename = p_file
      filetype = 'ASC'
    TABLES
      data_tab = i_data.

  IF encode = 'X'.

    LOOP AT i_data.
      CALL METHOD cl_http_utility=>if_http_utility~encode_base64
        EXPORTING
          unencoded = i_data-data
        RECEIVING
          encoded   = v_dc_string.
      i_dedata-data = v_dc_string.
      APPEND i_dedata.


      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename = x_file
          filetype = 'ASC'
        TABLES
          data_tab = i_dedata.

    ENDLOOP.

  ELSE.
    LOOP AT i_data.
      CALL METHOD cl_http_utility=>if_http_utility~decode_base64
        EXPORTING
          encoded = i_data-data
        RECEIVING
          decoded = v_ac_string.

      i_dedata-data = v_ac_string.
      APPEND i_dedata.


      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename = x_file
          filetype = 'ASC'
        TABLES
          data_tab = i_dedata.

    ENDLOOP.

  ENDIF.