Invoke functions in the ABAP on-premise system using the JAVA+SAP cloud Platform +SAP Cloud Connector

Source: Internet
Author: User
Tags java web

Recently, Jerry received a prototype development task that required some functions in the ABAP on Premise system (SAP CRM on-premise) to be called. The scenario is similar to the scenario described by my previous public article Cloud for customer and the integration series tutorials.

The difference is that cloud for Customer (C4C) is a cloud solution whose OData service/web Service can be consumed directly by other applications on the Internet network. In my recent prototype development, the functions that need to be consumed are in the ABAP on-premise system deployed in the corporate network and cannot be consumed directly by Internet applications.

To ensure that Internet applications can access the services in the corporate network system, we need to use SAP Cloud Connector as a bridge of communication.

In this article I assume the scenario is to develop a Java Web application that is deployed on the SAP Cloud Platform (Cloud Platform). The user accesses the app on the phone and invokes the function in the ABAP on-premise system.

The main implementation steps of this scenario are:

    1. Download install and configure Cloud Connector. The Cloud connector needs to be located in the corporate Network with the ABAP on-premise system.

    2. Complete the necessary configuration on the SAP cloud platform to establish a connection with cloud connector.

    3. Develop Java Web applications and deploy to SAP cloud platforms.

The schema diagram is shown below.


The following is a detailed procedure.

1. Installation and configuration of Cloud connector


When the installation is complete, start cloud Connector and make sure you see the Cloud Connector service in the list of services for your operating system:

Cloud Connector Login Screen:


Create a new connector instance that I named JERRY_SCC. Region and Subaccount need to be assigned to the corresponding field of the SAP cloud platform that needs to be connected so that the connector instance can be associated with the corresponding SAP cloud platform.


The connector instance is created and saved as shown in. Click on the menu "Cloud to On-premise" below the left JERRY_SCC:

This interface creates a mapping relationship from the virtual system to the ABAP on-premise system. The virtual system name I created is my-backend-system and mapped to an SAP internal ABAP system AG3. The Access Protocol (PROTOCOL) is specified as RFC. Click the Check button and if the ABAP system's information is maintained correctly, the status of the ABAP system will be marked as reachable (accessible).

The function name is stfc,naming policy for prefix, meaning that all functions in the AG3 system that begin with STFC can be accessed through the connector instance.

This cloud connector configuration is complete.

2. Configuration on the SAP cloud Platform

Once the Cloud connector configuration is complete, a configured instance can be seen on the Cloud Connectors tab of the SAP Cloud Platform.
This step requires creating a destination on the SAP cloud Platform for use by Java programs. This destination is similar to the destination that the ABAP NetWeaver transaction code SM59 creates.


Create a destination that mimics the settings. My destination name is called My-backend-system-destination, and this destination will be consumed by Java applications in the next step. Note that user and password need to maintain the username and password corresponding to the ABAP on-premise system.

Click the button check Connection to make sure that the destination is working properly.

3. Developing Java applications, using the destination created in step 2nd

The full source code for this Java application is on my github:

Only the core code is explained here:

(1) 28th line according to the destination name to get its instance, the name is specified in the configuration of the 2nd step SAP cloud Platform.

(2) Line 31st, get the handle of the ABAP function stfc_connection.

(3) The 35th line, to get the user from the browser URL in the input values passed in.

(4) The 38th line, the user input obtained from line 35th is assigned to the input parameter of stfc_connection Requtext.

(5) Line 42nd, execute the ABAP function.

(6) 45th, 46 lines, get the ABAP function execution result.

Deploy this Java application from eclipse to the SAP cloud Platform. The specific steps refer to my knowledge of the article:

Use eclipse to develop Java applications and deploy to SAP cloud platforms

Test it in:

Output:


A breakpoint is set in the Stfc_connection function body of the ABAP system, and the user input from the pass-in is observed in the ABAP debugger:

I've written a lot of articles on SAP cloud Platform in my well-known column, and you're welcome to pay attention.

To get more original Jerry's technical articles, please follow the public number "Wang Zixi" or scan the QR code below:

Invoke functions in the ABAP on-premise system using the JAVA+SAP cloud Platform +SAP Cloud Connector

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.