cancel
Showing results for 
Search instead for 
Did you mean: 

Problems to use sapnwrfc with SAP4Rails

Former Member
0 Kudos

Hi,

I have problems to get SAP4Rails running together with the sapnwrfc. I have installed SAP4Rails and the sapnwrfc, but not the old saprfc. My code looks like this:

require_gem "sap4rails"

class Force_connector < SAP4Rails::Base

function_module :ZFM_ATLAS_FE_DETAILS_B

[...]

I get the following error message:

"uninitialized constant SAP::Rfc"

with the trace stack:

C:/INSTAN1/INSTAN1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:263:in `load_missing_constant'

C:/INSTAN1/INSTAN1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:in `const_missing'

C:/INSTAN1/INSTAN1/ruby/lib/ruby/gems/1.8/gems/sap4rails-0.12/lib/sap4rails/pool.rb:69:in `connect'

C:/INSTAN1/INSTAN1/ruby/lib/ruby/gems/1.8/gems/sap4rails-0.12/lib/sap4rails/pool.rb:17:in `check_connect'

C:/INSTAN1/INSTAN1/ruby/lib/ruby/gems/1.8/gems/sap4rails-0.12/lib/sap4rails/functions.rb:13:in `function_module'

#/app/models/force_connector.rb:4 Moreover Mongrel said me in the shell window: Could not load nwsaprfc. Make sure nwrfcsdk libraries are properly installed: 14 001: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. - C:/INSTAN~1 /INSTAN~1/ruby/lib/ruby/gems/1.8/gems/sapnwrfc-0.12-mswin32/ext/nwsaprfc/nwsaprfc.so Microsoft's Dependency walker tells me, that nwsaprfc.so lacks of three dependency files: SAPNWRFC.DLL - What is this and where I can I get it? MSJAVA.DLL - Dependency walker also indicated this for the old saprfc.so, and it worked anyway) and MSVCR80.DLL - probably a DLL that comes with MS Visual Studio, but I do not quite understand why it is necessary. I realized, that there is a subfolder "nw" in the SAP4Rails installation directory, so I altered my code to: require_gem "sap4rails" class Force_connector < SAP4Rails::NW::Base function_module :ZFM_ATLAS_FE_DETAILS_B Which produced the following error: uninitialized constant SAP::Rfc with the trace stack: C:/INSTAN1/INSTAN1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:263:in `load_missing_constant' C:/INSTAN1/INSTAN1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:in `const_missing' C:/INSTAN1/INSTAN1/ruby/lib/ruby/gems/1.8/gems/sap4rails-0.12/lib/sap4rails/pool.rb:69:in `connect' C:/INSTAN1/INSTAN1/ruby/lib/ruby/gems/1.8/gems/sap4rails-0.12/lib/sap4rails/pool.rb:17:in `check_connect' C:/INSTAN1/INSTAN1/ruby/lib/ruby/gems/1.8/gems/sap4rails-0.12/lib/sap4rails/functions.rb:13:in `function_module' #/app/models/felem.rb:4

#/app/controllers/unit_controller.rb:9:in `view2'

Could you please provide me with any help to install sapnwrfc correctly?

Thanks and best regards

Bernd

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I think the MS dependency walker is telling you that it can't find SAPs NW RFC SDK (sapnwrfc.dll) - have you installed this - the links for the beta release or on the blog.

In sap4rails - if it can't find sapnwrfc (version 0.12), it then looks for saprfc instead, which it isn't finding either by the look of your error message.

Cheers.

Former Member
0 Kudos

Ok, I should have read your blog before 😄 Would have saved me a lot of time for search for the sapnwrfc.dll...

Now I've downloaded the SAP NW RFC SDK, copied the files to the windows/system32-folder, but I still get the message

"Could not load nwsaprfc. Make sure nwrfcsdk libraries are properly installed:

001: This application has failed to start because the application configurati

is incorrect. Reinstalling the application may fix this problem. - C:/INSTA

/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/sapnwrfc-0.12-mswin32/ext/nwsaprfc/nwsa

c.so"

Dependency walker doesn't signal missing dependcies any more...

I have no idea, where the problem is

Former Member
0 Kudos

see if you can load sap4rails outside of rails - also sapnwrfc.


  ruby -rrubygems -e 'require "sap4rails"'

and:


  ruby -rrubygems -e 'require "sapnwrfc"'

