module SAPNW::Connections::SAPNW::Base

Public Class Methods

rfc_connect(args = nil) click to toggle source

Build a connection to an R/3 system (ABAP AS)

Connection parameters can be passed in a variety of ways (a) via a YAML based configuration file (b) a Hash of parameter arguments © a combination of both

# File lib/sapnwrfc/connection.rb, line 21
  def rfc_connect(args = nil)
parms = {}
                        self.config = {} unless self.config
               parms[:ashost] = self.config['ashost']           if self.config.key? 'ashost'
               parms[:dest] = self.config['dest']               if self.config.key? 'dest'
               parms[:mshost] = self.config['mshost']           if self.config.key? 'mshost'
               parms[:group] = self.config['group']             if self.config.key? 'group'
               parms[:sysid] = self.config['sysid']             if self.config.key? 'sysid'
               parms[:msserv] = self.config['msserv']           if self.config.key? 'msserv'
               parms[:sysnr] = self.config['sysnr']             if self.config.key? 'sysnr'
               parms[:lang] = self.config['lang']               if self.config.key? 'lang'
                parms[:client] = self.config['client']           if self.config.key? 'client'
                parms[:user] = self.config['user']               if self.config.key? 'user'
                parms[:passwd] = self.config['passwd']           if self.config.key? 'passwd'
                parms[:trace] = self.config['trace'].to_i        if self.config.key? 'trace'
parms[:codepage] = self.config['codepage'].to_i  if self.config.key? 'codepage'
               parms[:x509cert] = self.config['x509cert']       if self.config.key? 'x509cert'
               parms[:extiddata] = self.config['extiddata']     if self.config.key? 'extiddata'
               parms[:extidtype] = self.config['extidtype']     if self.config.key? 'extidtype'
                parms[:mysapsso2] = self.config['mysapsso2']     if self.config.key? 'mysapsso2'
                parms[:mysapsso] = self.config['mysapsso']       if self.config.key? 'mysapsso'
                parms[:getsso2] = self.config['getsso2'].to_i    if self.config.key? 'getsso2'
                parms[:snc_mode] = self.config['snc_mode']       if self.config.key? 'snc_mode'
                parms[:snc_qop] = self.config['snc_qop']         if self.config.key? 'snc_qop'
                parms[:snc_myname] = self.config['snc_myname']   if self.config.key? 'snc_myname'
                parms[:snc_partnername] = self.config['snc_partnername'] if self.config.key? 'snc_partnername'
                parms[:snc_lib] = self.config['snc_lib']         if self.config.key? 'snc_lib'
SAP_LOGGER.debug("[" + + "] base parameters to be passed are: " + parms.inspect)

case args
                          when nil
                          when Hash
                   parms[:ashost] = args[:ashost]           if args.key? :ashost
                   parms[:dest] = args[:dest]               if args.key? :dest
                   parms[:mshost] = args[:mshost]           if args.key? :mshost
                   parms[:sysid] = args[:sysid]             if args.key? :sysid
                   parms[:group] = args[:group]             if args.key? :group
                   parms[:msserv] = args[:msserv]           if args.key? :msserv
           parms[:sysnr] = args[:sysnr]             if args.key? :sysnr
           parms[:lang] = args[:lang]               if args.key? :lang
                parms[:client] = args[:client]           if args.key? :client
                parms[:user] = args[:user]               if args.key? :user
                parms[:passwd] = args[:passwd]           if args.key? :passwd
                parms[:trace] = args[:trace].to_i        if args.key? :trace
    parms[:codepage] = args[:codepage].to_i  if args.key? :codepage
           parms[:x509cert] = args[:x509cert]       if args.key? :x509cert
           parms[:extiddata] = args[:extiddata]     if args.key? :extiddata
           parms[:extidtype] = args[:extidtype]     if args.key? :extidtype
                parms[:mysapsso2] = args[:mysapsso2]     if args.key? :mysapsso2
                parms[:mysapsso] = args[:mysapsso]       if args.key? :mysapsso
                parms[:getsso2] = args[:getsso2].to_i    if args.key? :getsso2
                parms[:snc_mode] = args[:snc_mode]       if args.key? :snc_mode
                parms[:snc_qop] = args[:snc_qop]         if args.key? :snc_qop
                parms[:snc_myname] = args[:snc_myname]   if args.key? :snc_myname
                parms[:snc_partnername] = args[:snc_partnername] if args.key? :snc_partnername
                parms[:snc_lib] = args[:snc_lib]         if args.key? :snc_lib
    SAP_LOGGER.debug("[" + + "] with EXTRA parameters to be passed are: " + parms.inspect)
                                  raise "Wrong parameters for Connection - must pass a Hash\n"

connection =
SAP_LOGGER.debug("completed the connection (#{connection.handle.class}/#{connection.handle.object_id}) ...")
               return connection