0

I am working on an interface for communicating with SAP RFC functions. 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? Here are some examples of input parameters:

    • Example A (Structure within Structure):

      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):

      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):

      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?

Suncatcher
  • 10,355
  • 10
  • 52
  • 90

1 Answers1

1

RFC, including parameter types, is described in the documentation of each RFC Interface (documentation in each programming language RFC SDK, or ABAP documentation). You may use RFC both as client and server.

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).

In ABAP, you can know the types of parameters supported in RFC by combining these two articles:

If you don't have the time to combine them, here's a summary of parameter types for RFC-enabled function modules:

  • 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.
  • Tables which are not TABLES parameters can have lines of any of the 3 types above.
  • 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.
  • The names of fields, structures and tables are unique per hierarchical level, whatever their parameter category, IMPORTING, EXPORTING, CHANGING or TABLES, e.g.
    • a component of a structure at level 1 may have the same name as a parameter at level 1.
    • a field and a structure at level 1 cannot have the same name
  • 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).

The rows of one table all have the same type, so your diagrams mentioning S1 and S2 are incorrect, you could just mention 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:

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 
    Table T1.T1
        Field T1.T1.F1
Table T2
    Structure T2.S1
        Field T2.S1.F1
Table T3
    Field T3.F1

Reference:

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • Thanks, great and comprehensive answer. Just some follow-up questions. 1. Is it allowed to have a table and a structure on level 1 with the same name? 2. Is every (topmost) table used inside a deeper hierarchie like S1.T1 also referenced on level 1 of the TABLE category like you displayed in your example? I am asking all of that to know if makes sense to use a Dictionary/Map per hierarchie level for Import parameters incl. tables or if it could lead to a key collision in some cases. – SwissEngineer Aug 15 '22 at 11:28
  • 1. Parameter name must be unique, whatever it's field, structure or table, except the "exception" I mentioned ---- 2. No, the types can be anything, I'll switch the types in my example to show that (NB: the tables I mentioned at level 1 are not necessarily of the TABLES category, they could be of categories IMPORTING, EXPORTING or CHANGING, and table T3 cannot be of TABLES category). – Sandra Rossi Aug 15 '22 at 17:29
  • Do I understand correctly, that tables can be of category IMPORTING, EXPORTING OR TABLES (which should be the same as CHANGING when speaking of tables)? – SwissEngineer Aug 15 '22 at 21:12
  • You understand correctly. The category TABLES is a legacy from the past. – Sandra Rossi Aug 16 '22 at 05:53