nwrfc 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +5 -0
- data/Rakefile +1 -1
- data/lib/nwrfc.rb +26 -18
- data/lib/nwrfc/datacontainer.rb +21 -0
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -84,6 +84,11 @@ so that ["system2"] at the end points to whatever label you gave it in the YAML
|
|
84
84
|
|
85
85
|
== Release Notes
|
86
86
|
|
87
|
+
=== What's new in 0.0.4
|
88
|
+
|
89
|
+
* Add parameter activation/deactivation functionality
|
90
|
+
* Fix/add metadata retrieval for DataContainer
|
91
|
+
|
87
92
|
=== What's new in 0.0.3
|
88
93
|
|
89
94
|
* Basic RFC server functionality
|
data/Rakefile
CHANGED
data/lib/nwrfc.rb
CHANGED
@@ -286,6 +286,31 @@ module NWRFC
|
|
286
286
|
#@todo Handle function exceptions by checking for :RFC_ABAP_EXCEPTION (5)
|
287
287
|
NWRFC.check_error(@error) if rc > 0
|
288
288
|
end
|
289
|
+
|
290
|
+
# Returns whether or not a given parameter is active, i.e. whether it will be sent to the server during the RFC
|
291
|
+
# call with FunctionCall#invoke. This is helpful for functions that set default values on parameters or otherwise
|
292
|
+
# check whether parameters are passed in cases where this may have an impact on performance or otherwise
|
293
|
+
# @param[String, Symbol] parameter Name of the parameter
|
294
|
+
def active?(parameter)
|
295
|
+
is_active = FFI::MemoryPointer.new :int
|
296
|
+
rc = NWRFCLib.is_parameter_active(@handle, parameter.to_s.cU, is_active, @error)
|
297
|
+
NWRFC.check_error(@error) if rc > 0
|
298
|
+
is_active.read_int == 1
|
299
|
+
end
|
300
|
+
|
301
|
+
# Set a named parameter to active or inactive
|
302
|
+
def set_active(parameter, active=true)
|
303
|
+
(active ? active_flag = 1 : active_flag = 0)
|
304
|
+
rc = NWRFCLib.set_parameter_active(@handle, parameter.to_s.cU, active_flag, @error)
|
305
|
+
NWRFC.check_error(@error) if rc > 0
|
306
|
+
active
|
307
|
+
end
|
308
|
+
|
309
|
+
# Set a named parameter to inactive
|
310
|
+
def deactivate(parameter)
|
311
|
+
set_active(parameter, false)
|
312
|
+
end
|
313
|
+
|
289
314
|
end
|
290
315
|
|
291
316
|
|
@@ -356,24 +381,7 @@ module NWRFC
|
|
356
381
|
# access of a structure or a function
|
357
382
|
class Structure < DataContainer
|
358
383
|
|
359
|
-
|
360
|
-
# of this structure
|
361
|
-
#---
|
362
|
-
# FIXME: This is not working!
|
363
|
-
def fields
|
364
|
-
fc = FFI::MemoryPointer.new(:uint)
|
365
|
-
rc = NWRFCLib.get_field_count(@handle, fc, @error)
|
366
|
-
NWRFC.check_error(@error) if rc > 0
|
367
|
-
fc = fc.read_uint
|
368
|
-
fd = NWRFCLib::RFCFieldDesc.new
|
369
|
-
fields = []
|
370
|
-
debugger
|
371
|
-
fc.times do |index|
|
372
|
-
rc = NWRFCLib.get_field_desc_by_index(@handle, index, fd.to_ptr, @error.to_ptr)
|
373
|
-
NWRFC.check_error(@error) if rc > 0
|
374
|
-
fields << fd[:name].get_str.to_sym
|
375
|
-
end
|
376
|
-
end
|
384
|
+
|
377
385
|
|
378
386
|
end # class Structure
|
379
387
|
|
data/lib/nwrfc/datacontainer.rb
CHANGED
@@ -253,6 +253,25 @@ module NWRFC
|
|
253
253
|
value
|
254
254
|
end
|
255
255
|
|
256
|
+
# Return a list (array) of symbols representing the names of the fields (or parameters, in the case of a function)
|
257
|
+
# of this data container
|
258
|
+
def fields
|
259
|
+
fc = FFI::MemoryPointer.new(:uint)
|
260
|
+
rc = NWRFCLib.get_field_count(@desc, fc, @error)
|
261
|
+
NWRFC.check_error(@error) if rc > 0
|
262
|
+
fc = fc.read_uint
|
263
|
+
fd = NWRFCLib::RFCFieldDesc.new
|
264
|
+
# Make a list of field names
|
265
|
+
fc.times.inject([]) {|array, index|
|
266
|
+
rc = NWRFCLib.get_field_desc_by_index(@desc, index, fd.to_ptr, @error.to_ptr)
|
267
|
+
NWRFC.check_error(@error) if rc > 0
|
268
|
+
#@todo WARNING! our get_str method did not handle getting the name of the RESPTEXT parameter in STFC_DEEP_TABLE correctly
|
269
|
+
# As a workaround, we use our read_string_dn method; do we need to use this elsewhere?
|
270
|
+
#array << fd[:name].get_str.to_sym #<-The code with good intentions
|
271
|
+
array << fd[:name].to_ptr.read_string_dn.uC.to_sym #<- Workaround; the way of the future?
|
272
|
+
}
|
273
|
+
end
|
274
|
+
|
256
275
|
# Get the metadata of a member (function, structure or table)
|
257
276
|
def member_metadata(member_name)
|
258
277
|
# TODO: Cache metadata definitions; will it be quicker than making a hash of metadata for a given member each time?
|
@@ -270,6 +289,8 @@ module NWRFC
|
|
270
289
|
end
|
271
290
|
end
|
272
291
|
|
292
|
+
|
293
|
+
|
273
294
|
private
|
274
295
|
# Returns the subset of metadata values common to both a function parameter
|
275
296
|
# and a type field
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nwrfc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Martin Ceronio
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-02-
|
18
|
+
date: 2012-02-28 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: SAP Netweaver RFC Library Wrapper using Ruby-FFI
|