SAP ERP

借助 SAP ERP 连接器,您可以对 SAP ERP 数据执行插入、删除、更新和读取操作。

准备工作

在使用 SAP ERP 连接器之前,请完成以下任务:

  • 在您的 Google Cloud 项目中:
    • 将 IAM 角色 roles/connectors.admin 授予配置连接器的用户。
    • 将以下 IAM 角色授予您要用其来使用连接器的服务账号:
      • roles/secretmanager.viewer
      • roles/secretmanager.secretAccessor
      • roles/storage.objectViewer

      服务账号是一种特殊类型的 Google 账号,用于表示需要验证身份并获得授权以访问 Google API 数据的非人类用户。如果您没有服务账号,则必须创建一个服务账号。如需了解详情,请参阅创建服务账号

    • 启用以下服务:
      • secretmanager.googleapis.com (Secret Manager API)
      • connectors.googleapis.com (Connectors API)

      如需了解如何启用服务,请参阅启用服务

    如果之前没有为您的项目启用这些服务或权限,则在您配置连接器时,系统会提示您启用。

配置连接器

配置连接器时,您需要创建与数据源(即后端系统)的连接。一个连接需专用于一个数据源。这意味着,如果您有许多数据源,则必须为每个数据源创建单独的连接。如需创建连接,请执行以下步骤:

  1. Cloud 控制台 中,进入 Integration Connectors > 连接页面,然后选择或创建一个 Google Cloud 项目。

    转到“连接”页面

  2. 点击 + 新建以打开创建连接页面。
  3. 位置部分,选择连接的位置。
    1. 区域:从下拉列表中选择一个位置。

      如需查看所有受支持区域的列表,请参阅位置

    2. 点击下一步
  4. Connection Details(连接详情)部分中,完成以下操作:
    1. 连接器:从可用连接器下拉列表中选择 SAP ERP
    2. 连接器版本:从可用版本的下拉列表中选择连接器版本。
    3. Connection Name 字段中,输入连接实例的名称。

      连接名称必须满足以下条件:

      • 连接名称可以使用字母、数字或连字符。
      • 字母必须小写。
      • 连接名称必须以字母开头,以字母或数字结尾。
      • 连接名称不能超过 63 个字符。
    4. (可选)输入连接的说明
    5. (可选)启用 Cloud Logging
    6. 服务账号:选择具有所需角色的服务账号。
    7. 如需将连接用于事件订阅,请选择启用事件订阅。选择此选项,系统会显示以下选项:
      • 为事件订阅启用实体和操作:选择此选项可将连接同时用于事件订阅和连接器操作(实体和操作)。
      • Enable only event subscription(仅启用事件订阅):选择此选项可将连接仅用于事件订阅。如果您选择此选项,请点击下一步,然后配置事件订阅
    8. 客户端:向 SAP 系统进行身份验证的客户端。
    9. System Id:SAP 系统的 System Id 或 R3Name 是一个字符串,最多包含 3 个字符。它通常用于负载均衡连接。
    10. 系统编号:定义目标系统所用的编号。在设置主机连接属性时使用。
    11. 项目 ID:包含 SAP JCo jar 的 GCS 存储桶所在的 Google Cloud 项目的 ID。
    12. 存储桶:包含 sapjco3.jar 和 libsapjco3.so 文件的存储桶的名称。
    13. Jaco jar 对象 ID:JCo jar 的对象 ID。
    14. libsapjco3 对象 ID:libsapjco3 jar 的对象 ID。
    15. 表模式:选择要显示为视图的 SAP 表。
    16. SNC_LIB 对象 ID:SNC 库的对象 ID。
    17. PSE 名称:适用于存储桶的个人安全环境 (PSE) 文件的名称。PSE 文件以 ASN.1 结构存储公钥和私钥对以及 X.509 证书。
    18. 群组:用于登录的群组名称。如果您的 SAP 系统使用负载平衡器,通常会指定该属性。
    19. 消息服务器:连接到使用负载平衡器的 SAP 系统时使用的消息服务器的名称。
    20. 读取表格函数:要用于读取表格的函数名称。如需了解详情,请参阅使用自定义读取表函数
    21. 连接方案:选择用于连接到 SAP 系统的连接方案。
    22. 系统 ID:SAP 系统的系统 ID 或 R3Name。您最多可以输入 3 个字符。
    23. SNC 密码:选择 SNC 库密码的 Secret Manager 密钥。
    24. Secret 版本:选择 Secret 版本。
    25. SNC 模式:选择此选项可以为 Integration Connectors 和 SAP 系统之间的身份验证启用 SNC。
    26. SNC 名称:输入 SNC 连接的名称。
    27. SNC qop:选择保护级别。以下是支持的级别:
      • 1 - 仅应用身份验证。
      • 2 - 应用完整性保护。这也包括身份验证保护。
      • 3 - 采取隐私保护措施。这也包括完整性和身份验证保护。
      • 8 - 应用默认保护。
      • 9 - 应用最高保护措施。
    28. SNC 合作伙伴名称:输入应用服务器的 SNC 名称。
    29. 查询模式:选择应将哪些 SAP 表显示为视图。
    30. 可浏览视图:输入要显示的视图列表(以英文逗号分隔)。 例如 ViewA,ViewB,ViewC
    31. 详细程度级别:输入日志记录的详细程度级别。支持的值介于 1 到 5 之间。值越高,表示日志中越详细。
    32. (可选)配置连接节点设置

      • 节点数下限:输入连接节点数下限。
      • 节点数上限:输入连接节点数上限。

      节点是处理事务的连接单元(或副本)。 连接处理越多事务就需要越多节点,相反,处理越少事务需要越少节点。 如需了解节点如何影响连接器价格,请参阅连接节点的价格。如果未输入任何值,则默认情况下,节点数下限设置为 2(以便提高可用性),节点数上限设置为 50。

    33. (可选)点击 + 添加标签,以键值对的形式向连接添加标签。
    34. 点击下一步
  5. 目标位置部分,输入您要连接的远程主机(后端系统)的详细信息。
    1. 目的地类型:选择目的地类型
      • 从列表中选择主机地址,以指定目的地的主机名或 IP 地址。
      • 如果要与后端系统建立专用连接,请从列表中选择端点连接,然后从端点连接列表中选择所需的端点连接。

      如果要与后端系统建立公共连接以提高安全性,您可以考虑为连接配置静态出站 IP 地址,然后将防火墙规则配置为仅将特定静态 IP 地址列入许可名单。

      要输入其他目的地,请点击 +添加目的地

    2. 点击下一步
  6. Authentication(身份验证)部分中,输入身份验证详细信息。
    1. 选择身份验证类型,然后输入相关详情。

      SAP ERP 连接支持以下身份验证类型:

      • 用户名和密码
    2. 如需了解如何配置这些身份验证类型,请参阅配置身份验证

    3. 点击下一步
  7. 如果您已启用事件订阅,则连接创建页面上会显示事件订阅详情部分。如需了解如何配置事件订阅详细信息,请参阅配置事件订阅
  8. 查看:查看您的连接和身份验证详细信息。
  9. 点击创建

