Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

RFC_REMOTE_FILE

Former Member
0 Kudos

Hi together,

Since SAP removed fb RFC_REMOTE_FILE.....

Is there any other suitable fb in higher releases? (...or any other approaches)

Thanks for any help

1 ACCEPTED SOLUTION

Ulrich_Schmidt
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Gerd,

what do you mean with "in higher releases"? The function module RFC_REMOTE_FILE has never been defined on ABAP side. It only existed on C/C++ side in the program rfcexec.exe (contained in the classic RFC SDK). It has been removed from the RFC SDK because of security reasons: as rfcexec was present in every R/3 installation, it was kind of difficult to prevent unauthorized access to it. (Not every SAP user should be allowed to read and write files in the R/3 installation directory... And if a sys admin is not careful, he can easily open that door by a misconfiguration of the ACL files.)

One option for you would then be: just write your own "replacement" for rfcexec. You can then limit its functionality, install it only on the host, where files need to be read/written, implement additional security checks (e.g. you could implement it so that only files in one particular directory can be read/written), etc.

And nowadays you are not limited to C/C++: you can also write such a program in Java (using JCo) or in .NET (using NCo).

Or if you are an "ABAP-only" guy and only need to access files on the local application server, you could use the ABAP statement "OPEN DATASET" instead of making a call to RFC_REMOTE_FILE.

Best Regards, Ulrich

3 REPLIES 3

Ulrich_Schmidt
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Gerd,

what do you mean with "in higher releases"? The function module RFC_REMOTE_FILE has never been defined on ABAP side. It only existed on C/C++ side in the program rfcexec.exe (contained in the classic RFC SDK). It has been removed from the RFC SDK because of security reasons: as rfcexec was present in every R/3 installation, it was kind of difficult to prevent unauthorized access to it. (Not every SAP user should be allowed to read and write files in the R/3 installation directory... And if a sys admin is not careful, he can easily open that door by a misconfiguration of the ACL files.)

One option for you would then be: just write your own "replacement" for rfcexec. You can then limit its functionality, install it only on the host, where files need to be read/written, implement additional security checks (e.g. you could implement it so that only files in one particular directory can be read/written), etc.

And nowadays you are not limited to C/C++: you can also write such a program in Java (using JCo) or in .NET (using NCo).

Or if you are an "ABAP-only" guy and only need to access files on the local application server, you could use the ABAP statement "OPEN DATASET" instead of making a call to RFC_REMOTE_FILE.

Best Regards, Ulrich

0 Kudos

Hi Ulrich,

I was talking about the fact that the fm has not been available since release 4.7.

If such an fm is beeing removed it would be greate if there would be at least an official workaround!

I´d be willing to code a  'replacement' if I´d be able to use C/C++. If there would be any instruction as to how to actualize such a replacement (what tools do I need, what do I have to do, etc.) I´d be really grateful.

OPEN DATASET does not meet our requirements since we don´t want to transfer data to the SAP file system but to an external server (different domain).

Best regards

Gerd

0 Kudos

Hi Gerd,

the problem is, that this FM has been removed for a good reason (security), so providing "official" instructions on how to recreate it, would be a bit contra-productive...

I could post some sample code, which provides the basic skeletton of an RFC server program implementing RFC_REMOTE_FILE and which you would have to complete with the necessary security checks and other details, etc.

However, before we do this, here is another idea, which might be even simpler: if you want to transfer a file to an external server, can you perhaps use FTP? For this, two steps would be necessary:

  1. Start and configure an FTP server on the target host, if none is yet running. (In most Linux/Unix installations a standard FTP server is already present. It may only need to be activated and configured with regard to which user is allowed read/write access to which directories. For Windows Server, an FTP server is part of the IIS installation. There are also many freeware versions available.)
  2. On ABAP side use FMs FTP_CONNECT, FTP_R3_TO_SERVER, FTP_DISCONNECT, etc. A nice summary of this mechanism can be found here: http://wiki.scn.sap.com/wiki/display/ABAP/The+SAPFTP+Library+-+FTP+Programming+in+ABAP

Best Regards, Ulrich