06-16-2011 3:45 PM
Hello,
My client wants my program to read files on a remote server. He does not want to place the files on SAP server, or the read it locally because the program will run in background. Is there a way to read files in a remote server like no SAP server?
Thanks!
Jose
06-16-2011 3:50 PM
You can create a BAPI .. and code init to read data from remote server.
06-16-2011 3:55 PM
I've never created a BAPI, for that i can search a tutorial, but what would be the commands or functions to execute. Please give me some sample or a idea. I'm new on ABAP.
Thanks
06-16-2011 3:59 PM
Have the client NFS mount the server to SAP. In this way, the data will not exist in SAP - but SAP can read it.
06-16-2011 4:00 PM
check out SAP help below:
[http://help.sap.com/saphelp_nw70ehp1/helpdata/en/c7/eff2280d0511d3a6300060087832f8/content.htm]
and search SDN Wiki for examples. You should get some.
06-16-2011 4:01 PM
It is process that the Basis or Infrastructure team must perform. It allows SAP and the external box to communuicate.
Once they are linked, you can write custom ABAP to read the data on the remote server - because will be able to "see" into the remote server.
06-16-2011 4:02 PM
The remote server does not have SAP, will BAPI still be able?
Thanks!
06-16-2011 4:04 PM
The remote server does not need to change at all.
Once Basis mounts the remote server (using NFS), the SAP boxes will be able to perform OPEN DATASETs, and READs, to the remote server. In effect, the remote server is just another disk system to SAP.
06-16-2011 4:08 PM
Nice, so at the SAP server, would it be like a another disc, like e:\ for example?
I'm in the client with a little bit of ruch, they don't have a basis team here. The option with function module is availabe? If so, do you them?
Thanks!
06-16-2011 4:21 PM
Not likely e:\
What OS is the client running? Without a Basis team - you will likely have problems. I have never heard a company running SAP that does not have a Basis team... yikes.
Sounds like you will need call in some Basis support from your consulting company.
Good luck,
06-16-2011 3:55 PM
Hello Jose,
You can ask your basis to do the following :
Option 1:-
1) Mounting to the Remote server .
2)Then in your code you can use the open data set statement abap statement to read the file and write whereever you want. or copy the file using the command statements.
Option 2:-
Use the FTP FM's to copy the file from the remote server.
Hope this answers your question.
Thanks,
Greetson
06-16-2011 3:59 PM
Thanks!
Sorry, but wat is Mounting?
Do you know any FTP FM statements? or a ideia on how to use one in my program to read from remote server and place on the SAP server.
Thanks again!
06-16-2011 4:25 PM
Hi,
A simple way to get files from another server is using FTP functions.
HTTP_SCRAMBLE (Encyrpted Password)
FTP_CONNECT (user name, Encyrpted Password, ip, rfc_destination = 'SAPFTP' )
FTP_SERVER_TO_R3
Regards
06-16-2011 4:32 PM
Miguel option is certainly possible depending on the security, etc on the remote server.
Here is some sample code:
DATA: l_slen TYPE i.
CONSTANTS: c_dest TYPE rfcdes-rfcdest VALUE 'SAPFTP',
c_key TYPE i VALUE 26101957.
connect to ftp server
l_pwd = <password>.
l_slen = STRLEN( l_pwd ).
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = l_pwd
sourcelen = l_slen
key = c_key
IMPORTING
destination = l_pwd.
To Connect to the Server using FTP
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = <userid>
password = l_pwd
host = <host>
rfc_destination = c_dest
IMPORTING
handle = w_hdl
EXCEPTIONS
OTHERS = 1.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'FTP_SERVER_TO_R3'
EXPORTING
handle = w_hdl
fname = l_string
character_mode = 'X'
TABLES
text = <internal table>
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING invalid_output_file.
ENDIF.
To disconnect the FTP
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
handle = w_hdl.
To disconnect the RFC Connection
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = c_dest
EXCEPTIONS
OTHERS = 1.
06-16-2011 9:18 PM
Thank´s to all, i've talked to the basis team and they will take a look