on 03-01-2007 9:52 PM
This thread follow Piers blog <a href="/people/piers.harding/blog/2007/02/28/netweaver-rfc-gives-the-next-generation-ruby-and-perl-connectors RFC gives the Next generation Ruby and Perl Connectors</a>
Post your comments, troubles and recommendations.
Greetings,
Blag.
Has anyone been able to use the new sapnwrfc connector?
I followed the instructions and has successfully built and installed the sapnwrfc gem (version 0.12). But when I try to test the install with test_connect.rb, I got the following error:
D:\dev\ruby\sap\sapnwrfc-0.12\test>d:\ruby\bin\ruby test_connect.rb
E, [2007-04-20 19:25:05#676] ERROR -- : Could not load nwsaprfc. Make sure nwrfcsdk libraries are properly installed: 14001: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. - d:/ruby/lib/ruby/gems/1.8/gems/sapnwrfc-0.12-i386-mswin32/ext/nwsaprfc/nwsaprfc.so
d:/ruby/lib/ruby/gems/1.8/gems/sapnwrfc-0.12-i386-mswin32/lib/sapnwrfc.rb:163: warning: already initialized constant SAP_LOGGER
E, [2007-04-20 19:25:05#676] ERROR -- : Could not load nwsaprfc. Make sure nwrfcsdk libraries are properly installed: 14001: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. - d:/ruby/lib/ruby/gems/1.8/gems/sapnwrfc-0.12-i386-mswin32/ext/nwsaprfc/nwsaprfc.so
d:/ruby/lib/ruby/gems/1.8/gems/sapnwrfc-0.12-i386-mswin32/ext/nwsaprfc/nwsaprfc.so: 14001: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. - d:/ruby/lib/ruby/gems/1.8/gems/sapnwrfc-0.12-i386-mswin32/ext/nws
aprfc/nwsaprfc.so (LoadError)
from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:33:in `require'
from d:/ruby/lib/ruby/gems/1.8/gems/sapnwrfc-0.12-i386-mswin32/lib/sapnwrfc.rb:171
from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:33:in `gem_original_require'
from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:33:in `require'
from test_connect.rb:7
Any suggestion how to fix the problem? Thanks!
Kenny
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Using Ruby version 1.8.5 and rubygems 0.9.2 and sapnwrfc 0.12 - if I run this at the command line:
[code]
ruby -rrubygems -e 'gem "sapnwrfc"; require "sapnwrfc";'
[/code]
I get this:
[code]
piers@gecko:~/code/ruby/sapnwrfc$ ruby -rrubygems -e 'gem "sapnwrfc"; require "sapnwrfc";'
stderr initialized
piers@gecko:~/code/ruby/sapnwrfc$
[/code]
If you don't get something that (ie. some library load error), then it means that your sapnwrfc, or your nwrfcsdk is not installed properly. If you believe that you have installed the above correctly) including Ruby and rubygems versions) then you must have a library dependency or system path type issue for the libraries being loaded.
Piers.
Ok....First problem -:'( I download and install the following gem...
<b>sapnwrfc-0.07-mswin32.gem</b>
Then....I create the .yml file...
[code]
ashost: Huroncebrio
sysnr: "00"
client: "000"
user: bcuser
passwd: minisap
lang: EN
trace: 2
[/code]
Then....My lovely <b>SE16</b> example....
[code]
specify a YAML base config file or pass connection
parameters directly to rfc_connect()
require 'sapnwrfc'
SAPNW::Base.config_location = 'sap.yml'
SAPNW::Base.load_config
conn = SAPNW::Base.rfc_connect
get the system and connection details
attrib = conn.connection_attributes
$stderr.print "Connection Attributes: #{attrib.inspect}\n"
lookup the dictionary definition of an Function Module
fds = conn.discover("RFC_READ_TABLE")
$stderr.print "Parameters: #{fds.parameters.keys.inspect}\n"
create an instance of a Function call
fs = fds.new_function_call
populate the parameters - structures and table
#rows now take hashes of field name/value pairs
fs.IMPORTSTRUCT = { 'query_table' => 'SPFLI',
'delimiter' => '|'}
execute the RFC call
fs.invoke
$Fields = Array.new
$Data = Array.new
$Data_Fields = Array.new
$Data_Split = Array.new
itab.fields.hashRows {|field| $Fields.push(field) }
$Fields_Len = $Fields.length
itab.data.hashRows {|field| $Data.push(field.to_s.strip!) }
$Data_Len = $Data.length
for i in 0...$Data_Len
$Data_Fields = $Data<i>
$Data_Split = $Data_Fields.split("|")
for i in 1...$Fields_Len
print $Data_Split<i>.to_s.strip, "|"
end
print "\n\n"
end
print "Exit"
[/code]
However....I getting the following error...
<i>
cannot load C Ext nwsaprfc.c
</i>
Greetings,
Blag.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK - by the look of it you might have a dependency problem. Where did you install the SDK with the libraries (that Ulrich put the links up for see the blog post )? The libraries will need to go in your search path - the most straight forward is into the system32 diretory (but I'll defer to those win32 specialists out there).
Cheers.
Hi Piers:
I download and use the Dependency Walker, then I copied some missing DLL's...
The problems didn't went out, so I download this
<a href="http://www.liutilities.com/products/campaigns/plib/rbplib/?id=top">Registry Booster</a>
And it fixed a lot of internal problems...But still I need this DLL
<b>DRVADODB.dll</b>
I can't find it on the web...But as I read, it's supposed to a SAP one...I got MiniSap installed, so that maybe why I don't have all the necessary dll's....
Greetings,
Blag.
Hi Alvaro,
One of the requirements for using the ruby gem is to have the VC 8.0 Runtime installed. It's the most common reason for sapnwrfc not loading. You can find it at MS:
Best regards,
Olivier.
Please restart, and then perhaps you can show what the dependency chain looks like.
I don't have much experience with win32 development, but I the machine that I tried it on DRVADODB.dll doesnt show in the dependency tree at all (win XP, Office home etc, with complete SAPGUI install).
Cheers.
Alvaro,
Starting with VC 2005 the runtime dlls are no more found in the search path (System directory). Look at the MSVCRT*.dll locations on my machine:
Directory of C:\WINNT\system32
01/04/2002 08:37 PM 344,064 msvcr70.dll
02/21/2003 05:42 AM 348,160 msvcr71.dll
08/04/2004 09:00 AM 343,040 msvcrt.dll
08/04/2004 09:00 AM 253,952 msvcrt20.dll
08/04/2004 09:00 AM 61,440 msvcrt40.dll
5 File(s) 1,350,656 bytes
Directory of C:\WINNT\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.163_x-ww_681e29fb
06/05/2006 02:14 PM 626,688 msvcr80.dll
1 File(s) 626,688 bytes
Directory of C:\WINNT\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd
09/23/2005 12:29 AM 626,688 msvcr80.dll
1 File(s) 626,688 bytes
Directory of C:\WINNT\WinSxS\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_f75eb16c
09/22/2005 04:48 PM 1,171,456 msvcr80d.dll
1 File(s) 1,171,456 bytes
Directory of C:\WINNT\WinSxS\x86_Microsoft.Windows.CPlusPlusRuntime_6595b64144ccf1df_7.0.0.0_x-ww_2726e76a
08/04/2004 08:00 AM 322,560 msvcrt.dll
1 File(s) 322,560 bytes
Directory of C:\WINNT\WinSxS\x86_Microsoft.Windows.CPlusPlusRuntime_6595b64144ccf1df_7.0.2600.2180_x-ww_b2505ed9
08/04/2004 12:57 AM 343,040 msvcrt.dll
1 File(s) 343,040 bytes
As you can see msvcrt80 dlls are no more placed in the system directory. There are placed in a specific place in WinSxS and registered somewhere in the registry. This can only be done properly if you run the Visual C++ Runtime.
A manifest embedded in the the application describe the dlls the application was built with and is used for the OS to provide the app with the correct dlls. You can put as many msvcrt80.dll around your OS as long as they are not registered properly the module won't work.
Hope this helps,
Best regards,
Olivier.
Hmmm - I've just gone back to your original post, and noticed something. In this example you are doing a direct "require 'sapnwrfc'".
Have you tried modifying this to use gems, as this is what you have installed?
When you use the gem file you should be doing:
require 'rubygems'
require_gem 'sapnwrfc'
Cheers.
I'm using 1.8.2 with updated gems, so I got the message telling me that require_gem is obsolete and should be using gem instead....
Could be that I need to upgrade to 1.8.5???
However...I got this simple error....
uninitialized constant SAPNW
I know that SAPNW is a base class, so I don't know what should I initialized it....
Greetings,
Blag.
OK - it would be helpful to upgrade to 1.8.5, but I guess we still need to solve your VC Runtime issues too.
SAPNW is the base namespace - as would normally be defined by the module statement in Ruby. This is created when the C extension nwsaprfc.so is loaded, so this proves that it hasnt been loaded successfully when you get an error about it.
Cheers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.