Class: NWRFC::Parameter

Inherits:
Object
  • Object
show all
Defined in:
lib/nwrfc.rb

Overview

Represents the metadata of a function parameter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Parameter

TODO:

For certain types, e.g. :RFCTYPE_BCD, a length specification is required, otherwise a segfault is the result later down the line. Find and implement all the types where this is required

Create a parameter by setting parameter attributes



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/nwrfc.rb', line 172

def initialize(*args)  

  attr = args[0]
  


  raise "RFCTYPE_BCD requires a length" if attr[:type] == :RFCTYPE_BCD && !(attr[:length])

  @handle                 = NWRFCLib::RFCFuncParam.new
  @handle[:name]          = attr[:name].cU if attr[:name]
  @handle[:direction]     = NWRFCLib::RFC_DIRECTION[attr[:direction]] if attr[:direction]
  @handle[:type]          = NWRFCLib::RFC_TYPE[attr[:type]] if attr[:type]
  @handle[:ucLength]      = attr[:length] * 2 if attr[:length]
  @handle[:nucLength]     = attr[:length] if attr[:length]
  @handle[:decimals]      = attr[:decimals] if attr[:decimals]
  # TODO: Add support for type description
  #@handle[:typeDescHandle]
  @handle[:defaultValue]  = attr[:defaultValue].cU if attr[:defaultValue]
  @handle[:parameterText] = attr[:parameterText].cU if attr[:parameterText]
  @handle[:optional]      = abap_bool(attr[:optional]) if attr[:optional]
end

Instance Attribute Details

#handleObject

Returns the value of attribute handle.



166
167
168
# File 'lib/nwrfc.rb', line 166

def handle
  @handle
end