Class: NWRFC::FunctionCall

Inherits:
DataContainer show all
Includes:
DataContainer
Defined in:
lib/nwrfc.old.rb,
lib/nwrfc.rb

Overview

Represents a callable instance of a function module, using a function module description obtained previously. Can be obtained by passing either a function description or calling Function#get_function_call

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(function_description) ⇒ FunctionCall

Returns a new instance of FunctionCall.



328
329
330
331
332
333
334
335
# File 'lib/nwrfc.rb', line 328

def initialize(function)
  @error = NWRFCLib::RFCError.new
  @function = function
  @connection = function.connection
  @handle = NWRFCLib.create_function(@function.desc, @error.to_ptr)
  @desc = function.desc
  NWRFC.check_error(@error)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_sym, *args, &block) ⇒ Object



309
310
311
312
313
314
315
316
317
318
319
# File 'lib/nwrfc.old.rb', line 309

def method_missing(method_sym, *args, &block)
  param_name = method_sym.to_s.upcase
#      fpar = NWRFCLib::RFCFuncParam.new
#      rc = NWRFCLib.get_parameter_desc_by_name(@function_description, param_name.cU, fpar.to_ptr, @error.to_ptr)
#      NWRFC.check_error(@error) if rc > 0
  if param_name[-1..-1] == "="
    self[:param_name] = *args[0]
  else
    self[:param_name]
  end
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



326
327
328
# File 'lib/nwrfc.rb', line 326

def connection
  @connection
end

#descObject (readonly)

Returns the value of attribute desc.



326
327
328
# File 'lib/nwrfc.rb', line 326

def desc
  @desc
end

#functionObject (readonly)

Returns the value of attribute function.



326
327
328
# File 'lib/nwrfc.rb', line 326

def function
  @function
end

#function_descriptionObject (readonly)

Returns the value of attribute function_description.



292
293
294
# File 'lib/nwrfc.old.rb', line 292

def function_description
  @function_description
end

#handleObject (readonly)

Returns the value of attribute handle.



326
327
328
# File 'lib/nwrfc.rb', line 326

def handle
  @handle
end

Instance Method Details

#invokeObject

Execute the function call on the SAP server



304
305
306
307
# File 'lib/nwrfc.old.rb', line 304

def invoke
  rc = NWRFCLib.invoke(@connection.handle, @handle, @error.to_ptr)
  NWRFC.check_error(@error) if rc > 0
end