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

Estimated read time 6 min read

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.

Setup Certificate-Based Authentication: Ensure that both SAP ERP and SAP Integration Suite trust each other’s certificates.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 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.

 

 

​ 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 ClassOne 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.Setup Certificate-Based Authentication: Ensure that both SAP ERP and SAP Integration Suite trust each other’s certificates.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 ClassAnother 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 DestinationSample 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.    Read More Technology Blogs by Members articles 

#SAP

#SAPTechnologyblog

You May Also Like

More From Author

+ There are no comments

Add yours