Hello, Matthew. Can you explain how to bring a text file from a different server into my ABAP or SAP server. The servers (SAP and other) are mapped to each other (although they are in different domains and have no trust between them), and I need to FTP the file so that I can process the data with the ABAP. The Windows FTP function is giving me problems, and I would like to FTP directly from my ABAP. I've had a look at the standard program RSEPSFTP, but this does not allow for the creation of variants, which I need, to run the program at 1:00 a.m. Thank you for any advice/explanation.
You need to set up a command in SM69 with additional parameters. For Unix, the command is "sh", which runs a shell script.
Create the needed FTP commands as an FTP script in ABAP in an internal table. Transfer the FTP script as a file to your server using:
open dataset script_file for output in text mode. loop at script. transfer script to script_file. endloop.
Where script_file is the output file name. Then you create the Unix shell script, which calls the FTP script, and transfer that to your server.
Call function module
SXPG_CALL_SYSTEM to launch your shell script (using the command you set up earlier), which will then call the FTP script, and your FTP is performed.
You can do the same with other OSes with different commands, but the principle is the same. You could set up the FTP as a command directly, but doing the two-step approach allows more flexibility (e.g., moving the source file to another directory after the FTP).
Dig Deeper on SAP ABAP
Related Q&A from Matthew Billingham
An SAP user is trying to run a report in an SAP ALV Grid online and wants to know how to get the data in the report to appear along with the header. Continue Reading
An SAP user needs to transfer customer purchase order spreadsheet data to SAP VA01 to create a new sales order. Continue Reading
A SearchSAP.com reader wants to know if it's possible to write an SAP ABAP program that will read source code and then create an SAP ABAP function ... Continue Reading