sapnwrfc 0.23-i686-linux → 0.24-i686-linux

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog ADDED
@@ -0,0 +1,28 @@
1
+ 2012-04-10 Michele Franzin <michele.franzin@gmail.com>
2
+ * bump to version 0.24
3
+ * rdocs & build toolchain updates
4
+
5
+ 2011-05-27 Michele Franzin <michele.franzin@gmail.com>
6
+ * create github project
7
+ * upgrade to ruby 1.9.x
8
+
9
+ 2007-01-24 Piers Harding <piers@ompka.net>
10
+ * Initial Release
11
+ This is the first release of sapnw for Ruby
12
+ it contains support for full interface discovery, and all SAP ABAP datatypes
13
+ in structures or parameters, and some support for deep structures
14
+
15
+ Fri May 18 10:07:59 BST 2007
16
+ * fix up ambiguities in the build process
17
+
18
+ Wed May 30 17:54:09 BST 2007
19
+ * add in support for nested tables in parameters
20
+
21
+ Fri Jun 1 16:42:30 BST 2007
22
+ * add in nested table support: parameter -> field -> table ...
23
+
24
+ Thu Jun 26 18:51:20 NZST 2008
25
+ * removed connection attributes that are no longer supported
26
+
27
+ Thu Dec 11 09:51:47 NZDT 2008
28
+ * make sure that close cannot be called twice
data/README.rdoc ADDED
@@ -0,0 +1,72 @@
1
+ = sapnwrfc - SAP Netweaver RFC support for Ruby 1.9.x
2
+
3
+ == Summary
4
+
5
+ Welcome to the sapnwrfc Ruby package. This package is intended to facilitate RFC calls to an SAP R/3 system of release NW2004x and above. It may work for earlier versions but it hasn't been tested.
6
+ The fundamental purpose of the production of this package, is to provide a clean object oriented interface to RFC calls from within Ruby. This will hopefully have a number of effects:
7
+
8
+ (1) make it really easy to do RFC calls to SAP from Ruby in an object oriented fashion (Doh!)
9
+
10
+ (2) promote Ruby as the interface/scripting/glue language of choice for interaction with SAP R/3.
11
+
12
+ (3) make the combination of Linux, Apache, and Ruby the killer app for internet connectivity with SAP.
13
+
14
+ (4) Establish a small fun open source project that people are more than welcome to contribute to, if they so wish.
15
+
16
+ == Installation
17
+
18
+ After you have unpacked your kit, you should have all the files listed
19
+ in the MANIFEST.
20
+
21
+ In brief, the following should work on most systems:
22
+ ruby setup.rb
23
+
24
+ if your rfcsdk is not findable in the system search path, then use the command line switches
25
+ for mkmf/setup.rb like so:
26
+ ruby setup.rb config --with-nwrfcsdk-dir=/path/to/rfcsdk
27
+ ruby setup.rb setup
28
+
29
+ Now you can either install like so:
30
+ ruby setup.rb install
31
+
32
+ or build the gem and install that like so:
33
+ gem build sapnwrfc.linux.gemspec
34
+ gem uninstall sapnwrfc
35
+ gem install sapnwrfc-<version>-<architecture>.gem
36
+
37
+
38
+ VERY IMPORTANT - make sure that you add the library path to LD_LIBRARY_PATH
39
+ eg - mine is:
40
+ export LD_LIBRARY_PATH=/home/piers/code/sap/nwrfcsdk/lib
41
+
42
+
43
+ == Documents and Tests
44
+
45
+ [doc/*]
46
+ Module Documentation
47
+
48
+ [tests/*.rb]
49
+ Test basic connection, and some rfc call examples
50
+
51
+ == Credits
52
+
53
+ GitHub repo:: Michele Franzin <michele@franzin.net>
54
+ Ruby 1.9.x porting:: Michele Franzin <michele@franzin.net>
55
+
56
+ == License
57
+
58
+ saprfc is Copyright (c) 2006-2008 Piers Harding. It is free software, and
59
+ may be redistributed under the terms specified in the README file of
60
+ the Ruby distribution.
61
+
62
+ One last thing - The SAP RFCSDK is a prerequisite for this perl package to work.
63
+ The RFCSDK is proprietrary software owned by SAP AG.
64
+ For this reason I will not supply ANY component part of the RFCSDK with this perl package, and further more you must obtain it through the normal channels with SAP AG - ie. you must have a licensed SAP R/3 installation at your disposal.
65
+
66
+
67
+ = Other stuff
68
+
69
+ Author:: Piers Harding <piers@ompka.net>
70
+ Requires:: Ruby 1.9.x or later
71
+ License:: Copyright (c) 2006-2008 Piers Harding
72
+ Released under Ruby's License
Binary file
data/lib/sapnwrfc.rb CHANGED
@@ -9,9 +9,9 @@
9
9
  #
10
10
  # = Download and Documentation
11
11
  #
12
- # Documentation at: http://www.piersharding.com/download/ruby/sapnwrfc/doc/
12
+ # Documentation at: http://rubydoc.info/github/fuzziness/sapnwrfc/frames
13
13
  #
14
- # Project and Download at: http://raa.ruby-lang.org/project/sapnwrfc
14
+ # Project and Download at: https://github.com/fuzziness/sapnwrfc
15
15
  #
16
16
  # = Functionality
17
17
  #
@@ -166,9 +166,10 @@
166
166
  #
167
167
  # = Thanks to:
168
168
  #
169
- # * Olivier Boudry - an Open Source guy
170
- # * Craig Cmehil - SAP, and SDN
171
- # * Ulrich Schmidt - SAP
169
+ # * Olivier Boudry - an Open Source guy
170
+ # * Craig Cmehil - SAP, and SDN
171
+ # * Ulrich Schmidt - SAP
172
+ # * Michele Franzin - ruby 1.9.x porting
172
173
  # For their help in making this possible.
173
174
  #
174
175
  #
@@ -176,7 +177,7 @@
176
177
  #
177
178
  # Author:: Piers Harding <piers@ompka.net>
178
179
  # License:: Copyright (c) 2006-2008 Piers Harding. sapnwrfc is free software, and may be redistributed under the terms specified in the README file of the Ruby distribution.
179
- # Requires:: Ruby 1.9.0 or later
180
+ # Requires:: Ruby 1.9.x or later
180
181
  #
181
182
 
182
183
 
@@ -191,6 +192,7 @@ SAP_LOGGER = Logger.new(STDERR)
191
192
  SAP_LOGGER.datetime_format = "%Y-%m-%d %H:%M:%S"
192
193
  SAP_LOGGER.level = Logger::WARN
193
194
 
195
+ require 'sapnwrfc/version'
194
196
  require 'sapnwrfc/base'
195
197
 
196
198
  # C extension
data/lib/sapnwrfc/base.rb CHANGED
@@ -7,8 +7,10 @@
7
7
  # sapnwrfc is a RFC based connector to SAP specifically designed for use with the
8
8
  # next generation RFC SDK supplied by SAP for NW2004+ .
9
9
  #
10
+ # Author:: Piers Harding <piers@ompka.net>
11
+ # Author:: Michele Franzin <michele@franzin.net>
12
+ # Requires:: Ruby 1.9 or later
10
13
  #
11
- #
12
14
 
13
15
  module SAPNW
14
16
 
@@ -55,6 +55,7 @@
55
55
  #
56
56
  #
57
57
  # Author:: Piers Harding <piers@ompka.net>
58
+ # Author:: Michele Franzin <michele@franzin.net>
58
59
  # Requires:: Ruby 1.9 or later
59
60
  #
60
61
 
@@ -3,6 +3,7 @@
3
3
  # the Ruby distribution.
4
4
  #
5
5
  # Author:: Piers Harding <piers@ompka.net>
6
+ # Author:: Michele Franzin <michele@franzin.net>
6
7
  # Requires:: Ruby 1.9 or later
7
8
  #
8
9
 
@@ -3,6 +3,7 @@
3
3
  # the Ruby distribution.
4
4
  #
5
5
  # Author:: Piers Harding <piers@ompka.net>
6
+ # Author:: Michele Franzin <michele@franzin.net>
6
7
  # Requires:: Ruby 1.9 or later
7
8
  #
8
9
 
@@ -3,6 +3,7 @@
3
3
  # the Ruby distribution.
4
4
  #
5
5
  # Author:: Piers Harding <piers@ompka.net>
6
+ # Author:: Michele Franzin <michele@franzin.net>
6
7
  # Requires:: Ruby 1.9 or later
7
8
  #
8
9
 
@@ -3,6 +3,7 @@
3
3
  # the Ruby distribution.
4
4
  #
5
5
  # Author:: Piers Harding <piers@ompka.net>
6
+ # Author:: Michele Franzin <michele@franzin.net>
6
7
  # Requires:: Ruby 1.9 or later
7
8
  #
8
9
 
@@ -0,0 +1,3 @@
1
+ module SAPNW
2
+ VERSION = "0.24"
3
+ end
data/test/sap.yml ADDED
@@ -0,0 +1,11 @@
1
+ ashost: gecko.local.net
2
+ sysnr: "01"
3
+ client: "001"
4
+ user: developer
5
+ passwd: developer
6
+ lang: EN
7
+ trace: 1
8
+ loglevel: warn
9
+ tpname: wibble.rfcexec
10
+ gwhost: gecko.local.net
11
+ gwserv: "3301"
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/ruby
2
+ $:.unshift(File.dirname(__FILE__) + '/lib')
3
+ $:.unshift(File.dirname(__FILE__) + '/ext/nwsaprfc')
4
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
5
+ $:.unshift(File.dirname(__FILE__) + '/../ext/nwsaprfc')
6
+
7
+ require 'sapnwrfc'
8
+
9
+ $TEST_FILE = ENV.has_key?('SAP_YML') ? ENV['SAP_YML'] : 'sap.yml'
10
+
11
+ require 'test/unit'
12
+ require 'test/unit/assertions'
13
+
14
+ class SAPConnectionAttributeTest < Test::Unit::TestCase
15
+ def setup
16
+ #SAP_LOGGER.warn "Current DIR: #{Dir.pwd}\n"
17
+ if FileTest.exists?($TEST_FILE)
18
+ SAPNW::Base.config_location = $TEST_FILE
19
+ else
20
+ SAPNW::Base.config_location = 'test/' + $TEST_FILE
21
+ end
22
+ SAPNW::Base.load_config
23
+ #SAP_LOGGER.warn "program: #{$0}\n"
24
+ end
25
+
26
+ def test_BASIC_00010_Connection_Attributes
27
+ assert(conn = SAPNW::Base.rfc_connect)
28
+ attrib = conn.connection_attributes
29
+ SAP_LOGGER.debug "Connection Attributes: #{attrib.inspect}\n"
30
+ assert(attrib.length > 10)
31
+ assert(attrib['sysId'].rstrip.length == 3)
32
+ assert(attrib['progName'].strip == "SAPLSYST")
33
+ assert(attrib['rfcRole'] == 'C')
34
+ assert(conn.close)
35
+ end
36
+
37
+ def test_BASIC_00010_Connection_Attributes_Volume
38
+ 50.times do
39
+ assert(conn = SAPNW::Base.rfc_connect)
40
+ attrib = conn.connection_attributes
41
+ SAP_LOGGER.debug "Connection Attributes: #{attrib.inspect}\n"
42
+ assert(attrib.length > 10)
43
+ assert(attrib['sysId'].rstrip.length == 3)
44
+ assert(attrib['progName'].strip == "SAPLSYST")
45
+ assert(attrib['rfcRole'] == 'C')
46
+ assert(conn.close)
47
+ end
48
+ end
49
+
50
+ def teardown
51
+ end
52
+ end
data/test/test_call.rb ADDED
@@ -0,0 +1,128 @@
1
+ #!/usr/bin/ruby
2
+ $:.unshift(File.dirname(__FILE__) + '/lib')
3
+ $:.unshift(File.dirname(__FILE__) + '/ext/nwsaprfc')
4
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
5
+ $:.unshift(File.dirname(__FILE__) + '/../ext/nwsaprfc')
6
+
7
+ require 'sapnwrfc'
8
+
9
+ $ITER = 50
10
+ $TEST_FILE = ENV.has_key?('SAP_YML') ? ENV['SAP_YML'] : 'sap.yml'
11
+
12
+ require 'test/unit'
13
+ require 'test/unit/assertions'
14
+
15
+ class SAPCallTest < Test::Unit::TestCase
16
+ def setup
17
+ #SAP_LOGGER.warn "Current DIR: #{Dir.pwd}\n"
18
+ if FileTest.exists?($TEST_FILE)
19
+ SAPNW::Base.config_location = $TEST_FILE
20
+ else
21
+ SAPNW::Base.config_location = 'test/' + $TEST_FILE
22
+ end
23
+ SAPNW::Base.load_config
24
+ #SAP_LOGGER.warn "program: #{$0}\n"
25
+ end
26
+
27
+ def test_BASIC_00010_Program_Read
28
+ $ITER.to_i.times do
29
+ begin
30
+ assert(conn = SAPNW::Base.rfc_connect)
31
+ attrib = conn.connection_attributes
32
+ #SAP_LOGGER.warn "Connection Attributes: #{attrib.inspect}\n"
33
+ fd = conn.discover("RPY_PROGRAM_READ")
34
+ assert(fd.name == "RPY_PROGRAM_READ")
35
+ f = fd.new_function_call
36
+ assert(fd.parameters.has_key?("PROGRAM_NAME"))
37
+ assert(f.parameters.has_key?("PROGRAM_NAME"))
38
+ assert(f.name == "RPY_PROGRAM_READ")
39
+ f.PROGRAM_NAME = 'SAPLGRFC'
40
+ #SAP_LOGGER.warn "FunctionCall: #{f.inspect}\n"
41
+ #SAP_LOGGER.warn "FunctionCall PROGRAM_NAME: #{f.PROGRAM_NAME}/#{f.parameters['PROGRAM_NAME'].type}\n"
42
+ assert(f.PROGRAM_NAME == 'SAPLGRFC')
43
+ begin
44
+ f.invoke
45
+ rescue SAPNW::RFC::FunctionCallException => e
46
+ SAP_LOGGER.warn "FunctionCallException: #{e.error.inspect}\n"
47
+ raise "gone"
48
+ end
49
+ #SAP_LOGGER.warn "#{f.PROG_INF.has_key?('PROG')}\n"
50
+ #SAP_LOGGER.warn "#{f.PROG_INF.inspect}\n"
51
+ #f.PROG_INF.each_pair do |k, v|
52
+ # SAP_LOGGER.warn "#{k} => #{v}\n"
53
+ #end
54
+ #SAP_LOGGER.warn "PROGNAME: #{f.PROG_INF['PROGNAME'].rstrip}#\n"
55
+ assert(f.PROG_INF['PROGNAME'].rstrip == "SAPLGRFC")
56
+ assert(f.SOURCE_EXTENDED.length > 10)
57
+ #f.SOURCE_EXTENDED.each do |row|
58
+ # SAP_LOGGER.warn "Line: #{row['LINE']}\n"
59
+ #end
60
+ assert(conn.close)
61
+ rescue SAPNW::RFC::ConnectionException => e
62
+ SAP_LOGGER.warn "ConnectionException ERROR: #{e.inspect} - #{e.error.inspect}\n"
63
+ end
64
+ end
65
+ GC.start
66
+ end
67
+
68
+
69
+ def test_BASIC_00020_Program_Read_Volume
70
+ assert(conn = SAPNW::Base.rfc_connect)
71
+ attrib = conn.connection_attributes
72
+ fd = conn.discover("RPY_PROGRAM_READ")
73
+ assert(fd.name == "RPY_PROGRAM_READ")
74
+ $ITER.to_i.times do |iter|
75
+ f = fd.new_function_call
76
+ assert(fd.parameters.has_key?("PROGRAM_NAME"))
77
+ assert(f.parameters.has_key?("PROGRAM_NAME"))
78
+ assert(f.name == "RPY_PROGRAM_READ")
79
+ f.PROGRAM_NAME = 'SAPLGRFC'
80
+ assert(f.PROGRAM_NAME == 'SAPLGRFC')
81
+ begin
82
+ f.invoke
83
+ rescue SAPNW::RFC::FunctionCallException => e
84
+ SAP_LOGGER.warn "FunctionCallException: #{e.error.inspect}\n"
85
+ raise "gone"
86
+ end
87
+ assert(f.PROG_INF['PROGNAME'].rstrip == "SAPLGRFC")
88
+ assert(f.SOURCE_EXTENDED.length > 10)
89
+ GC.start unless iter % 50
90
+ end
91
+ assert(conn.close)
92
+ GC.start
93
+ end
94
+
95
+
96
+ def test_BASIC_00030_Read_table
97
+ assert(conn = SAPNW::Base.rfc_connect)
98
+ attrib = conn.connection_attributes
99
+ fd = conn.discover("RFC_READ_TABLE")
100
+ assert(fd.name == "RFC_READ_TABLE")
101
+ $ITER.to_i.times do |iter|
102
+ f = fd.new_function_call
103
+ assert(fd.parameters.has_key?("QUERY_TABLE"))
104
+ assert(f.parameters.has_key?("QUERY_TABLE"))
105
+ assert(f.name == "RFC_READ_TABLE")
106
+ f.QUERY_TABLE = 'T000'
107
+ f.DELIMITER = '|'
108
+ f.ROWCOUNT = 2
109
+ assert(f.QUERY_TABLE == 'T000')
110
+ begin
111
+ f.invoke
112
+ rescue SAPNW::RFC::FunctionCallException => e
113
+ SAP_LOGGER.warn "FunctionCallException: #{e.error.inspect}\n"
114
+ raise "gone"
115
+ end
116
+ assert(f.DATA.length > 1)
117
+ #f.DATA.each do |row|
118
+ # SAP_LOGGER.warn "Line: #{row.inspect}\n"
119
+ #end
120
+ GC.start unless iter % 50
121
+ end
122
+ assert(conn.close)
123
+ GC.start
124
+ end
125
+
126
+ def teardown
127
+ end
128
+ end
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/ruby
2
+ $KCODE = 'u'
3
+ $:.unshift(File.dirname(__FILE__) + '/lib')
4
+ $:.unshift(File.dirname(__FILE__) + '/ext/nwsaprfc')
5
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
6
+ $:.unshift(File.dirname(__FILE__) + '/../ext/nwsaprfc')
7
+
8
+ require 'sapnwrfc'
9
+
10
+ $TEST_FILE = ENV.has_key?('SAP_YML') ? ENV['SAP_YML'] : 'sap.yml'
11
+
12
+ $ITER = 50
13
+
14
+ require 'test/unit'
15
+ require 'test/unit/assertions'
16
+
17
+ class SAPChangingTest < Test::Unit::TestCase
18
+ def setup
19
+ #SAP_LOGGER.warn "Current DIR: #{Dir.pwd}\n"
20
+ if FileTest.exists?($TEST_FILE)
21
+ SAPNW::Base.config_location = $TEST_FILE
22
+ else
23
+ SAPNW::Base.config_location = 'test/' + $TEST_FILE
24
+ end
25
+ SAPNW::Base.load_config
26
+ #SAP_LOGGER.warn "program: #{$0}\n"
27
+ end
28
+
29
+ def test_BASIC_00010_Test_Changing
30
+ begin
31
+ $ITER.times do |iter|
32
+ assert(conn = SAPNW::Base.rfc_connect)
33
+ attrib = conn.connection_attributes
34
+ SAP_LOGGER.debug "Connection Attributes: #{attrib.inspect}\n"
35
+ fd = conn.discover("STFC_CHANGING")
36
+ SAP_LOGGER.debug "Parameters: #{fd.parameters.keys.inspect}\n"
37
+ f = fd.new_function_call
38
+ f.START_VALUE = iter
39
+ f.COUNTER = iter
40
+ f.invoke
41
+ SAP_LOGGER.debug "RESULT: #{f.RESULT}\n"
42
+ SAP_LOGGER.debug "COUNTER: #{f.COUNTER}\n"
43
+ assert(f.RESULT == iter + iter)
44
+ assert(f.COUNTER == iter + 1)
45
+ assert(conn.close)
46
+ GC.start unless iter % 50
47
+ end
48
+ rescue SAPNW::RFC::FunctionCallException => e
49
+ SAP_LOGGER.warn "FunctionCallException: #{e.error.inspect}\n"
50
+ raise "gone"
51
+ end
52
+ end
53
+
54
+ def test_BASIC_00020_Test_Changing
55
+ begin
56
+ assert(conn = SAPNW::Base.rfc_connect)
57
+ attrib = conn.connection_attributes
58
+ SAP_LOGGER.debug "Connection Attributes: #{attrib.inspect}\n"
59
+ fd = conn.discover("STFC_CHANGING")
60
+ SAP_LOGGER.debug "Parameters: #{fd.parameters.keys.inspect}\n"
61
+ $ITER.times do |iter|
62
+ GC.start unless iter % 50
63
+ f = fd.new_function_call
64
+ f.START_VALUE = iter
65
+ f.COUNTER = iter
66
+ f.invoke
67
+ SAP_LOGGER.debug "RESULT: #{f.RESULT}\n"
68
+ SAP_LOGGER.debug "COUNTER: #{f.COUNTER}\n"
69
+ assert(f.RESULT == iter + iter)
70
+ assert(f.COUNTER == iter + 1)
71
+ end
72
+ assert(conn.close)
73
+ rescue SAPNW::RFC::FunctionCallException => e
74
+ SAP_LOGGER.warn "FunctionCallException: #{e.error.inspect}\n"
75
+ raise "gone"
76
+ end
77
+ end
78
+
79
+ def teardown
80
+ end
81
+ end