Skip to content

Commit cf359d3

Browse files
authored
Merge pull request #3 from sap-tutorials/master
changes
2 parents 2c45201 + 369fa16 commit cf359d3

449 files changed

Lines changed: 3603 additions & 1918 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
---
2+
parser: v2
3+
auto_validation: true
4+
time: 40
5+
tags: [ tutorial>intermediate, topic>abap-development]
6+
primary_tag: topic>abap-connectivity
7+
author_name: Felix Draeger
8+
author_profile: https://github.com/felixdraeger
9+
---
10+
11+
# WebSocket RFC to Cloud Using SAP Business Connector
12+
<!-- description --> Learn how to connect an on-premise system prior to 1909 to cloud using WebSocket RFC.
13+
14+
## Prerequisites
15+
- Access to an SAP S/4 HANA system prior to version 1909
16+
- Access to the ABAP environment in a cloud system
17+
- Latest version of SAP Business Connector including all updates installed. To download SAP Business Connector, go to the [download page](https://support.sap.com/sbc-download). For more information about the installation and other documentation, go to the [details page](https://support.sap.com/en/product/connectors/bc/details.html).
18+
- You've created a private key, signing certificate, and signed certificate as described in the [certificate toolkit guide](https://support.sap.com/content/dam/support/en_us/library/ssp/products/connectors/bc/SBC_CertificateToolkitGuide_481.pdf).
19+
- We recommend completing the tutorial [Set Up the SAP Business Connector for On-Premise WebSocket RFC to Cloud](abap-setup-bc).
20+
21+
## You will learn
22+
- How to setup a WebSocket RFC connection from an on-premise system to a cloud system using SAP Business Connector.
23+
24+
## Intro
25+
> In this tutorial, wherever **`XXX`** appears, use a number (e.g. **`000`**).
26+
27+
---
28+
29+
### Introduction
30+
31+
The following tutorial describes how to establish a connection between an on-premise ABAP system and a cloud-based ABAP system.
32+
33+
Technically, the connection works as follows:
34+
35+
1. The on-premise ABAP system makes an RFC request for an RFC destination of type **`T`**.
36+
2. At this RFC destination, an SAP Business Connector (SAP BC) is registered. It receives the request, transforms it into a WebSocket/HTTPS-based request and forwards it to the cloud-based ABAP system.
37+
3. The cloud-based ABAP system processes the request and returns the response back to the SAP BC.
38+
4. The SAP BC transforms the response back to classic RFC protocol and returns it to the originating on-premise system.
39+
40+
![System URL](wsrfc_1.png)
41+
42+
SAP BC acts as a middleware between the classic CPIC-based RFC protocol and the WebSocket-based RFC protocol that can be `tunneled` through firewalls into the cloud without problems.
43+
44+
> If the on-premise ABAP System is an S/4HANA version 1909 or newer, the underlying ABAP platform can perform WebSocket RFC calls without any additional component. The business connector is not required in this case.
45+
46+
47+
### Setting up the source system
48+
49+
50+
In the source system, you need to setup an RFC destination of type **`T`** and allow SAP BC to register at this destination. The source system will later send all RFC calls, which are intended for the cloud system, to this RFC destination.
51+
52+
In the source system (the on-premise system), set up an RFC destination of type **`T`**.
53+
54+
1. Run transaction **`SM59`**.
55+
2. Choose **create**.
56+
- Destination: **`MYDESTINATION_XXX`**
57+
- Connection Type: **T RFC connection to external program using TCP/IP**
58+
3. (Optional): Enter a meaningful description.
59+
4. On tab **Technical Settings**, make the following settings:
60+
- Activation Type: **Registered server program**
61+
- Program ID: **`CLOUD_SYSTEM_VIA_BC`**
62+
- Gateway Host: Hostname of one of the application servers of the on-premise system, which still has some free capacity.
63+
- Gateway Service: **`sapgwXX`**, where **`XX`** is the instance number of the on-premise system.
64+
5. Go to tab **Unicode**.
65+
- Make sure that here **Unicode** is selected.
66+
6. Save the destination.
67+
68+
![System URL](wsrfc_2.png) ![System URL](wsrfc_3.png)
69+
70+
71+
72+
### Allow SAP BC to register at the RFC destination
73+
74+
> If there is already a line like `P TP=* HOST=*`, you can skip this step.
75+
76+
1. Run transaction **`SMGW`**.
77+
2. Choose **`Goto` > Expert Functions > External Security > Maintain ACL Files**.
78+
3. Go to tab **`Reginfo File`**.
79+
4. Choose **Insert Line > Standard**.
80+
- P/D (*): `P`
81+
- TP (*): `CLOUD_SYSTEM_VIA_BC`
82+
- Host: Host/IP where SAP BC will run, e.g. `10.87.64.3`
83+
84+
> You can find out the IP in the command line. On Windows, enter `ipconfig`. On Mac or Linux, enter `ifconfig`. Copy the IPv4 Address.
85+
86+
- Access: `internal`
87+
- Cancel: `local`
88+
- No: Leave this field unspecified.
89+
- Choose **Save**.
90+
- Save your settings globally.
91+
- Choose **`Goto` > Reread (global)**
92+
93+
> In releases older than 7.40 SP11, you have to change the `Reginfo` file manually. See [SAP Note 1989587](https://launchpad.support.sap.com/#/notes/1989587) for more information.
94+
95+
96+
97+
### Communication management in the target system
98+
99+
To provide a service in the cloud system, you must create the following entities:
100+
101+
- Communication user
102+
- Communication system
103+
- Communication arrangement
104+
105+
This procedure is the same as for other connection types. See [Overview of Communication Management](https://help.sap.com/docs/SAP_S4HANA_CLOUD/6aa39f1ac05441e5a23f484f31e477e7/5b8ff39ddb6741a29ddfcf587939e8f4.html?version=LATEST) for more information. In this tutorial, you don't need to create a communication scenario as we use the SAP-delivered scenario `SAP_COM_0636`. This scenario provides access to the following function modules:
106+
107+
- **`RFC_METADATA_GET`**
108+
- **`RFC_FUNCTION_SEARCH`**
109+
- **`RFC_GET_FUNCTION_INTERFACE`**
110+
- **`DDIF_FIELDINFO_GET`**
111+
112+
However, you can also use your remote-enabled function module with a custom communication scenario. See [Develop a Remote-Enabled Function Module (RFM)](https://help.sap.com/docs/SAP_S4HANA_CLOUD/6aa39f1ac05441e5a23f484f31e477e7/abf7105063f345edad7588cf58d53118.html?version=LATEST) and [Communication Scenario](https://help.sap.com/docs/SAP_S4HANA_CLOUD/6aa39f1ac05441e5a23f484f31e477e7/7ea7276c89a644d9867bf0f8627aed67.html?version=LATEST) for more information.
113+
114+
### Create a communication user in the target system
115+
1. Login to Fiori Launchpad in the target cloud system.
116+
2. Choose **Communication Management > Maintain Communication Users**.
117+
3. Choose **New**.
118+
4. User Name: **`BC_USERXXX`**
119+
5. Description: **`User for SAP BC`**
120+
6. Password: **`PasswordForBC_USERXXX`**
121+
7. Choose **Create**.
122+
123+
### Create a communication system
124+
1. In Fiori Launchpad, choose **Communication Management > Communication Systems**.
125+
2. Choose **New**.
126+
- System ID: **`MY_SYSTEMXXX`**
127+
- System Name: **`MY_SYSTEMXXX`**
128+
3. Activate **Inbound Only**.
129+
4. Under **Users for Inbound Communication**, choose **Add**.
130+
- Choose user **`BC_USERXXX`**.
131+
- Choose **OK**.
132+
5. Save the communication system.
133+
134+
### Create a communication arrangement
135+
1. In Fiori Launchpad, choose **Communication Management > Communication Arrangements**.
136+
2. Choose **New**.
137+
3. Search for communication scenario **`SAP_COM_0636`**.
138+
4. Arrangement Name: **`MY_ARRANGEMENTXXX`**
139+
5. Choose **Create**.
140+
- Communication System: **`MY_SYSTEMXXX`**
141+
- Copy the **API-URL**.
142+
6. Save the communication arrangement.
143+
144+
145+
### Define connection parameters for the cloud system in SAP BC
146+
147+
1. Start SAP BC.
148+
2. Go to **Adapters > SAP**.
149+
3. Choose **Add SAP Server**.
150+
- Name: **`Connection_to_Cloud`**
151+
- Connection Type: **`WebSocket Connection`**
152+
- Logon Type: **`User/Password`**
153+
- User: **`BC_USERXXX`**
154+
- Activate **Alias User**.
155+
- Password: **`PasswordForBC_USERXXX`**
156+
- Client: Client of the target cloud system (optional)
157+
- WebSocket Host: API-URL of the communication arrangement without the **`https://`** prefix
158+
159+
> Including the `https://` prefix leads to an error when you test the connection.
160+
161+
- WebSocket Port: **`443`**
162+
- Network: **WAN**
163+
- Choose **Save**.
164+
165+
![System URL](wsrfc_4.png)
166+
167+
4. Download the certificate of the target cloud system. We recommend using the browser's "show certificate" functionality. Most browsers provide information on the security status of the SSL/TLS connection, usually displayed as a small lock icon. Select this icon and save the CA root certificate to file. We recommend to use Chrome browser for this.
168+
169+
![System URL](wsrfc_5.png)
170+
171+
5. Add the cloud system's certificate to the trusted list in SAP BC.
172+
- Copy the certificate to the CA certificate directory of SAP BC. In this tutorial, the directory is in **`C:\sapbc481\Server\config\trust`**
173+
- Go to **Security > Certificates** and choose **Trusted Certificates > Reload CA List**.
174+
175+
If your corporate firewall requires an HTTP proxy for outbound connections, you need to make this proxy known to the SAP BC. For this, go to **Settings > Proxy Servers > Secure Proxy (HTTPS)** and enter the host, port, and, if necessary, user information of your proxy server. Here, only basic proxy authentication can be configured.
176+
177+
6. Test the connection. Select the newly configured SAP server from the server list and choose **Test Connection**.
178+
179+
180+
### Define connection parameters for the on-premise system in SAP BC
181+
182+
1. In SAP BC, choose **Adapters > SAP**.
183+
2. Choose **Add SAP Server**.
184+
- Name: **`Connection_to_OP`**
185+
- Connection Type: **CPIC Connection**
186+
- Application Server: Hostname of your application server (= gateway host defined in your destination in *step 2*)
187+
- System Number: The instance number you used in *step 2*
188+
189+
![System URL](wsrfc_6.png)
190+
191+
- Choose **Save**.
192+
3. Go back to the **SAP Servers** list and choose **0** in the **Listeners** column of **`Connection_to_OP`** and choose **Add Listener**. This will create a so-called RFC Listener, which will connect to the RFC destination that we created in the on-premise system via transaction **`SM59`**.
193+
- Connection Type: **TCP/IP**
194+
- Program ID: **`CLOUD_SYSTEM_VIA_BC`**
195+
- Number of Threads: **5**
196+
- Gateway Host: Hostname of your application server (= gateway host defined in your destination in *step 2*). This field is filled automatically.
197+
- Gateway Service: The gateway service you used in *step 2*
198+
- Repository Server: **`Connection_to_Cloud`**
199+
200+
Using the target cloud system as repository server has two advantages:
201+
202+
- A function module must exist in the system, where it is to be executed. However, the same does not apply to the source system. Therefore, by letting SAP BC make the DDIC lookup in the cloud system, the on-premise system can call function modules of the cloud system, that do not exist in the on-premise system.
203+
204+
- By using the cloud system for the DDIC lookups, the SAP BC does not need user credentials for the on-premise system.
205+
206+
![System URL](wsrfc_7.png)
207+
208+
- Choose **Save**.
209+
- Start the listener. Choose the red button in column **Started?**.
210+
211+
212+
### Define routing for function modules
213+
214+
Define what SAP BC shall do with the incoming RFC requests. In our case, we simply instruct SAP BC to send everything that it receives from the on-premise system to the target cloud system.
215+
216+
1. In SAP BC, choose **Adapters > Routing > Routing Rules**.
217+
2. Under **Add Routing Rule**, enter the following:
218+
- Sender: Enter your the system ID of the on-premise system with the current client, for example **`YI3000`**.
219+
- Receiver: **`MYDESTINATION_XXX`**
220+
- Message Type: **`*`**
221+
222+
223+
3. Choose **Add**.
224+
- Transport: **RFC**
225+
- Destination: **`Connection_to_Cloud`**
226+
- Choose **Save**.
227+
- Activate the rule by choosing **No** in column **Enabled?**.
228+
229+
![System URL](wsrfc_9.png)
230+
231+
232+
### Test the connection
233+
234+
1. Run transaction **`SM59`**.
235+
2. Choose your destination **`MYDESTINATION_XXX`**.
236+
3. Choose **Connection Test**.
237+
238+
239+
240+
### Test yourself
241+
242+
243+
244+
248 KB
Loading
68.8 KB
Loading
85.9 KB
Loading
47.8 KB
Loading
51.5 KB
Loading
57.2 KB
Loading
45.4 KB
Loading
6.67 KB
Loading
38.4 KB
Loading

0 commit comments

Comments
 (0)