4.2.4.19. SAP Gateway In
The SAP Gateways are based on the SAP RFC protocol and JCo technology. RFC is an SAP interface protocol allowing internal or external systems to communicate with the SAP system. JCo is the Java implementation of RFC distributed by SAP. Babelway leverage the built-in JCo redundancy mechanism to distribute the gateway on our different locations (data centers).
System boundaries, acknowledgment and error management
For Inbound IDoc, Babelway sends the IDoc to SAP. If the message cannot be delivered to SAP, the error will be managed using the traditional Babelway process. Error notifications will be delivered to registered users. When the message is delivered to SAP, Babelway fetches the detailed status and error messages of the IDoc. The messages are always set to 'acknowledged' when the transmission is successfully. However the status could be SUCCESS or ERROR depending the SAP IDOC status code.
For Outbound IDoc, SAP sends IDOC to Babelway. If the message cannot be delivered to Babelway, the IDoc is in error in SAP with a status = 20. Once the message is delivered to Babelway, SAP automatically change the status to 03. In addition of this, we provide a function to explicitly change the status by calling the RFC defined during the setup phase. This allow SAP that the remaining of the IDoc processing will entirely take place in Babelway.
Connectivity Setup
Babelway provides the gateways to communicate in both direction. SAP Gateway In allows to receive outbound IDoc and SAP Gateway Out allows to send inbound IDoc to SAP. The JCo RFC Provider service uses a TCP/IP connection type. In order to secure this connection, Babelway advices one of the following solutions:
- Option 1: A strict firewall rule to allow Babelway public IP addresses to connect to the SAP server
- Option 2: Using SAP router in the DMZ, as well as the firewall configuration like in Option1
- Option 3: You can contact Babelway support to setup a IPSec VPN between the Babelway public IP addresses and the SAP server. Please send a request to support@babelway.com
The Port number used to contact the SAP system range from 3300 to 3399. The exact port number depends on the SAP system you want to reach. The exact port number must be given in the parameters (defined below). Firewall need to allow Babelway server to reach these ports.
SAP configuration
Here is the list of the SAP specific setup to perform in order to make the connector working. This is guide lines
- Create a "RFC destination" (transaction sm59) with the name "BABELWAY". The "Connection Type" is "TCP/IP Connection". Go to "Technical settings" and fill "BABELWAY" in the "Program ID" field. Go next to the "Unicode" tab and in the "Communication Type", select the "Unicode".
- Create a "Ports in IDoc processing" (transaction we21) in the "Transactional RFC" with the name "BABELWAY".
- For inbound IDoc, there is no special configuration. All programs are allowed to delivered IDocs for all partners. For outbound IDoc, Go to "Partner profiles" (transaction we20) then for each partner and each "Message Type" you want to change, go to "Outbound Options" and change the "Receiver port" to "BABELWAY" in the tab "tRFC".
- If you want to leverage the "Update Status" feature, you need to add the specific RFC call. By default the system will call the following function: ZZBABELWAY_IDOC_STATUS_UPD taking 2 input parameters: PI_DOCNUM (IDoc number) and PI_STATUS (the new status = 16). The code for such function is given below.
FUNCTION zzbabelway_idoc_status_upd .
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(PI_DOCNUM) TYPE EDI_DOCNUM
*" VALUE(PI_STATUS) TYPE EDI_STATUS
*" EXPORTING
*" VALUE(IDOC_CONTROL) LIKE EDIDC STRUCTURE EDIDC
*"----------------------------------------------------------------------
DATA : lv_document_number LIKE edidc-docnum.
DATA : ls_idoc_status LIKE edi_ds.
DATA : lt_idoc_status LIKE edi_ds OCCURS 0 WITH HEADER LINE.
DATA : lv_text(50).
DATA : lv_msg_var1 LIKE balm-msgv1.
WRITE pi_docnum TO lv_msg_var1 NO-ZERO.
CONDENSE lv_msg_var1 NO-GAPS.
ls_idoc_status-docnum = pi_docnum.
ls_idoc_status-status = pi_status.
ls_idoc_status-statyp = 'I'.
ls_idoc_status-stamid = 'ZZBABELWAY'.
ls_idoc_status-stamno = '001'.
ls_idoc_status-stapa1 = lv_msg_var1.
ls_idoc_status-logdat = sy-datum.
ls_idoc_status-logtim = sy-uzeit.
ls_idoc_status-stamqu ='SAP'.
ls_idoc_status-repid = 'ZZBABELWAY_IDOC_STATUS_UPD'.
CALL FUNCTION 'MESSAGE_PREPARE'
EXPORTING
language = 'E'
msg_id = 'ZZBABELWAY'
msg_no = '001'
msg_var1 = lv_msg_var1
* MSG_VAR2 = ' '
* MSG_VAR3 = ' '
* MSG_VAR4 = ' '
IMPORTING
msg_text = lv_text
EXCEPTIONS
function_not_completed = 1
message_not_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ls_idoc_status-statxt = lv_text.
APPEND ls_idoc_status TO lt_idoc_status.
CALL FUNCTION 'EDI_DOCUMENT_OPEN_FOR_PROCESS'
EXPORTING
* DB_READ_OPTION = DB_READ
document_number = pi_docnum
* ENQUEUE_OPTION = SYNCHRONOUS
* IMPORTING
* IDOC_CONTROL =
EXCEPTIONS
document_foreign_lock = 1
document_not_exist = 2
document_number_invalid = 3
document_is_already_open = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'EDI_DOCUMENT_STATUS_SET'
EXPORTING
document_number = pi_docnum
idoc_status = ls_idoc_status
IMPORTING
idoc_control = idoc_control
EXCEPTIONS
document_number_invalid = 1
other_fields_invalid = 2
status_invalid = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'EDI_DOCUMENT_CLOSE_PROCESS'
EXPORTING
document_number = pi_docnum
* BACKGROUND = NO_BACKGROUND
* NO_DEQUEUE = ' '
IMPORTING
idoc_control = idoc_control
EXCEPTIONS
document_not_open = 1
failure_in_db_write = 2
parameter_error = 3
status_set_missing = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFUNCTION.
- Here is a list of transactions that could help you during the setup of your connection:
- sm59 : maintenance of "RFC destination"
- we21 : maintenance of "Ports in IDoc processing"
- we20 : maintenance of "Partner profiles"
- we02 : "IDoc List"
- we19 : "Test tool for IDoc processing"
- sm58 : "Transactional RFC". Use this to look for TID = Gateway In message key
- smgw : "Gateway Monitor"
- sm21 : "System Log"
- we63 : "Documentation" usefull to get IDoc parser or XSD to use in Babelway wizard
- su01 : "User Maintenance"
- se37 : "IDoc conversion to xml"
Babelway configuration
Simply create a channel with the SAP gateway and XML IDoc message definition.
The specific parameters are :
SAP client to use. This is the three digit number you use in the first field of the login screen of SAP Gui. It has the name 'Client' and is just above the user and password fields. For instance: 001, 210, 400 ... |
|
The Valid SAP user ID you want to use. Ideally this should be a user specially created for this purpose. For instance: user |
|
Password associated with the user ID. For instance: password |
|
IP or DNS name for SAP application server. For instance: sap.yourcompany.com if using a sap router, use the sap router syntax details here: /H/SAP_ROUTER/S/3300/H/SAP_SERVER/S/3300 if you are using a NAT: put the public address in sm59 |
|
This is the name of the RFC Destination to use. This RFC destination must use TCP/IP connection. See help for more details. For instance: BABELWAY |
|
SAP system number is the last 2 digits of the SAP client. For instance: 01, 10, 00. Default is the last 2 digits of SAP client parameter |
|
IP or DNS name for SAP gateway. It could be the same as jco.client.ashost if no external gateway is used. the For instance: gateway.yourcompany.com. Default is the same as SAP server address parameter. |
|
This is the port number to reach the TCP RFC server. For instance use 3301 to reach system 01 or 3310 to reach system 10. Default is 3300 + the last 2 digits of SAP client parameter. |
|
Should the system call the RFC function to explicitly update the status in SAP. Default is true and it required a RFC to be configured in SAP. Default is false. |
|
The name of the RFC updating the status. For instance: ZZBABELWAY_IDOC_STATUS_UPD |
|
Specify if unicode should be used. Use 0 for false and 1 for true. For instance: 0 |
Note:
- If there is a file name provided in the "Message In" or "Message Out" which contain ~ tilde character, All browser based on Chromium will replace the ~ tilde character by the _ underscore character when you try to download the file from the Babelway interface, For more details you can check this link https://bugs.chromium.org/p/chromium/issues/detail?id=479419
- The maximum file size accepted by this gateway is 100 MB.