Avoiding Multiple Destination Creation for Integration Between SAP ERP and SAP Integration Suite

When integrating SAP ERP (ECC, S/4 HANA) with SAP Integration Suite, it’s common to create separate destinations for each iFlow. However, this approach can result in an excessive number of destinations, making management cumbersome. This article explores two efficient methods to streamline the process and avoid creating multiple destinations.

Method 1: Certificate-Based Authentication and create_by_url Class

One effective way to minimize the number of destinations is to use certificate-based authentication between SAP ERP and SAP Integration Suite. This approach ensures secure communication without requiring a separate destination for each iFlow.

Steps:

  1. Setup Certificate-Based Authentication: Ensure that SAP ERP and SAP Integration Suite trust each other’s certificates.
  2. Use the create_by_url Class: This ABAP class dynamically creates HTTP connections using URLs, eliminating the need for predefined destinations.

Sample Code:

DATA: lo_http_client TYPE REF TO if_http_client.

cl_http_client=>create_by_url(
    EXPORTING
        url                = 'Pass URL Here'
        ssl_id             = 'Pass SSL Id'
    IMPORTING
        client             = lo_http_client
    EXCEPTIONS
        argument_not_found = 1
        plugin_not_active  = 2
        internal_error     = 3
        OTHERS             = 4 ).

* Check for exceptions
IF sy-subrc <> 0.
    " Handle exception
ENDIF.

* Disable logon popup
lo_http_client->propertytype_logon_popup = lo_http_client->co_disabled.

* Set the HTTP method to POST
lo_http_client->request->set_method( 'POST' ).

* Send the HTTP request
lo_http_client->send(
    EXCEPTIONS
        http_communication_failure = 1
        http_invalid_state         = 2
        http_processing_failed     = 3
        http_invalid_timeout       = 4
        OTHERS                     = 5 ).

* Check for exceptions
IF sy-subrc = 0.
    * Receive the HTTP response
    lo_http_client->receive(
        EXCEPTIONS
            http_communication_failure = 1
            http_invalid_state         = 2
            http_processing_failed     = 3
            OTHERS                     = 5 ).
ENDIF.

Method 2: Create RFC Destination with Blank Path Prefix and Use create_by_destination Class

Another approach is to create a general RFC destination in transaction SM59 with only the host specified, leaving the path prefix blank. The specific path for each request can then be dynamically set using the header field ~request_uri.

Steps:

  1. Create an RFC Destination: Configure a generic destination in SM59 with the required host details and no path prefix.
  2. Use the create_by_destination Class: Dynamically set the request path using ABAP code.

Sample Code:

DATA: lo_http_client TYPE REF TO if_http_client.

* Create HTTP client using the destination name
cl_http_client=>create_by_destination(
    EXPORTING
        destination              = 'DestinationName'
    IMPORTING
        client                   = lo_http_client
    EXCEPTIONS
        argument_not_found       = 1
        destination_not_found    = 2
        destination_no_authority = 3
        plugin_not_active        = 4
        internal_error           = 5
        OTHERS                   = 6 ).

* Check for exceptions
IF sy-subrc <> 0.
    " Handle exception
ENDIF.

* Disable logon popup
lo_http_client->propertytype_logon_popup = lo_http_client->co_disabled.

* Set the HTTP method to POST
lo_http_client->request->set_method( 'POST' ).

* Set the specific path for the request
lo_http_client->request->set_header_field(
    name  = '~request_uri'
    value = 'PassYourPath' ).

* Send the HTTP request
lo_http_client->send(
    EXCEPTIONS
        http_communication_failure = 1
        http_invalid_state         = 2
        http_processing_failed     = 3
        http_invalid_timeout       = 4
        OTHERS                     = 5 ).

* Check for exceptions
IF sy-subrc = 0.
    * Receive the HTTP response
    lo_http_client->receive(
        EXCEPTIONS
            http_communication_failure = 1
            http_invalid_state         = 2
            http_processing_failed     = 3
            OTHERS                     = 5 ).
ENDIF.

Conclusion

By implementing these methods, you can significantly reduce the number of destinations required for integration between SAP ERP and SAP Integration Suite. This not only simplifies the integration process but also makes it more efficient and manageable.

Leave a Reply

Your email address will not be published. Required fields are marked *

Newsletter

Quick Contact

Name

This will close in 0 seconds

Name

This will close in 0 seconds

Please Fill Out The Form!

Name

This will close in 0 seconds