Class: Sap4ruby::FunctionModule
- Inherits:
-
Object
- Object
- Sap4ruby::FunctionModule
- Defined in:
- lib/sap4ruby/function_module.rb
Instance Attribute Summary collapse
-
#exporting ⇒ Object
Returns the value of attribute exporting.
-
#importing ⇒ Object
Returns the value of attribute importing.
-
#tables ⇒ Object
Returns the value of attribute tables.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(function_module_name) ⇒ FunctionModule
constructor
Param on constructor.
Constructor Details
#initialize(function_module_name) ⇒ FunctionModule
Param on constructor
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/sap4ruby/function_module.rb', line 6 def initialize(function_module_name) @destination = Sap4ruby::Client.destination @function = @destination.get_repository.get_function(function_module_name) importing_accessors,table_accessors = {}, {} @function.get_import_parameter_list.each do |importing_parameter| importing_sym = importing_parameter.get_name.downcase.to_sym structure_fields = {} if importing_parameter.is_structure? importing_parameter.get_structure.each do |str| structure_fields[str.get_name.downcase.to_sym] = str.get_value.to_s end end param_default_value = (structure_fields.empty?) ? importing_parameter.get_value.to_s : structure_fields importing_accessors[importing_sym] = param_default_value end @importing = OpenStruct.new(importing_accessors) @function.get_table_parameter_list.each do |table_parameter| table_sym = table_parameter.get_name.downcase.to_sym table_accessors[table_sym] = [] end @tables = OpenStruct.new(table_accessors) end |
Instance Attribute Details
#exporting ⇒ Object
Returns the value of attribute exporting.
3 4 5 |
# File 'lib/sap4ruby/function_module.rb', line 3 def exporting @exporting end |
#importing ⇒ Object
Returns the value of attribute importing.
3 4 5 |
# File 'lib/sap4ruby/function_module.rb', line 3 def importing @importing end |
#tables ⇒ Object
Returns the value of attribute tables.
3 4 5 |
# File 'lib/sap4ruby/function_module.rb', line 3 def tables @tables end |
Instance Method Details
#execute ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/sap4ruby/function_module.rb', line 34 def execute @importing.each do |param, value| if value.is_hash? else @function.get_import_parameter_list.set_value(param.to_s.upcase, value) end end @function.execute(destination) @function.get_export_parameter_list.each do |exporting_parameter| if exporting_parameter.is_structure? else @exporting[params.get_name.to_sym] = params.get_string end end @function.get_table_parameter_list.each do |table| end end |