How to send a file from FTP to external server
My requirement is to send a file from FTP to D3(External) server.
Now I am able to store the file in Appln server.
I want to send the file created by the program thru FTP to D3 server.
I know the username,Password,HostID,RFC destination details.
How to send the file from FTP to D3.
If u have any program,Plz send it...
I dont want the function modules name...I want the example code ....
Thanks in advance.
Hi Sumi,
You could do it so that you create a .bat or .cmd script to your server which does your ftp transfer.
To do this you must use sm69 to create a external operating system command which you can call from FM SXPG_COMMAND_EXECUTE. To SXPG_COMMAND_EXECUTE you the file you need to transfer as a parameter.
What happens is that your abap program passes the file to windows batch script (.bat .cmd) which will then do the transfer for you.
Here's a sample of ftp-script for windows:
echo open IP_ADDRESS_TO_YOUR_SERVER > c:zftp_transfer.ftp
echo USERNAME>> c:zftp_transfer.ftp
echo PASSWORD>> c:zftp_transfer.ftp
echo put YOUR_FILE>> c:zftp_transfer.ftp
echo quit>> c:zftp_transfer.ftp
ftp -s:c:zftp_transfer.ftp
also take a look here for more details:
http://support.microsoft.com/?kbid=96269
Ok, this might be a bit trivial but if your server is unix/aix etc.. Instead of using batch script you must do a shell script.
Regards,
Ville
Similar Messages
-
How to send the file contents in the application server to ftp server
Hi,
how to send the file contents in the application server to ftp server.
regards,
sreeTest SAP FTP functions
DATA: BEGIN OF MTAB_DATA OCCURS 0,
LINE(132) TYPE C,
END OF MTAB_DATA.
DATA: MC_PASSWORD(20) TYPE C,
MI_KEY TYPE I VALUE 26101957,
MI_PWD_LEN TYPE I,
MI_HANDLE TYPE I.
START-OF-SELECTION.
MC_PASSWORD = 'password'.
DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.
*-- FTP_CONNECT requires an encrypted password to work
CALL 'AB_RFC_X_SCRAMBLE_STRING'
ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
ID 'DSTLEN' FIELD MI_PWD_LEN.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
USER = 'userid'
PASSWORD = MC_PASSWORD
HOST = 'servername'
RFC_DESTINATION = 'SAPFTP'
IMPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
NOT_CONNECTED = 1
OTHERS = 2.
CHECK SY-SUBRC = 0.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = MI_HANDLE
COMMAND = 'dir'
TABLES
DATA = MTAB_DATA
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF SY-SUBRC = 0.
LOOP AT MTAB_DATA.
WRITE: / MTAB_DATA.
ENDLOOP.
ELSE.
do some error checking.
ENDIF.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
OTHERS = 1.
Execute external commands (FTP Scripts)
The following code shows the syntax of the FM 'SXPG_COMMAND_EXECUTE'. You pass it the external command created within transaction SM69 and it will execute it.
DATA: ld_comline
LIKE sxpgcolist-name,
ld_param LIKE sxpgcolist-parameters,
ld_status LIKE extcmdexex-status,
ld_output LIKE btcxpm OCCURS 0 WITH HEADER LINE,
ld_subrc LIKE sy-subrc.
REFRESH ld_output.
MOVE 'FTP_DATA_IN' to ld_comline. "Maintained using trans SM69
Execute external command, contained in 'ld_comline'
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = ld_comline
additional_parameters = ld_param "Params passed to script
operatingsystem
= 'UNIX'
IMPORTING
status = ld_status
TABLES
exec_protocol = ld_output
EXCEPTIONS
no_permission
= 1
command_not_found
= 2
parameters_too_long
= 3
security_risk
= 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry
= 13
jobcount_generation_error
= 14
OTHERS
= 15.
IF sy-subrc NE 0.
ENDIF. -
How to move PDF file from Spool to Application Server?
How to move PDF file from Spool to Application Server?
Cannot use RSTXPDFT4 because that converts OTF to PDF and the file is already PDF.
RSTXPDFT5 doesn't work. It picks the file up and assigns it a 'text' type and outputs a 1 line txt (1kb in size) on the server with the spool number in it!
The program which outputs the file to the spool, in the first place, uses adobe forms and outputs to a printer of type PDF.Hi Gemini ,
Please refer the below links.
[http://sap.ittoolbox.com/groups/technical-functional/sap-hr/convert-a-spool-to-pdf-and-save-on-application-server-in-background-720959]
[http://www.sapfans.com/forums/viewtopic.php?f=13&t=325628&start=15]
Edited by: Prasath Arivazhagan on Apr 13, 2010 4:48 PM -
How to copy/send text file from FTPS to SAP ECC File Port
Hi Frdns,
I am working on one design, actually my requirement as follows
I am receiving financial information document from Banks, which is in the form of BIA2 message format, it looks like text file. This information needs to be sending to SAP ECC system.
I identified some approaches to full fill the requirement
1)Using Conversion agent/or third party tools to convert BIA2 message in to XML, then using PI I will pick up the XML message, convert it in to IDoc.
2)Without any conversion I will copy the same file (original BIA2 message) in to SAP ECC file port, in this case no conversion required, calling some program I will schedule it.
I am looking forward t implement the second approach because it saves lot of money to my client.
Now I am wondering using File adapter can i copy to SAP ECC File Port or I required ABAP proxy?
What is the best approach to copy the BIA message text file from FTPS to SAP ECC File Port.??
Regards,
RajHi Raja,
>>Now I am wondering using File adapter can i copy to SAP ECC File Port or I required ABAP proxy?
Yes you can do this copy, the only restriction that can happen is the file size.. If you are sure that the fiel will be of few MB at the max then you can use the Configuration part alone and copy it to ECC folder. For doing this you need the following:
1. Sender agreement (mention the sender interface as anything XYZ)
2. Sender communication channel. Pick the file in binary mode
3. Receiver determination (keep both the sender and receiver service as same)
4. Interface Detemiantion (dont specify any mapping and keep the receiver interface name as XYZ)
5. Create receiver agreement (with same service and interface)
6. Use file adapter here
Regards
Suraj -
How to read .xls file from FTP server t oInternal table
Hi
am using the FTP_SERVER_TO_R3 to read xls file from FTP server to internal table
but the data i get in LT_TEXT is special characters.
CALL FUNCTION 'FTP_SERVER_TO_R3'
EXPORTING
handle = hdl
fname = f_name "ProdDataFromCRM.xls.
* CHARACTER_MODE = 'X'
* IMPORTING
* BLOB_LENGTH =
TABLES
BLOB = lt_text
* TEXT = lt_text
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4
can any one help me out to get the exact data..
Really appreciate your quick response..
Thank YouHi, if you really retrieve an excel file, you can not see the data in ABAP. You may see them in Excel. For this you may use
CALL METHOD document->open_document_from_table
of the interface i_oi_document_proxy for OLE objects. You can access the data with reference to the interface i_oi_spreadsheet.
Please check [Desktop Office Integration (BC-CI)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIOFFI/BCCIOFFI.pdf] for details.
But, who knows, perhaps you want "And Now For Something Completely Different".
Regards
Clemens -
How to read XL file from FTP server
Hi all,
I have a requirement like to read file from FTP server using path
ftp:
10.212......\DTR\DTR_ Accounted_Out
and again save other file in same location ,
to doing this RFC connection is required?
give a procedure or program to do this requirement ..
To create rfc for FTP which connection type can i use ?
Give complete settings to create rfc destinationHi Rakhi,
Use the below code to check if you have received the proper data.
call function 'FTP_SERVER_TO_R3' "Get data as character instead of BLOB
exporting
handle = hdl
fname = docid
character_mode = 'X'
tables
text = chardata.
If the data is incorrect, it is possible that you are in the wrong directory.
Use
call function 'FTP_COMMAND'
exporting
handle = hdl
command = 'cd mydir\mysubdir' "cd <space> your path
tables
data = result
exceptions
tcpip_error = 1
command_error = 2
data_error = 3.
Regards,
Jovito. -
How to delete Archived files from FTP
HI,
I am looking to delete Archived files from FTP Server, Can anybody have idea about this.
Thanks,
RamTo be frank, deletion of archived files is really a manual activity and is never in reality done by an interface
so you have two options;
1. log into the archived folder and manually delete archived files
2. run a script in your file adapter - this way everytime the interface is triggered the files will be deleted - but then y do this.. instead just dont archive any files at all -
How do I transfer files from my AIX database server to my Windows AS?
Hello, I need to transfer log files from my AIX database server to my Windows AS so I can view them in a form. Any ideas??
RegardsInstall samba with the samba client (smbclient). Push them via the smbclient directly to you Windows machine OR the other way around, start the samba deamons (smbd and nmbd). Make a Windows network share on your AIX machine and view them in your form directly.
If you can't use samba then an alternative is the use of NFS -
How to send a file from a java program to a servlet and get a response
Hi,
How can I call a servlet from a standalone java program and send a file to a servlet using POST method and in return gets the status back from the servlet. Any help is appreciated any small sample will help.
Thanks.Hi,
I am trying the following sample I got from net and am getting the following error. Any help what I am doing wrongs:
06/12/24 02:15:58 org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is null
06/12/24 02:15:58 at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:294)
06/12/24 02:15:58 at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:268)
06/12/24 02:15:58 at mypackage9.Servlet1.doPost(Servlet1.java:38)
06/12/24 02:15:58 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
06/12/24 02:15:58 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
06/12/24 02:15:58 at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
06/12/24 02:15:58 at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
06/12/24 02:15:58 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663)
06/12/24 02:15:58 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
06/12/24 02:15:58 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
06/12/24 02:15:58 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
06/12/24 02:15:58 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
06/12/24 02:15:58 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
06/12/24 02:15:58 at java.lang.Thread.run(Thread.java:534)Here is the sample client code:
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class PostAFile {
private static String url =
"http://192.168.0.17:8988/Vulcan_Materials-ServletPost2-context-root/servlet/Servlet1";
public static void main(String[] args) throws IOException {
HttpClient client = new HttpClient();
PostMethod postMethod = new PostMethod(url);
client.setConnectionTimeout(8000);
File f = new File("C:\\load.txt");
System.out.println("File Length = " + f.length());
postMethod.setRequestBody(new FileInputStream(f));
int statusCode1 = client.executeMethod(postMethod);
System.out.println("statusLine>>>" + postMethod.getStatusLine());
postMethod.releaseConnection();
}Here is the sample servlet code:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.PrintWriter;
import java.io.IOException;
import org.apache.commons.fileupload.DiskFileUpload;
import org.apache.commons.fileupload.FileItem;
import java.util.List;
import java.util.Iterator;
import java.io.File;
public class Servlet1 extends HttpServlet
private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
public void init(ServletConfig config) throws ServletException
super.init(config);
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
try
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
java.util.Enumeration e= request.getHeaderNames();
while (e.hasMoreElements()) {
String headerName=(String)e.nextElement();
System.out.println(headerName +" = "+request.getHeader(headerName));
//System.out.println("Content Type ="+request.getContentType());
DiskFileUpload fu = new DiskFileUpload();
// If file size exceeds, a FileUploadException will be thrown
fu.setSizeMax(1000000);
List fileItems = fu.parseRequest(request);
Iterator itr = fileItems.iterator();
System.out.println("***************************");
while(itr.hasNext()) {
FileItem fi = (FileItem)itr.next();
//Check if not form field so as to only handle the file inputs
//else condition handles the submit button input
if(!fi.isFormField())
System.out.println("\nNAME: "+fi.getName());
System.out.println("SIZE: "+fi.getSize());
//System.out.println(fi.getOutputStream().toString());
File fNew= new File("C:\\", fi.getName());
System.out.println(fNew.getAbsolutePath());
fi.write(fNew);
else
System.out.println("Field ="+fi.getFieldName());
out.println("SUCCESS123456: ");
out.close();
catch(Exception e)
e.printStackTrace();
}Any help on what is wrong.
Thanks -
How to send pdf files from local dir through emails attachments
I have some pdf documents in some directory, I want to send those pdf's as an attachment throu emails to the concerned person.
Please let me know how to attach the files and send through email.
Thanks.You are using Forms 4.5, which is a client/server configuration. When you create a pdf file, the file has to be written to a directory that is accessible from your PC. D:\ is acessible, /tmp/ not (that is a directory on some Unix server). If you want to write files to a Unix server, you have to set up Samba and map a drive from your PC to he Unix directory.
Since you are creating multiple pdf files, you will have to wait until all reports are finished and mail them afterwards. You can create a batch script to mail the files. -
How to send doc files from one system to another using XI
Hi All,
I have a requirement to pick the word doc files from one file system and send these word document files to ECC system place in ECC application server.Can we achieve this requirement using XI. If so how we can do this. also let me know can we convert these doc files into proxy and send to ECC?. Please let me know. Thanks.
Regards,
RajeshYes You Can
XI Converts Unstructured data(That is non -XML)Type- in your case word doc and maps it to Target structure.
You can either use content conversion
/people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
/people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2
/people/venkat.donela/blog/2005/06/08/how-to-send-a-flat-file-with-various-field-lengths-and-variable-substructures-to-xi-30
/people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
/people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter
/people/jeyakumar.muthu2/blog/2005/11/29/file-content-conversion-for-unequal-number-of-columns
/people/shabarish.vijayakumar/blog/2006/02/27/content-conversion-the-key-field-problem
/people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter
You can either built a adaptermodule for the same(U nedd to have Some Java knowledge)
You can also convert without creating any objects in integration directory link for the same is
/people/william.li/blog/2006/09/08/how-to-send-any-data-even-binary-through-xi-without-using-the-integration-repository
***********Please Reward Points If find Helpful********* -
How to send pdf file from iphone 5s to iphone 4s
want to send files from iphone 5s to iphone 4s, tried downloading bluthooth apps but does not send. i dont know how to do it.
It depends, to some extent on the app you're using to view PDFs. It most app, there is a sharing icon (looks like a box with an arrow coming out the top). Tap that, tap Mail and email the PDF.
-
How to read the file from ftp server
Hi
I need to read a file from a ftp server . Iam using apache lib common-net .jar .
FTPClient ftp = new FTPClient();
ftp.connect(server);
ftp.login(username,password);
FTPFile[] files = ftp.listFiles();
for(int i=0 ;i<files.length;i++){
System.out.println(" File : "+ i + " - " + files);
InputStream ip = ftp.retrieveFileStream(path);
I got the inputstream from the ftp server. but iam not able to read the contents of the file ....
help me plzzzzzHi
I have one more problem . first i try to read the file and write the file in local directory . then i try to read the data in the remote file .. iam getting the datas as null.
InputStream ip = ftp.retrieveFileStream(path);
File f = new File("D:\\ftp.txt");
FileOutputStream fo = new FileOutputStream(f);
byte[] buf = new byte[1024];
while ((len = ip.read(buf)) > 0) {
fo.write(buf,0,len);
fo.close();
BufferedReader br = new BufferedReader(new InputStreamReader(ip));
String line;
do {
line = br.readLine();
System.out.println(" data " +line);
}while (line != null); -
hi
i need to create an XML with some values file from Oracle Forms 6.0 and then send this XML file To a URL to access the database,which in turn will send me XML file with new values.Can any body help me out as i don't have any ideas
Regards
SunilSunil,
and this must be using a URL and can't be handled by a database stored procedure ?
Anyway, your scenario can be achieved using teh Java Importer in Forms 6i and above. You woudl write a Java program that takes a String and loads it to an URL. It then checks the response URL for its content.
Frank -
How to send xml file from local folder to azure storage
Hi,
My plan is i have xml files which are under folders in my local.
I want to use mobile service to send xml files to azure storage,
how shall i do that, either by c# or mobile service.
If internet stop, I will use my mobile service to transfer all xml files to azure storage and run web job to do to update azure
sql by xml file.
please advice.
SupermanHi,
You could refer the following link for assistance with uploading image files to Azure Blob Storage using Mobile Services:
http://azure.microsoft.com/en-us/documentation/articles/mobile-services-windows-phone-upload-data-blob-storage/
And for image files you could refer the following link:
http://stackoverflow.com/questions/25977406/upload-a-text-file-with-azure-mobile-services
Regards,
Malar.
Maybe you are looking for
-
Installation of Oracle 8.1.6 on RedHat Linux 7.1
Hello, How are you? I am facing some problem to install Oracle 8.1.6 on my own pc on os Linux 7.1. I can start installer.Its installing but after 72% installation complited than its gives following errors. error in invoking target install of makefile
-
I have a .mov file that plays on my mac but when someone tries to play it on a pc, they get an error 128 message. Help! Please!
-
Terrible customer service.
I'm writing in for my parents, they are in their 80s and technology is difficult at times.Thursday afternoon a tech was installing voice in the unit below my parents. In the process, he knocked out service. I called and was told service would be rest
-
Dear Experts, I am creating LSMW for T.code FB02 to change the document line item Text, but encountered an issue because of difference in line items number per document. Example : Recording document contains only 2 line items, but when trying to clea
-
Smartform open in pdf instead of download
Hi, Is there a way to open a smart form in directly pdf instead of downloading it to a directory using ws_download? Thanks, ~Mark