Skip to Content

Create an Outbound Communication Arrangement

test
0 %
Create an Outbound Communication Arrangement
Details

Create an Outbound Communication Arrangement

Requires Customer/Partner License
August 2, 2020
Created by
February 25, 2020
In an instance of the SAP Cloud Platform, ABAP Environment (client system), create all the communication objects you need, so it can communicate with a second instance (provisioning system).

You will learn

  • How to connect your SAP Cloud Platform, ABAP environment instance ( client system ) to a remote ABAP environment instance ( provisioning system ) by creating a destination service instance and specific destination
  • How to create outbound communication artefacts in your client system, pointing to the provisioning system
  • You will later use this connection to get data from the provisioning system. This scenario is useful, for example, if you want to connect two services in a distributed landscape

Prerequisites

Mission Scenario:

You want to get data that is only available in a remote instance of SAP Cloud Platform, ABAP Environment ( provisioning system ) and display it in a second instance ( client system ).

You need to:

  1. Create outbound communication artefacts in the client system
  2. Create inbound communication artefacts for an OData Service in a provisioning 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, and use this model to generate an abstract entity.
  4. Create a Remote Client Proxy
  5. Build a new OData service in the client system, using a CDS custom entity and query implementation class
  6. Finally, display the remote data in Fiori Elements preview in your browser
overview-2
Step 1: Understand communication artefacts

The communication scenario SAP_COM_0276 is predefined by SAP. It allow you to, for example, exchange data between an ABAP Environment instance and an on-premise S/4HANA System, or a third-party API.

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.

For more information, see: SAP Help Portal: Creating a Communication Arrangement

Log on to answer question
Step 2: Create a Cloud Foundry destination service instance
  1. In SAP Cloud Cockpit: Navigate to your Space (such as Dev).

    step1a-space
  2. Choose Service Marketplace > Destination.

    Image depicting step1b-service-marketplace
  3. Choose Instances > New Instance.

    Image depicting step1c-destination-external-api
  4. Accept the defaults and choose Next > Next > Next.

  5. On the Confirm screen, enter the instance name Outbound_XXX, then choose Finish.

    Image depicting step1d-destination-instance-name

The new instance appears in the list.

step1e-destination-service-instance-list
Log on to answer question
Step 3: Create a new specific destination
  1. Open your destination, Outbound_XXX, by double-clicking it, then choose Destinations > New Destination:

    Image depicting step2-new-destination
  2. Then enter the following (replacing XXX with your group number). Then choose Save.
    Take a note of the Name.

    • Name = A4C_ACCESS_XXX_HTTP
    • Type = HTTP
    • Description = Access A4C to A4C
    • URL = <URL of inbound service without relative path (see below)>
    • Proxy type = Internet
    • Authentication = BasicAuthentication
    • User and Password = <Select from dropdown list (see below)>
    step2b-dest-name
Log on to answer question
Step 4: Check connection

Check the connection:

step2c-check-connection
Log on to answer question
Step 5: Create service key
  1. Choose Service Keys > Create Service Key.

    step4b-create-service-key
  2. Enter the service instance name Outbound_XXX and choose Save.

  3. The Service Key appears. Copy it to a text file, since you will need it later.

Log on to answer question
Step 6: Open dashboard for ABAP service instance
  1. Go back to your space, Dev and choose Service Instances > <your_client_system>.

    Image depicting step3a-abap-service-instance
  2. Choose Open Dashboard.

    Image depicting step3b-open-dashboard

The dashboard opens.

step6b-dashboard
Log on to answer question
Step 7: Create communication arrangement
  1. Choose Communication Arrangements > New.

    Image depicting step3c-create-comm-arr

    .
    Image depicting step3d-new-comm-arr

  2. Choose the correct Communication Scenario from the drop-down list, that is SAP_COM_0276 (SAP CP Cloud Foundry Service Integration). These scenarios are pre-configured by SAP.

    Image depicting step3e-comm-scenario

    .
    Image depicting step4a-comm-scenarios-list

  3. Enter the name you chose for your destination service instance in SAP Cloud Cockpit, that is OUTBOUND_XXX, in upper case. (The names do not have to be the same, but it is then easier to find the correct Arrangement for your destination service, later.)

  4. Paste in the service key and choose Create.

A communication arrangement is created, along with an identically-named communication system.

Log on to answer question
Step 8: Add service instance name

Still in the Communication Arrangement, in the Additional Properties panel, replace the default value OUTBOUND_XXX of the property Service Instance Name, with another value, Outbound-For-Tutorials_XXX.

To avoid confusion, make the Communication Arrangement name and the service instance name different.

Log on to answer question
Step 9: Check connection in ABAP class
  1. Create an ABAP class, named ZCL_OUTPUT_HTTP_XXX.

  2. Copy the following code into it.


    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.
  3. Specify your own provisioning system as the destination, by replacing the defaults:

    • i_name = name of destination in SAP Cloud Cockpit, where URL = base URL of provisioning system
    • i_service_instance_name = “Service Instance Name” property in Communication Arrangement SAP_COM_0276_XXX in the client system Dashboard: points to OAuth Client ID, System ID etc (generated from Service Key for provisioning system). See tutorial Create an Outbound Communication Arrangement

    i_name = 'A4C_ACCESS_XXX_HTTP' i_service_instance_name = 'Outbound-For-Tutorials_XXX'
    step3c-dest-namestep3d-service-instance-name-outbound-2
  4. Save and activate ( Ctrl+S, Ctrl+F3 ) your changes.

  5. Test the class by outputting to the Console ( F9 ). Your output should look something like this:

    step8e-console-http-output
Log on to answer question
Step 10: Test yourself
In which entity or entities can you enter information about OAuth authentication? Choose all that apply.
×

More Information


Next Steps

Back to top