Module: NWRFC
- Defined in:
- lib/nwrfc.rb,
lib/nwrfc/server.rb,
lib/nwrfc/nwerror.rb,
lib/nwrfc/datacontainer.rb
Overview
This library provides a way to call the functions of the SAP Netweaver RFC SDK, i.e. opening a connection to an ABAP system, calling functions etc., as well as running an RFC service
Defined Under Namespace
Classes: Connection, DataContainer, Function, FunctionCall, NWABAPException, NWError, Parameter, Server, Structure, Table, Transaction, Type
Constant Summary collapse
- NW_TIME_FORMAT =
ABAP Time Format (“HHMMSS”)
"%H%M%S"
- NW_DATE_FORMAT =
ABAP Date Format (“YYYYMMDD”)
"%Y%m%d"
Class Method Summary collapse
-
.abap_bool(value) ⇒ Object
Converts ABAP true/false into Ruby true/false.
-
.bool_abap(value) ⇒ Object
Converts Ruby true/false into ABAP true/false.
-
.check_error(error_handle) ⇒ Object
Check for an error using error handle (used internally).
-
.get_version ⇒ Object
Return the version of the NW RFC SDK library.
-
.make_conn_params(params) ⇒ Object
Take Hash of connection parameters and returns FFI pointer to an array for setting up a connection.
Instance Method Summary collapse
Class Method Details
.abap_bool(value) ⇒ Object
Converts ABAP true/false into Ruby true/false
149 150 151 152 153 |
# File 'lib/nwrfc.rb', line 149 def NWRFC.abap_bool(value) return true if value == 'X' return false if value == ' ' nil end |
.bool_abap(value) ⇒ Object
Converts Ruby true/false into ABAP true/false
157 158 159 160 161 |
# File 'lib/nwrfc.rb', line 157 def NWRFC.bool_abap(value) return 'X' if value == true return ' ' if value == false nil end |
.check_error(error_handle) ⇒ Object
Check for an error using error handle (used internally)
58 59 60 61 62 63 |
# File 'lib/nwrfc.rb', line 58 def NWRFC.check_error(error_handle) raise NWError, error_handle \ if error_handle[:code] > 0 #raise "Error code #{error_handle[:code]} group #{error_handle[:group]} message #{error_handle[:message].get_str}" \ end |
.get_version ⇒ Object
Return the version of the NW RFC SDK library
32 33 34 35 36 37 38 39 40 |
# File 'lib/nwrfc.rb', line 32 def NWRFC.get_version # See custom method FFI::Pointer#read_string_dn in nwrfclib.rb # http://stackoverflow.com/questions/9293307/ruby-ffi-ruby-1-8-reading-utf-16le-encoded-strings major = FFI::MemoryPointer.new(:uint) minor = FFI::MemoryPointer.new(:uint) patch = FFI::MemoryPointer.new(:uint) version = NWRFCLib.get_version(major, minor, patch) [version.read_string_dn.uC, major.read_uint, minor.read_uint, patch.read_uint] end |
.make_conn_params(params) ⇒ Object
Take Hash of connection parameters and returns FFI pointer to an array for setting up a connection
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/nwrfc.rb', line 44 def NWRFC.make_conn_params(params) #https://github.com/ffi/ffi/wiki/Structs par = FFI::MemoryPointer.new(NWRFCLib::RFCConnParam, params.length) pars = params.length.times.collect do |i| NWRFCLib::RFCConnParam.new(par + i * NWRFCLib::RFCConnParam.size) end tpar = params.to_a params.length.times do |n| pars[n][:name] = FFI::MemoryPointer.from_string(tpar[n][0].to_s.cU) pars[n][:value] = FFI::MemoryPointer.from_string(tpar[n][1].to_s.cU) end par end |
Instance Method Details
#inspect ⇒ Object
27 28 29 |
# File 'lib/nwrfc.rb', line 27 def inspect self.to_s end |