FTP server file reader
Hai,
I want to read the files present in FTP server without downloading.
Using (org.apache.commons.net.ftp.*); this package I can view the files and directories present in particular host and can even download.
But I want to read the files in directories without downloading them for displaying the file contents in my JApplet.
How can I achieve this?
Waiting for reply...
Dhurai
this is the wrong forum for such q.
Similar Messages
-
In FTP server file not storing in proper order when 'FTP_R3_TO_SERVER'
Dear ,
when i used FTP_R3_TO_SERVER to download data in FTP server
i checked in FTP server file is not storing in proper order in FTP server . plz help how to get the file in proper order .it urgent . full points must be given. i given code below .
DATA : BEGIN OF iresult OCCURS 5,
rec(450),
END OF iresult ,
DATA :
dest LIKE rfcdes-rfcdest VALUE 'SAPFTP',
compress TYPE c VALUE 'N',
host(64) TYPE c.
DATA: hdl TYPE i.
DATA: BEGIN OF result OCCURS 0,
line(100) TYPE c,
END OF result.
DATA : key TYPE i VALUE 26101957 ,
dstlen TYPE i,
blob_length TYPE i.
host = p_host .
DESCRIBE FIELD p_password LENGTH dstlen IN CHARACTER MODE.
CALL 'AB_RFC_X_SCRAMBLE_STRING'
ID 'SOURCE' FIELD p_password ID 'KEY' FIELD key
ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD p_password
ID 'DSTLEN' FIELD dstlen.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = p_user
password = p_password
host = host
rfc_destination = dest
IMPORTING
handle = hdl
EXCEPTIONS
not_connected = 1
OTHERS = 2.
IF sy-subrc = 0.
CONCATENATE 'cd' ftppath INTO ftppath SEPARATED BY space .
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = hdl
command = ftppath
TABLES
data = result
EXCEPTIONS
command_error = 1
tcpip_error = 2.
IF sy-subrc = 0 .
CLEAR result .
REFRESH result .
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = hdl
command = 'ascii'
TABLES
data = result
EXCEPTIONS
command_error = 1
tcpip_error = 2.
IF sy-subrc = 0 .
DESCRIBE TABLE iresult LINES lines.
blob_length = lines * width .
clear : lines.
Delete the existing file
CONCATENATE 'del' ftpfile INTO delfile SEPARATED BY SPACE.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = hdl
command = delfile
TABLES
data = result
EXCEPTIONS
command_error = 1
tcpip_error = 2.
*End of deleting the existing file
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
handle = hdl
fname = ftpfile
blob_length = blob_length
TABLES
blob = iresult
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF sy-subrc 0 .
WRITE 'Error in writing file to ftp' .
ELSE.
WRITE 'File downloaded on the ftp server successfully'.
ENDIF.
ENDIF.
ELSE.
WRITE : 'Path on ftp not found : ' , ftppath .
ENDIF.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
handle = hdl.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = 'SAPFTP'
EXCEPTIONS
OTHERS = 1.
ELSE.
WRITE 'Could not connect to ftp' .
ENDIF.
ENDFORM. " FTPFINANCEACCESS_DOWNLOAD
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'PASSWORD'.
screen-invisible = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Edited by: manoj kv on Feb 27, 2008 12:55 PM
Edited by: manoj kv on Feb 28, 2008 5:37 AM
Edited by: manoj kv on Feb 28, 2008 5:39 AM
Edited by: manoj kv on Mar 5, 2008 2:15 PM
Edited by: manoj kv on Mar 7, 2008 12:51 PMHello,
Did you try to put 'X' to the parameter CHARACTER_MODE.
Hope it will help you
Olivier -
Reading and transfering FTP server files
Hi Everybody,
I will be really thankful if anybody can guide me for following-
1. How to read/access a file on FTP server ?
2.How file on FTP sever can be downloaded on presentation server?
Thanks.Hi ,
Check Function Group SFTP from se80.
Check this post.
http://wiki.sdn.sap.com/wiki/display/ABAP/WorkingwithFTP+Server -
Hi Experts,
I need to place the file in "C:/CacheSys/PI" in FTP server.
what is the target directory i must specify in Communication channel.
Kind Regards,
kiranHi
you can use the same name in the target directory.
but the folder that you create should be on the same path.
C:/CacheSys/PI
go to c: dir , then go to Cachesys then go to PI and put the file in this folder.
if you still face the problem please reply me back.
Thanks
Rinku -
Multiple FTP server files for sender File adoptor
Hi,
we have a requirement to pick files from different FTP servers and send it as a proxy message to ECC.File structure format for both FTP server locations is same and I need to send as a same proxy message.
Please let me know how to achieve this. Thanks.
Regards,
RajeshHi Rajesh,
Here you are having two FTP Server to pick the files so that you need to create below list of objects.
For two different FTP Server you need to create two different sender systems
2 sender File channels
2 sender agreements
2 receiver determinations
2 interface determinations(use single inbound interface in both interface determinations)
2 receiver agreement
If you want to use single sender then
2 sender File channels
2 sender agreements
2 receiver determinations
2 interface determinations(use single inbound interface in both interface determinations)
1 receiver agreement
thanks,
madhu -
FTP server permissions "Read Only"
I manage my own website, and would like to use Finder as my FTP medium. I can log into it, and download from it, but I cannot write to it. I have web admin privileges, but I'm unable to UPload to my ftp server.
It runs on the basic port 21, and has run normally in the past, but this is the first time that I've tried to mount it as a volume on a mac.
This way would be so much easier to use than the FTP online protocol that I use.
Thanks in advance,
Superd@veHi, yes,FTP is Read only in the finder in .4. at least.
You can use Terminal commands or a free FTP client such as Cyberduck to get both R&W rights..
http://cyberduck.ch/ -
Incorrect entries from application server file read dataset .
As i am using below code for fetching file data from application server to internal table in custom report.
data in internal table in inconsistent is there any another way to do in?
report zparoman.
TYPES: BEGIN OF ty_bkpf, " STRUCTURE DEFINATION bkpf
belnr TYPE belnr_d ,
bukrs TYPE bukrs,
gjahr TYPE gjahr,
bldat TYPE bldat,
cpudt TYPE cpudt,
waers TYPE waers,
blart TYPE blart,
budat TYPE budat,
xblnr TYPE xblnr1,
bktxt TYPE bktxt,
END OF ty_bkpf.
DATA: it_bkpf TYPE STANDARD TABLE OF ty_bkpf INITIAL SIZE 0, " INTERNAL TABLE it_BKPF
wa_bkpf TYPE ty_bkpf. " work area wa_bkpf
TYPES: BEGIN OF ty_bseg,
belnr TYPE belnr_d,
bukrs TYPE bukrs,
buzei TYPE buzei,
bschl TYPE bschl,
umskz TYPE umskz,
hkont TYPE hkont,
zterm TYPE dzterm,
wrbtr TYPE wrbtr,
kostl TYPE kostl,
prctr TYPE prctr,
mwskz TYPE mwskz,
sgtxt TYPE sgtxt,
zuonr TYPE dzuonr,
zlspr TYPE dzlspr,
zlsch TYPE schzw_bseg,
END OF ty_bseg.
DATA: it_bseg TYPE STANDARD TABLE OF ty_bseg INITIAL SIZE 0, "internal table it_bseg
wa_bseg TYPE ty_bseg. "work area wa_bseg
TYPES:BEGIN OF ty_final, " final structue defn
header TYPE c LENGTH 3,
belnr TYPE c LENGTH 10,"belnr_d,
bukrs TYPE c LENGTH 4,"bukrs,
gjahr TYPE c LENGTH 4,"gjahr,
bldat TYPE c LENGTH 8,"bldat,
cpudt TYPE c LENGTH 8,"cpudt,
waers TYPE c LENGTH 5,"waers,
blart TYPE c LENGTH 2,"blart,
budat TYPE c LENGTH 8,"budat,
xblnr TYPE c LENGTH 16,"xblnr1,
bktxt TYPE c LENGTH 25,"bktxt,
buzei TYPE c LENGTH 3,"buzei,
bschl TYPE c LENGTH 2,"bschl,
umskz TYPE c LENGTH 1,"umskz,
hkont TYPE c LENGTH 10,"hkont,
zterm TYPE c LENGTH 4,"dzterm,
wrbtr TYPE c LENGTH 13,"wrbtr,
kostl TYPE c LENGTH 10,"kostl,
prctr TYPE c LENGTH 10,"prctr,
mwskz TYPE c LENGTH 2,"mwskz,
sgtxt TYPE c LENGTH 50,"sgtxt,
zuonr TYPE c LENGTH 18,"dzuonr,
zlspr TYPE c LENGTH 1,"dzlspr,
zlsch TYPE c LENGTH 1,"schzw_bseg,
END OF ty_final.
DATA: it_final TYPE STANDARD TABLE OF ty_final INITIAL SIZE 0, " final internal table it_final
wa_final TYPE ty_final. " work area wa_final
TYPES: BEGIN OF temp_str,
wa_string(5000) TYPE c,
END OF temp_str.
DATA:it_str TYPE TABLE OF temp_str,
wa_str TYPE temp_str.
DATA: gv_file TYPE rlgrap-filename.
gv_file = 'E:\USR\SAP\ECS\SYS\CSL_FIGL_TRANS_DATA_04172014162215.TXT'.
OPEN DATASET gv_file FOR INPUT IN TEXT MODE ENCODING DEFAULT. "Opening file from Application server
IF sy-subrc EQ 0.
* DO 2 TIMES.
DO.
READ DATASET gv_file INTO wa_str.
IF sy-subrc = 0.
APPEND wa_str TO it_str.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
* WRITE:/ 'HELLO'.
LOOP AT it_str INTO wa_str.
split wa_str at ' ' into
wa_final-header
wa_final-belnr
wa_final-bukrs
wa_final-gjahr
wa_final-bldat
wa_final-cpudt
wa_final-waers
wa_final-blart
wa_final-budat
wa_final-xblnr
wa_final-bktxt
wa_final-buzei
wa_final-bschl
wa_final-umskz
wa_final-hkont
wa_final-zterm
wa_final-wrbtr
wa_final-kostl
wa_final-prctr
wa_final-mwskz
wa_final-sgtxt
wa_final-zuonr
wa_final-zlspr
wa_final-zlsch.
" Split the string separated by SPACE
append wa_final to it_final.
ENDLOOP.Hi ,
Try to open the file with encoding UTF-8 :
Open dataset file for INPUT in TEXT MODE ENCODING UTF-8 .
Regards -
E4200 - Anonymous ftp server read and write
Hello,
Is there any possibility to set linksys E4200 for support anonymous acces to ftp server in read and write mode ?
Thanks,
BR, Mariusz.Nope, just anonymous read access only, according to the options they give you. 192.168.1.1--->storage--->administration----> anonymous FTP access (enabled)
I don't work for Cisco. I'm just here to help. -
XI cannot act as an FTP server
Hi All,
I have doubt on XI, Is XI operate as an FTP Server (i meen XI done not function as an FTP server)? pls give me some Links on this
Thanks in advance,
Venkat.Hii
XI can very well used as an FTP server
XI as a FTP server only
Use of SAP XI as "on demand" FTP Server
XI in the role of a FTP
Similar Threads:
Using XI as FTP without mapping
Use of SAP XI as "on demand" FTP Server
Using XI as a FTP Server ?
Re: Using XI as a FTP Server ? -
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); -
Problem while reading the file from FTP server
Hi Friends,
I have a problem while fetching files from FTP server.
I used FTP_Connect, FTP_COMMAND function modules. I can able to put the files into FTP server.
but I cant able to pick the files from FTP server.
anyone have faced similar issues kindly let me know.
Thanks
GowrishankarHi,
try this way..
for reading the file using FTP you need to use different unix command ..
Prabhuda -
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. -
Reading a file from ftp server
Hi
I am able to put file on ftp server using ftp adapter.But same settings are not working while polling file on ftp.
Do i need to do some settings for get operation??Hi,
Check the file permissions and for testing give all read/write/execute permissions to the file to be read from FTP. Also check the file modification date of the file.
Check for the logs at 2 places for any error messages:
- SOA server diagnostics logs
- FTP server logs
You can also enable the FINEST level of Adapter logs for adapters and see for the detailed errors in the diagnostic logs.
FMW Console > right click soa-infra > Logs > Log Configuration > expand oracle.soa > set Trace32 : FINEST for oracle.soa.adapter
Regards,
Neeraj Sehgal -
Reading file from ftp server and importing data into table
Hi experts,
Well basically i have text files with different layout that have been uploaded on an ftp server. Now i have to write a procedure to fetch those files, read them and insert data in a table... can that be done?
your precious help would be greatly helpful.
Thanksdeclare
file1 UTL_FILE.FILE_TYPE;
filename varchar2(1000) := 'GTECHFILES';
str long;
begin
file1 := UTL_FILE.FOPEN (filename,'agent_dump_csv.rep','r',32767);
loop
UTL_FILE.GET_LINE ( file1, str );
--dbms_output.put_line('Value is :'||to_char(str));
end loop;
UTL_FILE.FCLOSE( file1 );
exception
when no_data_found then
dbms_output.put_line('END OF FILE');
UTL_FILE.FCLOSE( file1 ) ;
when others then
UTL_FILE.FCLOSE( file1 ) ;
dbms_output.put_line('ERROR: '||sqlcode||':'||sqlerrm) ;
end;
i have managed to write this piece of code and all lines are being read and now i need to insert data into my table and the fields are seperated by a `|` i am strill trying to figure how to do that now. help ...
Edited by: Kevin CK on 17-Jan-2010 22:40
Maybe you are looking for
-
Doesn't work after upgrade to leopard
I recently upgraded my iMac G5 to Leopard, and had been running GarageBand 2 since I got the computer. After upgrading, when I try to work on a song, none of the tracks show up. Usually one or maybe two will be visible, and when I create new tracks,
-
Excessive heat on 1.67Ghz G4 Powerbook
I have always noticed the bottom of the Powerbook to be extremely hot, particularly when plugged in to the AC adapter. I've been told by various Apple technicians that this is a characteristic of the higher processor speed of the Powerbook G4. Has
-
Publishing an acquired app under its "original" name/id?
Hello everyone, I'd like to discuss a question that came up in my mind and that I couldn't find an answer on the inet. Let's say company B has published a good running iOS app, that company A acquires from B. Company A is interested in keeping the ap
-
I've not been able to burn a playlist in the correct order. It's an entire album i bought and downloaded off of itunes. I have it sorted correctly in itunes, random is off. I've looked at a number of blogs on this, and nothing has resolved it so f
-
Macbook shutoff is a bad battery issue - free replacements offered
MacBook and MacBook Pro Battery Update 1.2 Apple has recently discovered that some batteries used in its MacBook and MacBook Pro notebooks may have battery performance issues. Apple is offering a software update that is designed to address these issu