Introduction
It is possible to call remote enabled function modules in your on-premise systems from SAP Cloud Platform – ABAP environment. How to integrate on-premise systems is described in the SAP online documentation.
When setting up the scenario myself I found that it would have been helpful to have some screen shots from a working configuration.
Step 1 – Cloud connector
The first step is to configure a cloud connector that connects your on premise network with the ABAP environment tenant by opening a secure tunnel connection.
As a backend system I used an SAP S/4HANA 1809 fully activated appliance system which has amongst others a SAP Cloud Connector installed on the same box where the SAP S/4HANA server is running.
What you need at that point is the technical name of your SAP CP Neo Account (here abcde12345). And in the Cloud to on premise section you should add the names of the RFC function modules you want to call. The RFC_SYSTEM_INFO is easy to test since it only returns one string that contains information about your ABAP on-premise instance.
Please note – Technical restriction – Empty location ID
Currently the cloud connector has to be configured with the Location ID being empty.
This technical restriction will be fixed with an upcoming Hotfix Collection.
If you nevertheless maintain a location ID the ABAP code that is used to determine the name of the RFC destintation (see below) will fail.
Step 2 : Cloud Foundry sub account – Destination Service
In my Cloud Foundry sub account PM2019 I have configured one space called “Dev” with several service instances.
One service instance of the destination service is called “OutboundCommunication” and you also see the “abap” service of our SAP Cloud Platform, ABAP environment system.
Here you have to create a RFC destination that points to your on premise SAP ABAP system (here “S4H_ON_PREM_RFC” ).
These two names, the name of the destination service and the name of the RFC system you as a developer will later need to create a “classic” RFC destination in your ABAP code.
Please note that the Location ID has to be empty for the time being until a fix is availabel with one of the upcoming hotfix Collections.
Correction for “Set Up Connections from ABAP Environment to On-Premise Systems”
1. To configure the destination in the SAP Cloud Platform cockpit, navigate to Global Accounts.
2. Select your global account and Neo subaccount.
3. …
This not correct since the communication system has to be created
1. in the CloudFoundry sub account and
2. the destination system has to be created on “space level” rather than on “sub account level”
You have rather to create your destination system here
Home [ here: Europe (Rot)] –> Global Account –> CF Sub Account [here: PM2019] –> Space [here: Dev] –> Instance of Destination Service [here: OutboundCommunication]
Step 3 : SAP Cloud Platform – ABAP environment
In your ABAP cloud system you now have to create :
1. a destination service instance via communication scenario SAP_COM_0276
2. a Communication System, a Communication Arrangement for Communication Scenario SAP_COM_0200.
To do so you open the SAP Fiori Launchpad from the Dashboard button in the list of service instances in your space (here Dev).
Here you can create the communication System
3.1. Communication Arrangement via SAP_COM_0276
You have to configure a destination service instance (here: OutboundCommunication) in the ABAP service instance via communication scenario SAP_COM_0276.
Please note that in your case both the Service instance of the Destination Service in our space is called OutboundCommunication as well as the Communication Arrangement that we have created for it.
3.2. Communication arrangement based on type SAP_COM_0200
To do so you open the SAP Fiori Launchpad from the Dashboard button in the list of service instances in your space (here Dev).
Here you can create the communication system
3.2.1 Communication System
In the definition of your communication system you have to enter the credentials of an administrative user of your SAP CP Neo account
3.2.2 Communication Agreement
When creating the communication arrangement of type SAP_COM_0200 which is used for the SAP Cloud Connector integration you have to specify the Communication System (here Z_S4H_ONPREM_RFC).
The account name and the user name will be shown in the additional properties and the connection will be tested.
Test the setup
Now you should be able to test the setup by creating a simple ABAP class, that uses the interface IF_OO_ADT_CLASSRUN and implements the method IF_OO_ADT_CLASSRUN~MAIN.
Please note that the name of the RFC destination has to be determined by the method:
cl_rfc_destination_provider=>create_by_cloud_destination
This method takes the name of your RFC destination (here: S4H_ON_PREM_RFC) and the name of the destintation service (here: OutboundCommunication) as a parameter.
CLASS z_test_rfc_conn DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z_test_rfc_conn IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
TRY.
DATA(lo_rfc_dest) = cl_rfc_destination_provider=>create_by_cloud_destination(
i_name = |S4H_ON_PREM_RFC|
i_service_instance_name = |OutboundCommunication| ).
DATA(lv_rfc_dest) = lo_rfc_dest->get_destination_name( ).
DATA msg TYPE c LENGTH 255.
"RFC Call
DATA lv_result TYPE c LENGTH 200.
CALL FUNCTION 'RFC_SYSTEM_INFO' DESTINATION lv_rfc_dest
IMPORTING
rfcsi_export = lv_result
EXCEPTIONS
system_failure = 1 MESSAGE msg
communication_failure = 2 MESSAGE msg
OTHERS = 3.
CASE sy-subrc.
WHEN 0.
out->write( lv_result ).
WHEN 1.
out->write( |EXCEPTION SYSTEM_FAILURE | && msg ).
WHEN 2.
out->write( |EXCEPTION COMMUNICATION_FAILURE | && msg ).
WHEN 3.
out->write( |EXCEPTION OTHERS| ).
ENDCASE.
CATCH cx_root INTO DATA(lx_root).
out->write( lx_root->get_text( ) ).
ENDTRY.
ENDMETHOD.
ENDCLASS.
Result
The RFC function module Returns a simple string that contains some Information About the System being called.
114103LITIE3vhcals4hci_S4H_00 vhcals4hS4H S4H vhcalhdbdb HDB 753 390Linux 0 x.x.x.x 773 vhcals4hci
Potential issues
When your on-premise system is not reachable because it is down or because you made an error when configuring the connectivity you will get the (misleading) error message
EXCEPTION COMMUNICATION_FAILURE
Error when opening an RFC connection
(User is locked; notify the person responsible).
Troubleshooting the Cloud Connector
◈ Audits in the Cloud Connector (after a simulated RFC call): empty
◈ Trace in the Cloud Connector (after a simulated RFC call): empty
◈ Function Module is listed as an accessible resource in Cloud Connector
◈ Internal Host is reachable in Cloud Connector
◈ Correct NEO Subaccount is configured in Cloud Connector
◈ Destination Service Communciation Arrangement SAP_COM_0276 is configured
◈ SAP_COM_0200 is configured
No comments:
Post a Comment