Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Ravi_Bharti08
Explorer
1,803

When integrating SAP ERP (ECC, S/4 HANA) with SAP Integration Suite, it’s common to create separate destinations for each iFlow. This can lead to an excessive number of destinations, which can be cumbersome to manage. Here are two methods to streamline this process and avoid creating multiple destinations:

Method 1: Certificate-Based Authentication and create_by_url Class

One effective way to reduce the number of destinations is to establish certificate-based authentication between SAP ERP and SAP Integration Suite. This method allows you to securely authenticate and communicate without needing a separate destination for each iFlow.

  1. Setup Certificate-Based Authentication: Ensure that both SAP ERP and SAP Integration Suite trust each other’s certificates.
  2. Use the create_by_url Class: This ABAP class can dynamically create HTTP connections using URLs, thus avoiding 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.

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 and leaving the path prefix blank. You can then dynamically set the specific path for each request using the header field ~request_uri.

RFC Destination :
RFC DestinationRFC Destination

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.

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.

 

By implementing these methods, you can significantly reduce the number of destinations required for integration between SAP ERP and SAP Integration Suite, making the process more efficient and easier to manage.

 

3 Comments
debalbose
Discoverer
0 Kudos

Great Info…!!!

Tomas_Buryanek
Active Contributor
0 Kudos

How do you store URLs? In some parameter table like TVARVC or custom Z table?

How do you prevent creating multiple duplicite URLs?

Ravi_Bharti08
Explorer

@Tomas_Buryanek  You can store either in TVARVC or a custom Z table. However, a custom Z table will be more convenient because we can break the URL and store the host and path corresponding to the same entry.

To avoid duplicate entries, you can maintain an interface ID for each iFlow, e.g., INT-1, INT-2, ..., INT-n, and then query the custom table based on this.

 

Labels in this area