Technology Blog Posts by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Umezuki
Product and Topic Expert
Product and Topic Expert
0 Kudos
441

Introduction

In this article, I will explain "Hybrid Testing" in the context of the SAP Cloud Application Programming Model (CAP), which allows development while accessing real data from SAP S/4HANA On-Premise. I will focus on connectivity tests that are useful before executing Hybrid Testing. For detailed information on setting up the environment, please refer to the links below.

What is Hybrid Testing?

In app development using CAP, testing is typically conducted in a local environment using mock data. However, there are cases where you need to access cloud or on-premise services. "Hybrid Testing" is a useful method in such cases. By using this testing method, developers can run applications in a local environment while connecting to remote services, thereby improving development efficiency.

Challenges of Hybrid Testing with SAP S/4HANA On-Premise

While there are advantages, accessing on-premise systems relies on services such as SAP Destination Service, SAP Connectivity Service, and Cloud Connector. This makes the environment setup more complex compared to local testing with mock data. Therefore, I introduce connectivity tests that can help streamline the environment setup process.

Connectivity Tests

The connectivity tests introduced are in the order shown in the diagram below. I recommend testing them sequentially, starting with those with fewer dependencies.

Hybrid Testing Architecture.png

1. Connectivity Test from SAP Gateway Client

The SAP Gateway Client, with T-code /IWFND/GW_CLIENT, functions as an HTTP(S) client to test OData services. After entering the appropriate HTTP method, OData query (format, top...), request URI, request headers like Content-Type, and payload, click "Execute" on the app to check the availability and response of the target OData service within S/4HANA.

SAP Gateway Client.png

If an error occurs, verify that the OData service is activated and that the correct path is specified, among other potential issues.

2. Connectivity Test from Cloud Connector Administration UI

After a successful test from the Gateway Client, test the connectivity from SCC to the on-premise system. Specifically, click the leftmost icon in Actions to verify the connection from the Virtual host defined in SCC to the Internal host (on-premise). If 'Reachable' is displayed, the test is successful.

Cloud Connector.png

3. Connectivity Test from BTP Cockpit

In the BTP Cockpit, perform a "Check Connection" to SCC to verify if the URL of the Destination can be reached. Note that this test does not guarantee that the Virtual host of the Destination Service (SCC) is operational, but only confirms reachability.

'The check does not guarantee that the target system or service is operational. It only verifies if ...

BTP Cockpit.png

If an error occurs, there may be issues with the SCC settings, version, or server availability.

4. Connectivity Test from SAP Business Application Studio (BAS)

Finally, perform Hybrid Testing itself. Bind the destination and auth services to the app deployed in the Cloud Foundry Runtime, and execute the following command to make an HTTP request from the HTTP file.

# JavaScript
cds watch --profile hybrid

# TypeScript
cds-ts watch --profile hybrid

BAS.pngNotes:

  1. When accessing SCC from a local machine using Hybrid Testing, it is necessary to make calls from within the BTP environment. Therefore, please use BAS instead of IDEs like VS Code. Reference link
  2. In the .env file, you need to add the destinations variable by obtaining the name and URL information of the destination from the Destinations page in the BTP Cockpit.
destinations=[{"name":"demodestination","proxyHost":"http://127.0.0.1","proxyPort":"8887","url":"http://demodestination.dest"}]

Conclusion

I hope this helps you in your app development using CAP.