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



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/nwrfc.rb', line 141

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.



135
136
137
# File 'lib/nwrfc.rb', line 135

def handle
  @handle
end