Category:ABAP开源
Article From:https://www.cnblogs.com/sap-jerry/p/9061905.html

Recently, Jerry has received a prototype development task, which calls for some functions in WeChat On Premise system (SAP CRM On-Premise) in WeChat. Specific scenario and my previous public address article Cloud for CustOmer and WeChat integrated series tutorials describe similar scenes.

The difference is that Cloud for Customer (C4C) is a cloud solution, and its OData Service/Web Service can be consumed directly by other applications on the Internet network. And the latest prototype development I’m going to do,The function that requires consumption is located in the ABAP On-Premise system deployed in Corporate Network, and can not be directly consumed by Internet application.

In order to ensure that Internet applications can access services in Corporate Network system, we need to use SAP Cloud Connector as a communication bridge.

The scenario I assume in this article is to develop a Java Web application and deploy it on the SAP Cloud Platform (cloud platform). Users access the application in WeChat mobile, calling the functions in ABAP On-Premise system.

The main implementation steps of this scenario:

  1. Download and install and configure Cloud Connector. Cloud Connector needs to be also located in Corporate Network as the ABAP On-Premise system.

  2. Complete the necessary configuration on the SAP cloud platform and establish a connection with Cloud Connector.

  3. Develop Java Web applications and deploy to the SAP cloud platform.

The architecture diagram is shown below.


The following are detailed steps.

1. Cloud Connector” installation and configuration

Download address


After installation, start Cloud Connector to ensure that Cloud Connector’s corresponding services are found in the service list of the operating system.

Cloud ConnectorThe login interface:


Create a new Connector instance, I named it Jerry_SCC. Region and Subaccount need to specify the corresponding fields of the SAP cloud platform that needs to be connected, so that the Connector instance can be associated with the corresponding SAP cloud platform.Relationship.


ConnectorWhen an instance is created and saved, as shown in the following figure. Click on the menu “Jerry_SCC Cloud To On-Premise” below the left side of the image below:

Create a mapping relationship from the virtual system to the ABAP On-Premise system at this interface. The name of the virtual system I created is my-backend-system, which is mapped to a SAP internal ABAP system.AG3. The access protocol (Protocol) is specified as RFC. Click on the check button and if the information of the ABAP system is maintained correctly, the state of the ABAP system will be marked as Reachable (accessible).

Function NameFor STFC, Naming Policy is Prefix, meaning that all STFC enabled functions in the AG3 system can be accessed through the Connector instance.

At this point the Cloud Connector configuration is completed.

2. SAP cloud platform

Once the Cloud Connector configuration is completed, you can see the configured instance on the Cloud Connectors tab of the SAP cloud platform.
This step requires creating a Destination on the SAP cloud platform to enable Java programs to be used. This Destination and ABAP Netweaver transaction code SM59 are similar to those created by Destination.


Create a Destination following the setting of the following figure. My Destination name is my-backend-system-destination, and this Destination will be consumed by Java in the next step. Be carefulUser and Password need to maintain user names and passwords corresponding to the ABAP On-Premise system.

Click the button Check Connection to ensure that the Destination is working properly.

3.” to develop Java applications, using the Destination created in the second step.

All the source code of the Java application is on my GitHub:

Here’s only the core code:

(1) The twenty-eighth line gets the example according to the Destination name. The name is specified in the configuration of the second step SAP cloud platform.

(2) The thirty-first row gets the handle to the ABAP function STFC_CONNECTION.

(3) The thirty-fifth line gets the input value from the browser URL.

(4) The thirty-eighth row will input the user input from the thirty-fifth line to the STFC_CONNECTION input parameter REQUTEXT.

(5) The forty-second line, execute the ABAP function.

(6) The forty-fifth, 46 line, get the result of the ABAP function.

Deploy the Java application from Eclipse to SAP cloud platform. The concrete steps refer to what I know about the article:

Using Eclipse to develop Java application and deploy it to SAP cloud platform

Test in WeChat:

Output:


A breakpoint is set inside the STFC_CONNECTION function of the ABAP system, and user input from WeChat can also be observed in the ABAP debugger.

I wrote a lot of articles about SAP cloud platform on my knowledge column, welcome to pay attention.

To get more original technical articles of Jerry, please pay attention to the public number “Wang Zixi” or scan the following two-dimensional code:

Leave a Reply

Your email address will not be published. Required fields are marked *