1

My requirement is to use R to analyze data from my company SAP system. I use R v.3.2.4 on my local computer and am able to log in to SAP via SAPGUI.

I have found that to connect R to SAP you need RSAP package, and to install it you need SAP NetWeaver RFC SDK on your local computer.

I tried the steps below, but have stuck with installing RSAP in R (step 12]).

I would appreciate any suggestion how to proceed ...

Steps according to: https://wiki.scn.sap.com/wiki/display/ABAPConn/Download+and+Installation+of+NW+RFC+SDK

01] Download NWRFC_38-20004568.SAR
02] Download SAPCAR.exe
03] Put both files in the same directory C:\Downloads
04] Run 'cmd' to open command terminal window and change directory to C:\Downloads
05] To decompress the .SAR file write in the command line SAPCAR_617-80000938.exe -xvf NWRFC_38-20004568.SAR    

Steps according to: INSTALL file on https://github.com/piersharding/RSAP

06] Position header and library directories as C:\nwrfcsdk\include and C:\nwrfcsdk\lib - move directory nwrfcsdk from C:\Downloads to C:\
07] Copy the content of C:\nwrfcsdk\lib into the Windows system32 directory ie: C:\Windows\System32
08] Download Rtools for appropriate version of R from cran.r-project.org
09] Run the downloaded file RTools33.exe to install Rtools (see installation settings at the very bottom)
10] Then reboot the computer.  You must make absolutely sure that the RTools install worked correctly - check for any errors when you startup R
11] In R install packages 'devtools', 'yaml', 'reshape' (last two are dependencies for RSAP) and restart R
12] In R execute:
library(devtools)
library(yaml)
library(reshape)
install_github("RSAP", username="piersharding", args=c("--configure-args=--with-nwrfcsdk-include=C:\\nwrfcsdk\\include --with-nwrfcsdk-lib=C:\\nwrfcsdk\\lib --no-clean-on-error"))

And here is the error:

Downloading GitHub repo piersharding/RSAP@master from URL h t t p s ://api.github.com/repos/piersharding/RSAP/zipball/master    
Error in curl::curl_fetch_memory(url, handle = handle) : 
  Problem with the SSL CA cert (path? access rights?)    
In addition: Warning message:
Username parameter is deprecated. Please use piersharding/RSAP 

I tried another thing as suggested in INSTALL file:

12] In R execute:
install.packages("RSAP", repos=c("h t t p://piersharding.com/R"), type="source")

And this time the system did some more work, but still without success:

Installing package into ‘\\RWAMSEEFP1/U_kosinskr$/My Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
  dependencies ‘yaml’, ‘reshape’ are not available
trying URL 'http://piersharding.com/R/src/contrib/RSAP_0.9.tar.gz'
Content type 'application/x-gzip' length 69780 bytes (68 KB)
downloaded 68 KB

* installing *source* package 'RSAP' ...
** libs
Warning: this package has a non-empty 'configure.win' file,
so building only the main architecture

gcc -m64 -I"C:/PROGRA~1/R/R-32~1.4/include" -DNDEBUG -I. -I"C:/nwrfcsdk/include" -DSAPwithUNICODE -DUNICODE -D_UNICODE -D_AFXDLL -D_CRT_NON_CONFORMING_SWPRINTFS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DSAPonNT -DSAP_PLATFORM_MAKENAME=ntintel     -I"d:/RCompile/r-compiling/local/local323/include"     -O2 -Wall  -std=gnu99 -mtune=core2 -c RSAP.c -o RSAP.o
In file included from C:/nwrfcsdk/include/sapnwrfc.h:7:0,
                 from RSAP.c:41:
C:/nwrfcsdk/include/sapucx.h:562:5: warning: 'align' attribute directive ignored [-Wattributes]
In file included from RSAP.c:41:0:
C:/nwrfcsdk/include/sapnwrfc.h:28:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
RSAP.c: In function 'u8to16c':
RSAP.c:133:12: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
RSAP.c: In function 'u8to16':
RSAP.c:150:12: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
RSAP.c: In function 'u8to16r':
RSAP.c:167:12: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
RSAP.c: In function 'u16to8c':
RSAP.c:184:12: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
RSAP.c: In function 'u16to8':
RSAP.c:208:12: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
RSAP.c: At top level:
C:/nwrfcsdk/include/sapuc.h:853:24: warning: 'sccsidU16' defined but not used [-Wunused-variable]
gcc -m64 -shared -s -static-libgcc -o RSAP.dll tmp.def RSAP.o -L. -LC:/nwrfcsdk/lib -lsapnwrfc -llibsapucum -Ld:/RCompile/r-compiling/local/local323/lib/x64 -Ld:/RCompile/r-compiling/local/local323/lib -LC:/PROGRA~1/R/R-32~1.4/bin/x64 -lR
installing to \\RWAMSEEFP1/U_kosinskr$/My Documents/R/win-library/3.2/RSAP/libs/x64
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) :
  there is no package called 'RSAP'
Error: loading failed
Execution halted
ERROR: loading failed
* removing '\\RWAMSEEFP1/U_kosinskr$/My Documents/R/win-library/3.2/RSAP'
Warning in install.packages :
  running command '"C:/PROGRA~1/R/R-32~1.4/bin/x64/R" CMD INSTALL -l "\\RWAMSEEFP1\U_kosinskr$\My Documents\R\win-library\3.2" C:\Users\kosinskr\AppData\Local\Temp\Rtmp40cQJZ/downloaded_packages/RSAP_0.9.tar.gz' had status 1
Warning in install.packages :
  installation of package ‘RSAP’ had non-zero exit status

The downloaded source packages are in
    ‘C:\Users\kosinskr\AppData\Local\Temp\Rtmp40cQJZ\downloaded_packages’

RTools installation settings

Destination location: c:\Rtools

Setup type: Package authoring installation

Selected components:

R toolset
Cygwin DLLs
R 2.15.x-R 3.2.x toolchain
R 3.3.x+ 32 bit toolchain
R 3.3.x+ 64 bit toolchain

Additional tasks:

Change system PATH to:
PATH=c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;C:\Program Files (x86)\Java\jre6\bin;C:\Program Files\Java\jre6\bin;C:\Windows\system32;
[truncated]
Save version information to registry
Rafal Xxx
  • 55
  • 6
  • Sorry to be of no help, but the `install_github` command passes some arguments that expect things to be at location `C:\\nwrfcsdk\\include` and `\lib`. Have you looked into this? – Roman Luštrik Mar 18 '16 at 11:46
  • This is how INSTALL file says to be, but maybe you are right, I will have a look. I also suspect RTools not working as expected or GitHub repo issue. But this is just guessing and need some enlightning ;) – Rafal Xxx Mar 18 '16 at 14:55
  • Try installing another package to check the Rtoolchain works. Say `devtools::install_github("hadley/ggplot2")`. – Roman Luštrik Mar 18 '16 at 16:41
  • Indeed it does not work as I am getting this error: `Downloading GitHub repo hadley/ggplot2@master from URL https://api.github.com/repos/hadley/ggplot2/zipball/master Error in curl::curl_fetch_memory(url, handle = handle) : Problem with the SSL CA cert (path? access rights?)` Does it mean it is RTools issue? Could it be a compatibility issue or just placing certain files in certain directory? – Rafal Xxx Mar 18 '16 at 19:19
  • Perhaps http://stackoverflow.com/questions/31643036/devtoolsinstall-github-fails-with-ca-cert-error ? – Roman Luštrik Mar 18 '16 at 23:04

0 Answers0