简体   繁体   English

SAP RFC 参数和表层次结构和名称唯一性

[英]SAP RFC parameters and tables hierarchie and name uniqueness

I am working on an interface for communicating with SAP RFC functions.我正在开发一个与 SAP RFC 函数通信的接口。 I have some questions regarding parameter hierarchy and uniqueness of parameter and table naming to which I can't seem to find an answer anywhere online.我有一些关于参数层次结构以及参数和表命名的唯一性的问题,我似乎无法在网上的任何地方找到答案。

  1. Are the deep hierarchical structures allowed when communicating via RFC?通过 RFC 进行通信时是否允许使用深层层次结构? Here are some examples of input parameters:以下是输入参数的一些示例:

    • Example A (Structure within Structure):示例 A(结构中的结构):

       Field F1 Field F2 Structure S1 Field S1.F1 Structure S1.S1 Field S1.S1.F1 Field S1.S1.F2 Field S1.F2 Field S1.F3
    • Example B (Table within Structure):示例 B(结构中的表):

       Field F1 Field F2 Structure S1 Field S1.F1 Table S1.T1 Structure S1.T1.S1 (Row 1) Field S1.T1.S1.F1 Field S1.T1.S1.F2 Structure S1.T1.S2 (Row 2) Field S1.T1.S2.F1 Field S1.T1.S2.F2 Field S1.F2 Field S1.F3
    • Example C (Table within Table):示例 C(表中表):

       Field F1 Field F2 Table T1 Structure T1.S1 (Row 1) Field T1.S1.F1 Table T1.S1.T1 Structure T1.S1.T1.S1 (Row 1) Field T1.S1.T1.S1.F1 Field T1.S1.T1.S1.F2 Structure T1.S1.T1.S2 (Row 2) Field T1.S1.T1.S2.F1 Field T1.S1.T1.S2.F2 Structure T1.S2 (Row 2) Field T1.S2.F1 Table T1.S2.T1 Structure T1.S2.T1.S1 (Row 1) Field T1.S2.T1.S1.F1 Field T1.S2.T1.S1.F2 Structure T1.S2.T1.S2 (Row 2) Field T1.S2.T1.S2.F1 Field T1.S2.T1.S2.F2
  2. Are the names of fields, structures and tables per hierarchical level unique?每个层次级别的字段、结构和表的名称是否唯一? Or are the tables handled separately and could for example have the same name as a field or a structure?或者这些表是单独处理的,例如可以与字段或结构具有相同的名称?

RFC, including parameter types, is described in the documentation of each RFC Interface (documentation in each programming language RFC SDK, or ABAP documentation ). RFC,包括参数类型,在每个 RFC 接口的文档中都有描述(每种编程语言的文档 RFC SDK 或ABAP 文档)。 You may use RFC both as client and server.您可以将 RFC 用作客户端和服务器。

If you use RFC SDK (any programming language except ABAP) to create an RFC server (to expose RFC functions), I guess the types of the parameters support the same types as in ABAP (but I can't be sure so please refer to the documentation of each SDK in case of exceptions).如果您使用 RFC SDK(除 ABAP 之外的任何编程语言)来创建 RFC 服务器(以公开 RFC 功能),我猜参数的类型支持与 ABAP 中相同的类型(但我不能确定所以请参考每个 SDK 的文档,以防出现异常)。

In ABAP, you can know the types of parameters supported in RFC by combining these two articles:在ABAP中,结合这两篇文章可以知道RFC中支持的参数类型:

If you don't have the time to combine them, here's a summary of parameter types for RFC-enabled function modules:如果您没有时间组合它们,这里是支持 RFC 的 function 模块的参数类型摘要:

  • A parameter can be of any type, elementary (what you call "fields"), structure, table.参数可以是任何类型、基本的(你称之为“字段”)、结构、表格。
  • Structures can have components of any of the 3 types above.结构可以具有上述 3 种类型中的任何一种的组件。
  • Tables which are not TABLES parameters can have lines of any of the 3 types above.不是 TABLES 参数的表可以具有上述 3 种类型中的任何一种。
  • Tables which are TABLES parameters must have lines of type flat, which means that the line cannot contain fields of type STRING or XSTRING, nor tables.作为 TABLES 参数的表必须具有 flat 类型的行,这意味着该行不能包含 STRING 或 XSTRING 类型的字段,也不能包含表。
  • The names of fields, structures and tables are unique per hierarchical level, whatever their parameter category, IMPORTING, EXPORTING, CHANGING or TABLES, eg字段、结构和表的名称在每个层次级别都是唯一的,无论它们的参数类别是 IMPORTING、EXPORTING、CHANGING 还是 TABLES,例如
    • a component of a structure at level 1 may have the same name as a parameter at level 1.级别 1 的结构组件可能与级别 1 的参数具有相同的名称。
    • a field and a structure at level 1 cannot have the same name级别 1 的字段和结构不能同名
  • One exception to the previous rule is that two parameters can have the same name at level 1 if they are of type IMPORTING and EXPORTING (they are considered the same as one CHANGING parameter of that name - see SAP note 357348 - Import and export parameters of the same name).上一条规则的一个例外是,如果两个参数的类型为 IMPORTING 和 EXPORTING,则它们可以在级别 1 具有相同的名称(它们被认为与该名称的一个 CHANGING 参数相同 - 请参阅 SAP 说明 357348 - 的导入和导出参数同名)。

The rows of one table all have the same type, so your diagrams mentioning S1 and S2 are incorrect, you could just mention S1.一个表的行都具有相同的类型,所以你的图表提到 S1 和 S2 是不正确的,你可以只提到 S1。 Note that a table parameter can have lines also of type elementary and table.请注意,表格参数也可以包含元素和表格类型的行。

Here is an example of valid parameters of an RFC-enabled function module:以下是启用 RFC 的 function 模块的有效参数示例:

Field F1
Structure S1 
    Field S1.F1
    Structure S1.S1
        Field S1.S1.F1
    Table T1 
        Structure T1.S1
            Field T1.S1.F1
    Table T2
        Field T2.F1
    Table T3
        Table T3.T1
            Field T3.T1.F1
Table T1 
    Structure T1.S1
        Field T1.S1.F1
Table T2
    Field T2.F1
Table T3
    Table T3.T1
        Field T3.T1.F1

Reference:参考:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM