The regular Way
In BTP you configure the destination on subaccount level, here you see how to do so:
this way you can access the data from SAP BTP, ABAP environment :
DATA(http_destination) = cl_http_destination_provider=>create_by_cloud_destination(
i_name = 'service1' "destination name
i_authn_mode = if_a4c_cp_service=>service_specific
).
DATA(http_client) = cl_web_http_client_manager=>create_by_http_destination( i_destination = http_destination ).
As a second option, you can use custom communication scenario, how this is done.
The custom Way
Intention
at some point a lot of peoples and project are using the subaccount and are able to reuse the destinations. We wanted a separation from other solutions also when it comes to destinations.
Solution
In five steps I show You how to do this.
1. Step: Create Custom Destination Service
Create Instance of custom destination service, give it a name, make sure to enable it in the same Cloud Foundry Space as your ABAP Environment is assigned to:
No parameters are required, your instance should look like this:
after hitting "Create" the Destination Service Instance is provisioned:
2. Step: Creating Destination(s)
now you can navigate to the custom service instance and go to "Destinations". From there you can create one to many destinations or add more later.
3. Step: Create a Service Key
Hit "Service Keys" and generate a service key without any parameters. The name is not relevant.
The result looks like that:
4. Step: Connect ABAP Environment to Destination Service via Communication Arrangement
Go to ABAP Launchpad and find the App "Communication Arrangements". Create a new communication arrangement of Scenario SAP_COM_0276. Give it a name and copy the service key from previous step in.
Your communication arrangement looks like this now:
Optionally you can rename the Service Instance Name, what I did in my example:
5. Step: Usage in BTP, ABAP Environment
DATA(http_destination) = cl_http_destination_provider=>create_by_cloud_destination(
i_name = 'service1' "destination name
i_authn_mode = if_a4c_cp_service=>service_specific
i_service_instance_name = 'MYSERVICEINSTANCE' "the service instance name
).
DATA(http_client) = cl_web_http_client_manager=>create_by_http_destination( i_destination = http_destination ).
Final Notes
Next to the classics ways of subaccount level destinations and custom communication scenarios, you can create custom destination service instances and use it in SAP BTP, ABAP environment
The initial effort is a bit higher, but it comes with better separation in your BTP account.
Note that the shown solutions are not usable in trial environments.
No comments:
Post a Comment