配置身份验证

根据您要使用的身份验证输入详细信息。

  • 用户名和密码
    • 用户名:连接器的用户名
    • 密码:包含与连接器关联的密码的 Secret Manager Secret。

配置事件订阅

如果您已启用事件订阅,请在事件订阅详情 (Event Subscription Details) 部分中输入以下值:

  1. 为事件监听器选择以下任一身份验证类型。
  2. 输入事件类型字段名称。此字段用于标识与传入事件请求相关联的事件类型。
    {
    "event_type": "user.created",
    ...
    // other request fields
    ...
    }
  3. Select Enable private connectivity for secured connectivity between your backend application and your connection. If you select this option, you must perform additional configuration steps after creating the connection. For more information, see Private connectivity for event subscription.
  4. Enter the dead-letter configuration. If you configure dead-letter, the connection writes the unprocessed events to the specified Pub/Sub topic. Enter the following details:
    1. Dead-letter project ID: The Google Cloud project ID where you have configured the dead-letter Pub/Sub topic.
    2. Dead-letter topic: The Pub/Sub topic where you want to write the details of the unprocessed event.

Entities, operations, and actions

All the Integration Connectors provide a layer of abstraction for the objects of the connected application. You can access an application's objects only through this abstraction. The abstraction is exposed to you as entities, operations, and actions.

  • Entity: An entity can be thought of as an object, or a collection of properties, in the connected application or service. The definition of an entity differs from a connector to a connector. For example, in a database connector, tables are the entities, in a file server connector, folders are the entities, and in a messaging system connector, queues are the entities.

    However, it is possible that a connector doesn't support or have any entities, in which case the Entities list will be empty.

  • Operation: An operation is the activity that you can perform on an entity. You can perform any of the following operations on an entity:

    Selecting an entity from the available list, generates a list of operations available for the entity. For a detailed description of the operations, see the Connectors task's entity operations. However, if a connector doesn't support any of the entity operations, such unsupported operations aren't listed in the Operations list.

  • Action: An action is a first class function that is made available to the integration through the connector interface. An action lets you make changes to an entity or entities, and vary from connector to connector. Normally, an action will have some input parameters, and an output parameter. However, it is possible that a connector doesn't support any action, in which case the Actions list will be empty.

