How to install SSL Certificate on S/4 HANA ABAP System


Dear SAPLearners, in this blog post i will show the steps to install SSL certificate in S/4 HANA ABAP system.

SSL certificate is needed for a secure and confidential data transmission between servers.

For example if you want to consume REST API service in ABAP provided by 3rd party providers like AWS, Azure and GCP, installation of SSL in ABAP system pertaining to that server is mandatory.

Lets get started. For demo purpose I am using SWAPI-The Star Wars REST API.

Step-by-Step Installation

1. Obtain the SSL certificate of the REST API provider there are different ways to get the certificate below one among of them.

2. Launch in browser and click on padlock icon in-front of the url.

STRUST SSL Certificate Installation Step1

3. A certificate window opens like below, click on Copy To File button.

STRUST SSL Certificate Installation Step2

4. A Certificate Export Wizard opens and follow the steps below

STRUST SSL Certificate Installation Step3
STRUST SSL Certificate Installation Step4
STRUST SSL Certificate Installation Step5
STRUST SSL Certificate Installation Step6
STRUST SSL Certificate Installation Step7

5. Finally we have successfully export the SS certificate.πŸ™Œ

6. Open transaction code STRUST – Trust Manager and select import button under SSL client SSL Client(Anonymous) section. Select the certificate we download in previous step

STRUST SSL Certificate Installation Step8

7. Click on Add to Certificate List button to add the SSL certificate.

STRUST SSL Certificate Installation Step9

8. Congrats! πŸ™Œ we have successfully learners how to install SSL certificate in S/4 HANA ABAP system.

Its time to write an ABAP program to test the SSL and the REST API call. Below is the sample code.

DATA: lv_code          TYPE i,
      lv_url           TYPE string,
      li_client        TYPE REF TO if_http_client,
      lt_errors        TYPE TABLE OF string,
      lv_error_message TYPE string,
      lv_json_data     TYPE string.

lv_url = ''.

    url           = lv_url
    ssl_id        = 'ANONYM'
    client        = li_client ).

li_client->send( ).
    http_communication_failure = 1
    http_invalid_state         = 2
    http_processing_failed     = 3
    OTHERS                     = 4 ).
IF sy-subrc <> 0.
  WRITE: / 'Error Number', sy-subrc, /.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      message = lv_error_message ).
  SPLIT lv_error_message AT cl_abap_char_utilities=>newline INTO TABLE lt_errors.
  LOOP AT lt_errors INTO lv_error_message.
    WRITE: / lv_error_message.

    code = lv_code ).
IF lv_code = 200.
  WRITE: / lv_url, ': OK', icon_checked AS ICON.
  WRITE: /.

  lv_json_data = li_client->response->get_cdata( ).
  WRITE lv_json_data.

and the program output is

STRUST SSL Certificate Installation Step10

You can clearly see that SSL connection is successful and we received JSON data.

Please feel free to comment and let us know your feedback. Subscribe for more updates

If you liked it, please share it! Thanks!