Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
alrikx
Explorer

The regular Way

In BTP you configure the destination on subaccount level, here you see how to do so:

alrikx_0-1713268850496.png

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, is shown in this tutorial.

 

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:

alrikx_3-1713271996348.png

No parameters are required, your instance should look like this:

alrikx_4-1713272118894.png

after hitting "Create" the Destination Service Instance is provisioned:

alrikx_5-1713272159409.png

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.

alrikx_6-1713272314280.png

3. Step: Create a Service Key

Hit "Service Keys" and generate a service key without any parameters. The name is not relevant.

alrikx_7-1713272701821.png

The result looks like that:

alrikx_8-1713272948899.png

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.

alrikx_1-1713340240990.png

Your communication arrangement looks like this now:

alrikx_2-1713340313888.png

Optionally you can rename the Service Instance Name, what I did in my example:

alrikx_3-1713342067069.png

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.

if you like this post or it helped you, don't hesitate to give kudos.

2 Comments
Koni
Explorer
0 Kudos

Hello alrikx,

awesome! Thank you for your post.

Question: Where would you run the ABAP code on the BTP platform? 
Do you have a tutorial / manual on where to run it? So far, I only discovered the CDS-based data table thingy inside an ABAP Cloud project. 
But I want to run ABAP code on the BTP platform.


alrikx
Explorer
0 Kudos

Hey @Koni,

Thanks for your comment.

You can run this ABAP Code in an ABAP Environment on the BTP, there you always program in ABAP Cloud programming model. Here is a collection of links that show you how to setup an ABAP environment in a trial account and run your own code:

Learn how to develop in ABAP using SAP BTP ABAP En... - SAP Community

Basically you can run this type of code in an application job, in an action of a RAP BO or in an ADT Class Runner.

if you want to use this code in consuming an OData service, check out this post: Usage of Expand Entity in OData Service Consumptio... - SAP Community

alrikx

Labels in this area