System limitations

The SAP ERP connector can process 7 transactions per second, per node, and throttles any transactions beyond this limit. By default, Integration Connectors allocates 2 nodes (for better availability) for a connection.

For information on the limits applicable to Integration Connectors, see Limits.

Connection configuration samples

This section lists the sample values for the various fields that you would configure when creating the connection.

ApplicationServer connection type

The following table lists the sample configuration values for the ApplicationServer connection type. Refer to the connection creation interface in the console to know the mandatory and optional fields.

Field name Sample value
Region us-central1
Connector SAP ERP
Connector Version 1
Connector Name saperp-applicationserver-conn
Description NA
Service Account xxxxxxxxx-compute@developer.gserviceaccount.com
Client 800
System Number 00
Project ID xxxx-gcp-project
Bucket sap-erp-bucket
Jco Jar object ID sapjco3.jar
libsapjco3 object ID libsapjco3.so
Table Mode TransparentApplication/TransparentCustomer/TransparentSystem/Pooled/Cluster/None
Read Table Function Z_CUSTOM_READ_TABLE
Connection Scheme ApplicationServer
System Id SA1
Query Mode NA
Browsable Views NA
Verbosity Level 5
Minimum number of nodes 2
Maximum number of nodes 50
Host Address 10.30.X.XX or Router string of an external SAP system.
Authentication User Password
Username 12345
Password xyz@12345
versions 1

GroupServer connection type

The following table lists the sample configuration values for the GroupServer connection type. Refer to the connection creation interface in the console to know the mandatory and optional fields.

Field name Sample value
Region us-central1
Connector SAP ERP
Connector Version 1
Connector Name saperp-GroupServer-conn
Description NA
Service Account xxxxxxxxx-compute@developer.gserviceaccount.com
Client 800
System Number 00
Project ID xxxx-gcp-project
Bucket sap-erp-bucket
Jco Jar object ID sapjco3.jar
libsapjco3 object ID libsapjco3.so
Table Mode TransparentApplication/TransparentCustomer/TransparentSystem/Pooled/Cluster/None
Group PUBLIC
Message Server 10.30.X.XX
Read Table Function Z_CUSTOM_READ_TABLE
Connection Scheme GroupServer
System Id SA1
Query Mode NA
Browsable Views NA
Verbosity Level 5
Minimum number of nodes 2
Maximum number of nodes 50
Host Address 10.30.X.XX or Router String of External SAP System.
Authentication User Password
Username 12345
Password xyz@12345
versions 1

X509 certificate connection type

The following table lists the sample configuration values for the X509 certificate connection type. Refer to the connection creation interface in the console to know the mandatory and optional fields.

Field name Sample value
Region us-central1
Connector SAP ERP
Connector Version 1
Connector Name saperp-X509Certificate-conn
Description NA
Service Account xxxxxxxxx-compute@developer.gserviceaccount.com
Client 800
System Number 00
Project ID xxxx-gcp-project
Bucket sap-erp-bucket
Jco Jar object ID sapjco3.jar
libsapjco3 object ID libsapjco3.so
Table Mode TransparentApplication/TransparentCustomer/TransparentSystem/Pooled/Cluster/None
SNC_LIB object ID libsapcrypto.so
PSE Name to create cred_v2 file EHP8_GCP_SA1.pse
Read Table Function Z_CUSTOM_READ_TABLE
Connection Scheme ApplicationServer
System Id SA1
SNC passcode xyz@gcp
SNC Mode A boolean determining if you are using SNC. Set this to true to use SNC.
SNC Name p:CN=EHP8_GCP_SA1, OU=IT, O=CSW, C=DE
SNC Qop 3
SNC PartnerName p:CN=SA1, OU=I0020070395, OU=SAP Web AS, O=SAP Trust Community, C=DE
Query Mode NA
Browsable Views NA
Verbosity Level 5
Minimum number of nodes 2
Maximum number of nodes 50
Host Address 10.30.X.XX or Router String of External SAP System.
Authentication X509Certificate Based Authentication
X509Certificate The X509 certificate may be specified using a file path pointing to a file containing an X509 certificate in PEM format, a PEM blob beginning with the "-----BEGIN ..." header, or a PEM blob without the "-----BEGIN ..." header.
versions 1

