class SAPNW::RFC::Connection

Attributes

connection_parameters[R]
functions[R]
handle[RW]

Public Instance Methods

close() click to toggle source

terminate an established RFC connection. This will invalidate any currently in-scope FunctionDescriptors associated with this Connection.

# File lib/sapnwrfc/connection.rb, line 135
        def close
SAP_LOGGER.debug("In #{self.class} close ...")
         return nil unless self.handle
SAP_LOGGER.debug("In #{self.class} handle: #{self.handle} ...")
res = self.handle.close()
              self.handle = nil
                        # XXX Should destroy all cached functions and structures and types tied to handle ?
              return true
          end
connection_attributes() click to toggle source
# File lib/sapnwrfc/connection.rb, line 112
       def connection_attributes
SAP_LOGGER.debug("In #{self.class} connection_attributes ...")
return self.handle.connection_attributes()
        end
discover(func = nil) click to toggle source

discover() looks up the dictionary definition of an RFC interface storing away the meta data of the associated Parameters/Tables and returns this as an instance of SAPNW::RFC::FunctionDescriptor. This is the MANDATORY starting point of all client side RFC.

# File lib/sapnwrfc/connection.rb, line 121
       def discover(func = nil)
SAP_LOGGER.debug("In #{self.class} discover (#{func}) ...")
                        case func
                          when nil
                                  return nil
                                else
    func_def = self.handle.function_lookup(SAPNW::RFC::FunctionDescriptor, SAPNW::RFC::Parameter, func.to_s)
    @functions[func_def.name] = func_def
                                        return func_def
                        end
        end
ping() click to toggle source

ping test a connection to see if it is still alive

# File lib/sapnwrfc/connection.rb, line 146
      def ping
SAP_LOGGER.debug("In #{self.class} ping ...")
       return nil unless self.handle
SAP_LOGGER.debug("In #{self.class} handle: #{self.handle} ...")
return self.handle.ping()
      end

Public Class Methods

new(args = nil) click to toggle source
# File lib/sapnwrfc/connection.rb, line 96
  def initialize(args = nil)
                @connection_parameters = []
case args
                 when nil
                 when Hash
                   args.each_pair { |key, val|
                     @connection_parameters << { 'name' => key.to_s, 'value' => val.to_s }
                   }
                 else
                         raise "Wrong parameters for Connection - must pass a Hash\n"
               end
SAP_LOGGER.debug("In #{self.class} initialize: #{@connection_parameters.inspect} ...")
                        @functions = {}
            @handle = SAPNW::RFC::Handle.new(self)
       end