cancel
Showing results for 
Search instead for 
Did you mean: 

Exporting parameter in RFC Server does not get reflected from Ruby

Former Member
0 Kudos

I am trying to create a server implementation of a function that takes as input 2 strings & outputs 1 string variable. I understand that I have to create my own function descriptor

ABAP Code:


FUNCTION ZTEST_RUBY_FM.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(STRING1) TYPE  STRING
*"     VALUE(STRING2) TYPE  STRING
*"  EXPORTING
*"     VALUE(STRING3) TYPE  STRING
*"----------------------------------------------------------------------


ENDFUNCTION.

RUBY Code:


assert(conn = SAPNW::Base.rfc_connect)
func = SAPNW::RFC::FunctionDescriptor.new("ZTEST_RUBY_FM")
func.addParameter(SAPNW::RFC::Export.new(:name => "STRING1", :len => 1024, :type => SAPNW::RFC::STRING))
func.addParameter(SAPNW::RFC::Export.new(:name => "STRING2", :len => 128, :type => SAPNW::RFC::STRING))
func.addParameter(SAPNW::RFC::Import.new(:name => "STRING3", :len => 32, :type => SAPNW::RFC::STRING))

The last ruby line where I declare the Exporting parameter as RFC::Import does not work as expected. When I set the value of the STRING3 variable, it does not get reflected in SAP nor in trace file. I have tried changing that to RFC::Export, in that case I see the value in trace file but not in SAP. Finally, when I change the ruby parameter to RFC::Changing, do I see in both places, SAP & trace file.

Can someone please explain why it works the way it does?

thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Got the problem. Its in ext/nwsaprfc/nwsaprfc.c

need to switch the RFC_IMPORT & RFC_EXPORT parameter switch when invoking the function callback in ruby. This way I can keep the semantics of the original RFC Function too.

Got lots of help from Piers himself.

Former Member
0 Kudos

Got the problem. Its in ext/nwsaprfc/nwsaprfc.c

need to switch the RFC_IMPORT & RFC_EXPORT parameter switch when invoking the function callback in ruby. This way I can keep the semantics of the original RFC Function too.

Got lots of help from Piers himself.

Edited by: Sharad Gupta on Jan 4, 2010 8:25 PM