Actions

This section lists the actions supported by the connector. To understand how to configure the actions, see Action examples.

BAPI_MATERIAL_SAVEDATA action

This action let you perform specific tasks. For example, you can use it to create or change material master data in SAP ERP.

Input parameters of the BAPI_MATERIAL_SAVEDATA action

Parameter Name Data Type Required Description
HEADDATA String Yes The input parameter HEADDATA.
CLIENTDATA String Yes The input parameter CLIENTDATA.
CLIENTDATAX String Yes The input parameter CLIENTDATAX.
MATERIALDESCRIPTION String Yes The table MATERIALDESCRIPTION.

Output parameters of the BAPI_MATERIAL_SAVEDATA action

This action returns the status 200 (OK) if the action is successful.

For example on how to configure the BAPI_MATERIAL_SAVEDATA action, see Action examples.

ZFM_GCP_MULTIDATA_TAB action

This action let users perform specific tasks. For example, you can create multi datatype data in SAP ERP.

Input parameters of the ZFM_GCP_MULTIDATA_TAB action

Parameter Name Data Type Required Description
ReturnTables String Yes A comma separated list that specifies which tables in the function module should be output. If not specified, all returned tables will be output.
T_TABLE String Yes The table T_TABLE.
IM_INPUT_1 String Yes The input parameter IM_INPUT_1.
IM_INPUT_2 String Yes The input parameter IM_INPUT_2.

Output parameters of the ZFM_GCP_MULTIDATA_TAB action

This action returns the status 200 (OK) if the action is successful.

For example on how to configure the ZFM_GCP_MULTIDATA_TAB action, see Action examples.

PushIDoc Action

This action let you perform specific tasks. For example, you can transfer data from SAP to an external system.

Input parameters of the PushIDoc action

Parameter Name Data Type Required Description
FileType String Yes The file type.The allowed values are XML, IDoc.
Mode String Yes The transfer mode.The allowed values are Sync, ASync.
Content String Yes Content of the file.

Output parameters of the PushIDoc action

This action returns the status 200 (OK) if the action is successful.

For example on how to configure the PushIDoc action, see Action examples.

ExecuteCustomQuery action

This action lets you execute a custom query.

