0

I want to introspect input parameters (and maybe output as well) of a RFC given it's name.

I found methods RfcGetParameterCount and RfcGetParameterDescByIndex which have been used by the node-rfc library itself. But I am not able to figure out how to call these methods using client.invoke() or any other way.

https://www.npmjs.com/package/node-rfc

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
mangesh
  • 511
  • 8
  • 24
  • Does this answer your question? [Getting RFC Function Module Parameters in C#](https://stackoverflow.com/questions/51473491/getting-rfc-function-module-parameters-in-c-sharp) – Suncatcher Apr 07 '20 at 11:28
  • @Suncatcher the above link for C# provides RfcRepository.GetFunctionMetadata as the solution. I could not find anything like that for node-rfc. – mangesh Apr 08 '20 at 05:42
  • I meant [this answer](https://stackoverflow.com/a/51474960/911419) which suggests module `RFC_METADATA_GET` which can be called form node-rfc as well – Suncatcher Apr 08 '20 at 07:39
  • Yes, that works same as RFC_GET_FUNCTION_INTERFACE in answer below. – mangesh Apr 09 '20 at 04:11
  • Not the same, it is much more feature-rich, did you ever tried it? It allows fetching primitive types of structured parameters without RTTS – Suncatcher Apr 09 '20 at 09:10

3 Answers3

2

RFC_GET_FUNCTION_INTERFACE returns the parameters of a given RFC.

Mikael G
  • 712
  • 5
  • 13
  • This is working after passing the RFC name in FUNCNAME parameter. Now how do I differentiate between input and output parameters from the list of parameters returned ? – mangesh Apr 07 '20 at 04:18
  • 1
    @matpadikar https://imgur.com/a/lHUUdFf. `PARAMCLASS` where I means Importing (Input), E means Exporting (Output), T means Table (usually output but can be input as well) – Suncatcher Apr 07 '20 at 11:22
  • Tables (T) in a RFC can be seen as changing parameters (content may or may not be modified by the RFC). You need to understand the specific RFC to understand what it does. They are obsolete but of course exists in many RFC:s. Note that an import or export parameter also can be a table! – Mikael G Apr 08 '20 at 07:29
  • Mikael, @Suncatcher For parameters which are complex/structure/EXID=u , how to get the details of that parameter i.e get parameters inside that parameter ? – mangesh Apr 09 '20 at 04:56
  • 1
    `RFC_GET_STRUCTURE_DEFINITION`. You may also need `RFC_GET_NAMETAB`. – Mikael G Apr 09 '20 at 08:14
  • complex parameters have no defaults, only primitive types has defined initial values (=defaults). The initial value of structured types [is produced](https://help.sap.com/doc/abapdocu_753_index_htm/7.53/en-US/abeninitial_value_glosry.htm) from the initial values of the individual components. To get the type of the components of the structured parameter you should take its type from `TABNAME` field and analyze it with RTTS, and this is out of the scope of this question – Suncatcher Apr 09 '20 at 08:49
0

You may try this new rfmcall package: https://www.npmjs.com/package/rfmcall

bsrdjan
  • 436
  • 3
  • 10
0

Nowadays, you should call the function module RFC_METADATA_GET which is the standard way used by SAP official RFC Client libraries, rather than RFC_GET_FUNCTION_INTERFACE, which is older (now, it's currently still used internally by RFC_METADATA_GET but might not evolve with future releases).

Source in external link: https://answers.sap.com/answers/13891692/view.html (useful information about the internal logic of RFC_METADATA_GET and RFC_GET_FUNCTION_INTERFACE, by an SAP employee)

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48