see if you get errors. If you do, then the ruby loader is not able to find sapnwrfc.dll in its searchable paths, so you need to find somewhere else to put it.

Cheers.

Former Member
0 Kudos

Hi,

I tried this, and I get error, that sapnwrfc cannot be loaded ("restart the application"). I have installed VC 8.0 Runtime and the SAP NW RFC (sapnwrfc.dll), it is in my windows\system32 folder, which is in the path variable. I know that is not much information... Any idea?

Cheers

Bernd

Former Member
0 Kudos

You have some kind of library path problem with windows/Ruby/SAP NW RFC - you need to resolve this or wait for the imminent release of the production level SAP NW RFC (SAP to confirm this ...) - this will presumably have some kind of installer, and will be installed in a uniform location, making it easier for 3rd party applications to distribute against it.

Cheers.

Former Member
0 Kudos

Well,

seems that on Windows there is some dependency problem that cannot be solved so easily. Maybe it is becaused the nwsaprfc.so is compiled in "Debug mode" (as far as I can read from the file). I think I will look on the Linux version in the next days. Just one question: Has anyone ever managed to get the combination sap4rails with sapnwrfc for Ruby and the new NetWeaver RFC SDK from SAP running? (Just to be sure, that it is possible to get it running).

Former Member
0 Kudos

I certainly have

Hopefully we are only talking a matter of weeks before SAP release the first productive version of SAP NW RFC - then - hopefully - these problems should go away.

Cheers.

Former Member
0 Kudos

Actually - I've just had a mail from someone at SAP, and they have referred me to an OSS note - 684106.

Can you please check this out, and make sure that you follow all the points about the MS C runtime in there as it may help.

Former Member
0 Kudos

Hi,

finally I decided to try it on Linux, but again, a very similar problem. I installed it successfully, but when calling

ruby -rrubygems -e 'require "sapnwrfc"'

I get the error message,


Could not lot load nwsaprfc. Make sure nwrfcsdk libraries are properly installed: libsapnwrfc.so: cannot open shared object file: No such file or directory - /usr/local/lib/site_ruby/1.8/i486-linux/nwsaprfc.so
/usr/local/lib/site_ruby/1.8/i486-linux/nwsaprfc.so: libsapnwrfc.so: cannot open shared object file: No such file or directory - /usr/local/lib/site_ruby/1.8/i486-linus/nwsaprfc.so (LoadError)

But the files are there, and I also tried with giving all the rights.

Former Member
0 Kudos

Can you tell me where you have put the file libsapnwrfc.so which you will have got from the NW SAP RFCSDK from service.sap.com/swdc ?

Piers Harding.

Former Member
0 Kudos

I stored it into /usr/sap/nwrfsdk/lib

Cheers

Bernd

Former Member
0 Kudos

Right - so when you compiled sapnwrfc you would have presumably pointed to /usr/sap/nwrfsdk which contains the lib directory and the include directory.

What maybe happening now is that at run time the libsapnwrfc.so is not found because it isnt in your system library cache, or in the load path. Have you tried setting LD_LIBRARY_PATH to /usr/sap/nwrfsdk/lib ?

Cheers,

Piers Harding.

Former Member
0 Kudos

Hi,

great, thanks a lot for all the support. I didn't understand quite right

the advice in the README, as the example path is

/home/piers/code/sap/lib, I thought that the environment variable should

be set to the path to your sapnwrfc connector. Moreover sapnwrfc requires

the libsapu16_mt.so file, which isn't shipped with the new NW RFC SDK,

but only with the old RFC SDK, maybe it should be mentioned in the README

for dummies (like me). For compilation also a file called libdecnumber.so is

required, that I could not find anywhere. However I renamed libicudecnumber.so

and it worked fine for me. But I am not sure if there is a difference between the

two files.

Former Member
0 Kudos

libsapu16_mt.so is nolonger a dependency although having this referenced in the ruby build process wont cause a problem ( I have removed it for the next release). The same applies for libdecnumber.so - this has been renamed to libicudecnumber.so (so you should change it back). The only one that needs to be explicitly referenced now is libnwsaprfc.so, and so long as the rst are in the same lib directory as specified in the LD_LIBRARY_PATH, it sorts itself out. This could also be added to ld.so.conf under linux.

Piers Harding.

Answers (0)