To create a custom query, follow these steps:

  1. Follow the detailed instructions to add a connectors task.
  2. When you configure the connector task, in the type of action you want to perform, select Actions.
  3. In the Action list, select Execute custom query, and then click Done.

    image showing execute-custom-query-action image showing execute-custom-query-action

  4. Expand the Task input section, and then do the following:
    1. In the Timeout after field, enter the number of seconds to wait till the query executes.

      Default value: 180 seconds.

    2. In the Maximum number of rows field, enter the maximum number of rows to be returned from the database.

      Default value: 25.

    3. To update the custom query, click Edit Custom Script. The Script editor dialog opens.

      image showing custom-sql-query image showing custom-sql-query

    4. In the Script editor dialog, enter the SQL query and click Save.

      You can use a question mark (?) in a SQL statement to represent a single parameter that must be specified in the query parameters list. For example, the following SQL query selects all rows from the Employees table that matches the values specified for the LastName column:

      SELECT * FROM Employees where LastName=?

    5. 如果您在 SQL 查询中使用了问号,则必须为每个问号点击 + 添加参数名称以添加参数。执行集成时,这些参数会依序替换 SQL 查询中的问号 (?)。例如,如果您添加了三个问号 (?),则必须按顺序添加三个参数。

      显示 add-query-param 的图片 显示 add-query-param 的图片

      如需添加查询参数,请执行以下操作:

      1. 类型列表中,选择参数的数据类型。
      2. 字段中,输入参数的值。
      3. 要添加多个参数,请点击 + 添加查询参数

    成功执行后,此操作将返回状态 200 (OK) 以及包含查询结果的响应正文。

    操作示例

    示例 - 创建记录

    本示例使用 BAPI_MATERIAL_SAVEDATA 操作创建了一条记录。

    1. Configure connector task 对话框中,点击 Actions
    2. 选择 BAPI_MATERIAL_SAVEDATA 操作,然后点击完成
    3. 连接器任务的任务输入部分中,点击 connectorInputPayload,然后在 Default Value 字段中输入类似于以下内容的值:
      {
      "HEADDATA": "{\"MATERIAL\":\"000000000000009001\",\"IND_SECTOR\":\"M\",\"MATL_TYPE\":\"HALB\",\"BASIC_VIEW\":\"X\"}",
      "CLIENTDATA" : "{\"MATL_GROUP\":\"00107\",\"BASE_UOM\":\"KG\"}",
      "CLIENTDATAX" : "{\"MATL_GROUP\":\"X\",\"BASE_UOM\":\"X\"}",
      "MATERIALDESCRIPTION" : "{\"LANGU\":\"E\",\"MATL_DESC\":\"Classification Google\"}"
      }
    4. 如果操作成功,BAPI_MATERIAL_SAVEDATA 任务的 connectorOutputPayload 响应参数的值将类似于以下内容:

      [{
      "RETURN_TYPE": "S",
      "RETURN_ID": "MM",
      "RETURN_NUMBER": 356,
      "RETURN_MESSAGE": "The material 9001 has been created or extended",
      "RETURN_LOG_NO": "",
      "RETURN_LOG_MSG_NO": 0,
      "RETURN_MESSAGE_V1": "9001",
      "RETURN_FIELD": "",
      "RETURN_SYSTEM": "T90CLNT090",
      "RESULT_TABLE": null
      }]

    示例 - 更新记录

    此示例通过使用 BAPI_MATERIAL_SAVEDATA 操作更新数据记录。

    1. Configure connector task 对话框中,点击 Actions
    2. 选择 BAPI_MATERIAL_SAVEDATA 操作,然后点击完成
    3. 连接器任务的任务输入部分中,点击 connectorInputPayload,然后在 Default Value 字段中输入类似于以下内容的值:
      {
      "HEADDATA": "{\"MATERIAL\":\"000000000000009000\",\"IND_SECTOR\":\"A\",\"MATL_TYPE\":\"FHMI\",\"BASIC_VIEW\":\"X\"}",
      "CLIENTDATA": "{\"MATL_GROUP\":\"013\",\"BASE_UOM\":\"ST\"}",
      "CLIENTDATAX": "{\"MATL_GROUP\":\"X\",\"BASE_UOM\":\"X\"}",
      "MATERIALDESCRIPTION": "{\"LANGU\":\"E\",\"MATL_DESC\":\"Classification Googlecloud\"}"
      }
    4. 如果操作成功,BAPI_MATERIAL_SAVEDATA 任务的 connectorOutputPayload 响应参数的值将如下所示:

      [{
      "RETURN_TYPE": "S",
      "RETURN_ID": "MM",
      "RETURN_NUMBER": 356,
      "RETURN_MESSAGE": "The material 9000 has been created or extended",
      "RETURN_LOG_NO": "",
      "RETURN_LOG_MSG_NO": 0,
      "RETURN_MESSAGE_V1": "9000",
      "RETURN_PARAMETER": "",
      "RETURN_ROW": 0,
      "RETURN_FIELD": "",
      "RETURN_SYSTEM": "T90CLNT090",
      "RESULT_TABLE": null
      }]

    示例 - 删除记录

    此示例通过使用 BAPI_MATERIAL_SAVEDATA 操作删除记录。

    1. Configure connector task 对话框中,点击 Actions
    2. 选择 BAPI_MATERIAL_SAVEDATA 操作,然后点击完成
    3. 连接器任务的任务输入部分中,点击 connectorInputPayload,然后在 Default Value 字段中输入类似于以下内容的值:
      {
      "HEADDATA": "{\"MATERIAL\":\"000000000000009000\",\"BASIC_VIEW\":\"X\"}",
      "CLIENTDATA": "{\"DEL_FLAG\":\"X\"}",
      "CLIENTDATAX": "{\"DEL_FLAG\":\"X\"}"
      }
    4. 如果操作成功,BAPI_MATERIAL_SAVEDATA 任务的 connectorOutputPayload 响应参数的值将如下所示:

      [{
      "RETURN_TYPE": "S",
      "RETURN_ID": "MM",
      "RETURN_NUMBER": 356,
      "RETURN_LOG_NO": "",
      "RETURN_LOG_MSG_NO": 0,
      "RETURN_MESSAGE_V1": "9000",
      "RETURN_PARAMETER": "",
      "RETURN_ROW": 0,
      "RETURN_FIELD": "",
      "RETURN_SYSTEM": "T90CLNT090",
      "RESULT_TABLE": null
      }]
      

    示例 - 创建多数据类型数据

    此示例使用 ZFM_GCP_MULTIDATA_TAB 操作创建多数据类型数据。

    1. Configure connector task 对话框中,点击 Actions
    2. 选择 ZFM_GCP_MULTIDATA_TAB 操作,然后点击完成
    3. 连接器任务的任务输入部分中,点击 connectorInputPayload,然后在 Default Value 字段中输入类似于以下内容的值:
      {
      "T_TABLE": "{\"ZACCP\":\"111\",\"ZCHAR\":\"CHARACTER1\",\"ZCLNT\":\"100\",\"ZCUKY\":\"INR\",\"ZCURR\": 200,\"ZDATS\": \"20231213\",\"ZINT1\": 45,\"ZINT2\":54,\"ZDEC\": 0.12,\"ZFLTP\": 1234,\"ZLANG\":\"E\",\"ZNUMC\":\"110\",\"ZPREC\": 3,\"ZQUAN\": 188.0,\"ZRAW\":\"01010008010101050401\",\"ZTIMS\": \"103056\",\"ZUNIT\":\"11\",\"ZINT4P\": 45,\"ZINT4\": 54,\"ZLRAW\":\"0101000801010105040100030101010300040000\"}",
      "IM_INPUT_1": "{\"ZACCP\":\"222\",\"ZCHAR\":\"CHARACTER1\",\"ZCLNT\":\"100\",\"ZCUKY\":\"INR\",\"ZCURR\": 200,\"ZDATS\": \"20231213\",\"ZINT1\": 45,\"ZINT2\":54,\"ZDEC\": 0.12,\"ZFLTP\": 1234,\"ZLANG\":\"E\",\"ZNUMC\":\"110\",\"ZPREC\": 3,\"ZQUAN\": 188.0,\"ZRAW\":\"01010008010101050401\",\"ZTIMS\": \"103056\",\"ZUNIT\":\"11\",\"ZINT4P\": 45,\"ZINT4\": 54,\"ZLRAW\":\"0101000801010105040100030101010300040000\"}",
      "IM_INPUT_2": "{\"ZSTRING\": \"HI Google\",\"ZSSTRING\": \"HI Google How are you\"}"
      }
    4. 如果操作成功,ZFM_GCP_MULTIDATA_TAB 任务的 connectorOutputPayload 响应参数的值将如下所示:

      [{
      "EX_OUTPUT_1_ZACCP": 222,
      "EX_OUTPUT_1_ZCHAR": "CHARACTER1",
      "EX_OUTPUT_1_ZCLNT": "100",
      "EX_OUTPUT_1_ZCUKY": "INR",
      "EX_OUTPUT_1_ZCURR": 200,
      "EX_OUTPUT_1_ZDATS": "2023-12-13",
      "EX_OUTPUT_1_ZRAW": "01010008010101050401",
      "EX_OUTPUT_1_ZTIMS": "10:30:56",
      "EX_OUTPUT_1_ZUNIT": "11",
      "EX_OUTPUT_1_ZINT4P": 45,
      "EX_OUTPUT_1_ZINT4": 54,
      "EX_OUTPUT_1_ZLRAW": "0101000801010105040100030101010300040000\u0000",
      "EX_OUTPUT_2_ZSTRING": null,
      "EX_OUTPUT_2_ZSSTRING": null,
      "RESULT_TABLE": null,
      "T_TABLE_ZACCP": null,
      "T_TABLE_ZCHAR": null,
      "T_TABLE_ZCLNT": null,
      "T_TABLE_ZQUAN": null,
      "T_TABLE_ZRAW": null,
      "T_TABLE_ZTIMS": null,
      "T_TABLE_ZUNIT": null
      },{
      "EX_OUTPUT_1_ZACCP": null,
      "EX_OUTPUT_1_ZCHAR": null,
      "EX_OUTPUT_1_ZCLNT": null,
      "EX_OUTPUT_1_ZCUKY": null,
      "EX_OUTPUT_1_ZRAW": null,
      "T_TABLE_ZLANG": null,
      "T_TABLE_ZNUMC": null,
      "T_TABLE_ZPREC": null,
      "T_TABLE_ZQUAN": null,
      "T_TABLE_ZRAW": null,
      "T_TABLE_ZTIMS": null,
      "T_TABLE_ZUNIT": null
      },{
      "EX_OUTPUT_1_ZACCP": null,
      "EX_OUTPUT_1_ZCHAR": null,
      "EX_OUTPUT_1_ZCLNT": null,
      "EX_OUTPUT_1_ZCUKY": null,
      "EX_OUTPUT_1_ZCURR": null,
      "EX_OUTPUT_1_ZDATS": null,
      "EX_OUTPUT_1_ZDEC": null,
      "EX_OUTPUT_1_ZQUAN": null,
      "T_TABLE_ZNUMC": 110,
      "T_TABLE_ZPREC": 3,
      "T_TABLE_ZQUAN": 188,
      "T_TABLE_ZRAW": "01010008010101050401",
      "T_TABLE_ZTIMS": "10:30:56",
      "T_TABLE_ZUNIT": "11"
      }]
      

    示例 - 推送 IDoc

    此示例将 IDoc 推送到 SAP ERP。

    1. Configure connector task 对话框中,点击 Actions
    2. 选择 PushIDoc 操作,然后点击完成
    3. 连接器任务的任务输入部分中,点击 connectorInputPayload,然后在 Default Value 字段中输入类似于以下内容的值:
      {
      "Content": "\n\n\n EDI_DC40\n 800\n 0000000008604824\n 740\n 53\n 2\n \n MATMAS05\n MATMAS\n ZLS_QA23\n LS\n ZLS_QA23\n SAPSA1\n LS\n SA1CLNT800\n 20230218\n 232556\n\n\n 005\n 000000000000000012\n 20170328\n 42039\n 20170727\n 42039\n KLVC\n FERT\n M\n 02\n BG\n 000\n 002\n 0.000\n 0.000\n KGM\n 0.000\n 0001\n 0.000\n 0.000\n 0.000\n 0.000\n 0.000\n",
      "FileType": "XML",
      "Mode": "ASync"
      }
    4. 如果操作成功,PushIDoc 任务的 connectorOutputPayload 响应参数的值将如下所示:

      [{
      "Result": "Success",
      "Message": "Push IDoc success"
      }]

    实体操作示例

    本部分介绍如何在此连接器中执行某些实体操作。

    示例 - 列出所有记录

    以下示例列出了 T001 实体中的所有记录。

    1. Configure connector task 对话框中,点击 Entities
    2. Entity 列表中选择 T001
    3. 选择 List 操作,然后点击完成
    4. (可选)在连接器任务的任务输入部分,您可以通过指定过滤条件子句来过滤结果集。始终用英文单引号 (') 指定过滤条件子句值。

    示例 - 从实体获取记录

    此示例从 T001 实体中获取具有指定 ID 的记录。

    1. Configure connector task 对话框中,点击 Entities
    2. Entity 列表中选择 T001
    3. 选择 Get 操作,然后点击完成
    4. 连接器任务的任务输入部分中,点击 EntityId,然后在默认值字段中输入 0001

      其中,0001T001 实体中的唯一记录 ID。

    读取大型数据

    很多时候,SAP ERP 连接器可能必须从 SAP 后端读取大量数据。本部分介绍了读取大型数据需要遵循的方法。

    SAP ERP 连接器使用 SAP RFC_READ_TABLE 函数从 SAP 表获取数据,此函数的固定大小为 512 字节。它可以为每行数据缓冲,因此,您选择的列数不能超过该缓冲区可容纳的数量。如果您选择超过 512 个字节,则在运行集成时会发生 DATA_BUFFER_EXCEEDED 异常;这表示您超出了每行允许的缓冲区空间上限,需要减少列数。

    为解决此问题,您可以添加 Custom RFC_READ_TABLE 的代码,该代码与 SAP RFC_READ_TABLE 类似,但具有更大的缓冲区来解决 DATA_BUFFER_EXCEEDED 问题。

    使用自定义读取表函数

    连接器支持与 SAP RFC_READ_TABLE 类似的 Custom RFC_READ_TABLE,但具有更大的缓冲区,因此它可以解决 DATA_BUFFER_EXCEEDED 问题。

    在 SAP 后端中创建自定义 RFC_READ_TABLE

    要使用 示例自定义 RFC_READ_TABLE,请按以下步骤操作。

    1. 使用 RFC_READ_TABLE 函数作为新函数的模板:选择事务代码 SE37 和 SDTX 函数组,并将 RFC_READ_TABLE 复制到新的函数组或您的工作函数组。在此示例中,RFC_READ_TABLE 会复制到 Z_CUSTOM_RFC_TABLE
    2. 在 SAP 页面的 Attributes 标签页中,选择 Remote Enabled Module
    3. 表格标签页中,将 DATA 参数设置为 CHAR8000(您可能需要右键点击,然后点击显示 -> 更改)。
    4. 源代码标签页中,输入自定义的只读表 RFC 代码。有关参考信息,请参阅 Z_CUSTOM_RFC_TABLE_function.txt 示例
    5. 点击保存
    6. 按照提供的自定义读取表中所述定义导入、表和异常。
    7. 激活函数模块。

    适用于 ABAP 7.52 的自定义读取表

    如果您使用的是 ABAP 7.52 或更高版本,请参阅示例 Z_CUSTOM_RFC_TABLE_function_ABAP752.txt。 该示例函数专为 ABAP 7.52 版及更高版本而设计。它与 Z_CUSTOM_RFC_TABLE 函数类似,但它会利用 ABAP 7.52 中新增的关键字在数据库(而不是 ABAP 脚本本身)中执行分页。这大大提高了分页的效率,并提高了处理大型表时的性能。建议尽可能使用 Z_CUSTOM_RFC_TABLE_752 RFC

    使用 Terraform 创建连接

    您可以使用 Terraform 资源创建新连接。

    如需了解如何应用或移除 Terraform 配置,请参阅基本 Terraform 命令

    如需查看用于创建连接的 Terraform 模板示例,请参阅示例模板

    使用 Terraform 创建此连接时,您必须在 Terraform 配置文件中设置以下变量:

    参数名称 数据类型 必填 说明
    客户端 STRING True 向 SAP 系统进行身份验证的客户端。
    群组 STRING False 正在使用的登录组。通常,只有在连接到使用负载均衡功能的 SAP 系统时才需要指定此字段。
    message_server STRING False 在连接到使用负载均衡功能的 SAP 系统时,必须指定消息服务器。
    read_table_function STRING False 用于读取表数据的函数。
    connection_scheme ENUM False 指定是使用消息服务器 (GroupServer) 还是没有消息服务器 (ApplicationServer) 连接到 SAP 系统。支持的值包括:ApplicationServer、GroupServer
    system_id STRING False SAP 系统的 System Id 或 R3Name 是一个字符串,最多包含 3 个字符。它通常用于负载均衡连接。
    system_number STRING True 定义目标系统的数字。在设置主机连接属性时使用。
    project_id STRING True 包含 SAP JCo jar 的 Cloud Storage 存储桶所在的 Google Cloud 项目的 ID。
    存储桶 STRING True 包含 sapjco3.jar 和 libsapjco3.so 文件的存储桶的名称
    sapjco3_jar STRING True sapjco3.jar 的对象 ID
    libsapjco3_so STRING True libsapjco3.so 的对象 ID
    snc_lib STRING False SNC 库的对象 ID
    snc_mode BOOLEAN False 确定您是否正在使用 SNC 的布尔值。若要使用 SNC,请将此值设置为 true。
    snc_name STRING False 包含您的 SNC 连接名称的可选输入。
    snc_qop ENUM False SNC 连接的保护质量。有效值为 1、2、3、8 或 9,分别对应以下保护级别:1 仅应用身份验证。2 应用完整性保护(身份验证)。3 实施隐私保护(完整性和身份验证)。8 应用默认保护。9 应用最高保护。支持的值包括:1、2、3、8、9
    snc_partner_name STRING False 应用服务器的 SNC 名称。使用 SNC 时,这是必填项。
    query_mode ENUM False 确定哪些 SAP 表将显示为视图(如果有)。支持的值包括:Global、Local、All、None
    table_mode ENUM False 确定哪些 SAP 表将显示为视图(如果有)。支持的值包括:TransparentApplication、TransparentCustomer、TransparentSystem、Pooled、Cluster、All、None
    详细程度 STRING False 连接的详细程度级别从 1 到 5 不等。较高的详尽级别将记录所有通信详情(请求、响应和 SSL 证书)。

    在集成中使用 SAP ERP 连接

    创建连接后,它在 Apigee Integration 和 Application Integration 中都可用。您可以通过连接器任务在集成中使用该连接。

    • 如需了解如何在 Apigee Integration 中创建和使用连接器任务,请参阅连接器任务
    • 如需了解如何在 Application Integration 中创建和使用连接器任务,请参阅连接器任务

    向 Google Cloud 社区寻求帮助

    您可以在 Cloud 论坛的 Google Cloud 社区中发布问题和讨论此连接器。

    后续步骤