class SAPNW::RFC::FunctionCall

Attributes

function_descriptor[R]
name[R]
parameters[R]

Public Instance Methods

activate(parm=nil) click to toggle source

activate a parameter - parameters are active by default so it is unlikely that this would ever need to be called.

# File lib/sapnwrfc/functions.rb, line 146
def activate(parm=nil)
  raise "Parameter not found: #{parm}\n" unless @parameters.has_key?(parm)
        return set_active(parm, 1)
end
deactivate(parm=nil) click to toggle source

deactivate a parameter - parameters can be deactivated for a function call, to reduce the amount of RFC traffic on the wire. This is especially important for unrequired tables, or parameters that are similar sources of large data transfer.

# File lib/sapnwrfc/functions.rb, line 154
def deactivate(parm=nil)
  raise "Parameter not found: #{parm}\n" unless @parameters.has_key?(parm)
        return set_active(parm, 0)
end
method_missing(methid, *rest) click to toggle source

dynamic method calls for parameters and tables

# File lib/sapnwrfc/functions.rb, line 160
def method_missing(methid, *rest)
  meth = methid.id2name
                    #$stderr.print "method_missing: #{meth}\n"
                          #$stderr.print "parameters: #{@parameters.keys.inspect}\n"
  if @parameters.has_key?(meth)
                            #$stderr.print "return parm obj\n"
                      return @parameters[meth].value
                    elsif mat = %r^(.*?)\=$/.match(meth)
                            #$stderr.print "return parm val\n"
    if  @parameters.has_key?(mat[1])
                                    return @parameters[mat[1]].value = rest[0]
                            else
                                    raise NoMethError
    end
                    else
                      raise NoMethodError
                    end
end

Public Class Methods

new(fd=nil) click to toggle source
These are automatically created as a result of SAPNW::RFC::FunctionDescriptor#new_function_call() -
do not instantiate these yourself!

SAPNW::RFC::FunctionCall objects allow dynamic method calls of parameter, and table names 
for the setting and getting of interface values eg:
  fd = conn.discover("RFC_READ_TABLE")
  f = fd.new_function_call
  f.QUERY_TABLE = "T000" # <- QUERY_TABLE is a dynamic method serviced by method_missing

def initialize(fd=nil)

# File lib/sapnwrfc/functions.rb, line 130
def initialize(fd=nil)
  @parameters = {}
  if fd == nil
          @function_descriptor.parameters.each_pair do |k,v|
            @parameters[k] = v.clone
          end
        else 
          fd.parameters.each_pair do |k,v|
            @parameters[k] = v.clone
          end
        end
        @parameters_list = @parameters.values || []
end