Scenario: Two ABAP system instances on the SAP cloud platform, one as the data provider -provision System; The other serves as a consumer-client system for data, which reads data from the former and displays it
Overview of implementation steps:
(1) Create an outbound communication in the client System. (2) Create an inbound communication in the provision System. (3) Create a Service Consumption Model, and save this locally as a $metadata XML file; From this you will create proxy artefacts in the client system, representing the remote service, (4) Create a remote client proxy (5) Create an OData service in the client System, Consume and present data retrieved from the provision system using Fiori Elements
Communication Scenario SAP_COM_0276, published by SAP standard, provides the possibility of integration between the SAP Cloud Platform ABAP instance and the remote ABAP on-premises system or third-party system.
A communication arrangement specifies the metadata for a specific communication scenario, such as your host system and the authentication method. This metadata is contained in a service key. You can then define one or more specific destinations for this arrangement.
Communication Arrangement Specifies necessary metadata for a Communication Scenario, including information about the Communication system and message authentication mode. The metadata is stored in the form of Service keys. You can create a Destination based on the Communication Arrangement.
Create a Destination service instance in the SAP Cloud platform CloudFoundry environment:
Create a new Destination instance based on the Destination service:
The URL field is maintained as the URL of the provision System to ensure that the connection can be established.
Create a new service key for the Destination service and store its contents locally:
Open the dashboard of ABAP service Instance on the client System:
In the Communication Arrangement tile, create a new instance:
From the Communication Scenario drop-down list, select SAP_COM_0276: SAP CP CF Destination Service Integration:
After selecting a Communication Scenario, maintain the Communication Arrangement name, for example, OUTBOUND_XXX.
In the Additional Properties of Communication Arrangement, change the service Instance name value from the default OUTBOUND_XXX to a more memorable value. Such as Outbound – For – Tutorials_XXX.
Finally, create the ABAP implementation class on the ABAP Client System:
CLASS ZCL_OUTPUT_HTTP_XXX DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_OUTPUT_HTTP_XXX IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
TRY.
DATA(lo_destination) = cl_http_destination_provider=>create_by_cloud_destination(
i_name = 'A4C_ACCESS_XXX_HTTP'
i_service_instance_name = 'Outbound-For-Tutorial-XXX'
i_authn_mode = if_a4c_cp_service=>service_specific ).
DATA(lo_http_client) = cl_web_http_client_manager=>create_by_http_destination( i_destination = lo_destination ).
DATA(lo_request) = lo_http_client->get_http_request( ).
DATA(lo_response) = lo_http_client->execute( i_method = if_web_http_client=>get ).
out->write( lo_response->get_text( ) ).
CATCH cx_root INTO DATA(lx_exception).
out->write( lx_exception->get_text( ) ).
ENDTRY.
ENDMETHOD.
ENDCLASS.
Copy the code
The value of the i_name parameter in line 18 is the Destination name created in the SAP Cloud Platform.
I_service_instance_name is the value of Service Instance name created in the Communication Arrangement Additional Properties.
Execute the ABAP class and the test results are as follows:
For more of Jerry’s original articles, please follow the public account “Wang Zixi “: