FM to GET file listing of a UNIX directory.
Hello everyone,
Please can anyone provide me a function module that can return to me ALL the files found inside a UNIX directory. I have tried FM EPS_GET_DIRECTORY_LISTING but I can't seem to provide the correct parameter.
Ryan,
check this program,
REPORT ZFTPSAP LINE-SIZE 132.
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.
*-- Your SAP-UNIX FTP password (case sensitive)
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
*-- Your SAP-UNIX FTP user name (case sensitive)
USER = 'userid'
PASSWORD = MC_PASSWORD
*-- Your SAP-UNIX server host name (case sensitive)
HOST = 'unix-host'
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.
WRITE: / 'Error in FTP Command'.
ENDIF.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
OTHERS = 1.
DATA:
l_pcfile LIKE sapb-sappfad, "Desktop file & path
l_serfil LIKE sapb-sappfad. "Server File & path
l_pcfile = 'D:\Data\temp\input.txt'.
l_serfil = '/tmp/output.txt' .
CALL FUNCTION 'ARCHIVFILE_CLIENT_TO_SERVER'
EXPORTING
path = l_pcfile
targetpath = l_serfil
EXCEPTIONS
error_file = 1
OTHERS = 2.
Don't forget to reward if useful.....
Similar Messages
-
How can I get file list for a given directory?
Hi,
How can I get file list for a given directory? Is there a function?
Thanks.Hi friend,
Try this sample report. It displays all files in a directory.
While executing give some directory name in input. ex: C:\
Mention file type in filter parameter. ex: *.DOC
REPORT ztests.
DATA : file_table LIKE TABLE OF sdokpath WITH HEADER LINE .
DATA : dir_table LIKE TABLE OF sdokpath WITH HEADER LINE .
PARAMETERS:p_dir(50) TYPE c.
CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
EXPORTING
directory = p_dir
filter = '*.DOC'
TABLES
file_table = file_table
dir_table = dir_table
EXCEPTIONS
cntl_error = 1
OTHERS = 2.
LOOP AT file_table .
WRITE:/ file_table-pathname.
ENDLOOP.
Might be helpful...
Thanks.....
Edited by: Guest77 on Feb 11, 2009 5:30 AM -
Get file list from URL/web directory
Hey guys,
I have created a script for After Effects that can download multiple images from URLs that are given in an array. Now ideally what I want, is to get all the filenames of the files in a certain browsable web directory to be put in an array.
Unfortunately, I can't seem to figure out how to do this. Does someone have the knowledge here to help me out?
Thanks in advance,
JorgeThis is more difficult to do than it seems. Since the files are on a remote web server, you need to find some way to get the server to divulge its local file structure, which is not something most servers will do. The absolute best way is to have control over the web server and run some server-side code (PHP, node.js, whatever) to generate the file list on the server side and then fetch it with your client/extension/script. Other than that it's almost impossible to get a 3rd party server to divulge its file structure as far as I know, mainly for security reasons. So the #1 question is: do you have control over the server/website that you're trying to fetch from or not?
-
Does anyone have experience with this issue when connecting to a Linux FTP Web Server running a FTP Site?
"Connection Error - Failure to get file list from server. An entry with the same key already exists."
I cannot access the root directory of the ftp file server using Web Matrix 3. The site is .php based, and
is accessible when connecting with FileZilla or Remote Connecting via FTP with Visual Studio.
All sites have been deleted from Web Matrix, the user Application Data has been cleared and Web Matrix has been reinstalled.
Issue Persists....
Thanks in advance,
JustinTurns out that the program leaves metadata in your app data folder that is not removed upon uninstallation of the software.
This is incorporated to communicate with a file that uploaded into the ftp directory when publishing pages. -
PREPARE UPLOAD_REQUEST CANNOT GET FILE LIST
Hello all,
In the PREPARE, phase UPLOAD_REQUEST, received error 'CANNOT GET FILE LIST OF '..EPS\in.. folder.
Log UPLOADREQ.LOG has the followin. Search in SDN and SAP did not get any result.
1 ETQ201XEntering upgrade-phase "UPLOAD_REQUEST" ("20081126150332")
2 ETQ367 Connect variables are set for standard instance access
4 ETQ399 System-nr = '60', GwService = 'sapgw60'
4 ETQ399 Environment variables:
4 ETQ399 dbs_db2_schema=SAPR3
4 ETQ399 auth_shadow_upgrade=0
4 ETQ399 Directory 'd:\usr\BZ3put\eps' not found.
4 ETQ399 Skipping copy of OCS packages.
2 ETQ730 Starting upload of all package files in "
ustcf001\patches\EPS\in"
4 ETQ010 Date & Time: 20081126150339
4 ETQ230 Starting RFC Login to: System = "BZ3", GwHost = "ustwa356", GwService = "sapgw60"
4 ETQ359 RFC Login to: System="BZ3", Nr="60", GwHost="ustwa356", GwService="sapgw60"
4 ETQ232 RFC Login succeeded
4 ETQ233 Calling function module "SPDA_PREPARE_PATCH" by RFC
4 ETQ234 Call of function module "SPDA_PREPARE_PATCH" by RFC succeeded
4 ETQ239 Logging off from SAP system
4 ETQ010 Date & Time: 20081126150339
2 ETQ731 Upload failed, rc = "1", reason = "CANNOT GET FILE LIST OF
ustcf001\patches\EPS\in"
2 ETQ730 Starting upload of all package files in "
ustcf001\patches\EPS\in"
4 ETQ010 Date & Time: 20081126151823
4 ETQ230 Starting RFC Login to: System = "BZ3", GwHost = "ustwa356", GwService = "sapgw60"
4 ETQ359 RFC Login to: System="BZ3", Nr="60", GwHost="ustwa356", GwService="sapgw60"
4 ETQ232 RFC Login succeeded
4 ETQ233 Calling function module "SPDA_PREPARE_PATCH" by RFC
4 ETQ234 Call of function module "SPDA_PREPARE_PATCH" by RFC succeeded
4 ETQ239 Logging off from SAP system
4 ETQ010 Date & Time: 20081126151823
Hope anyone can help, thanks in advance.
Thanks and regards
TerryI tried to load the packages via SPAM, and got the following - does it mean I have corrupted EPS/in?
Could not create file list
Message no. PS 012
Diagnosis
A list of the required files could not be created as an error occurred.
Directory:
ustcf001\patches\EPS\in
File mask:
Error code: 17
Definition of error codes:
03 RFC system failure
04 RFC communication failure
11 invalid EPS subdirectory
12 sapgparam failed
13 build directory failed
14 no authorization
17 read directory failed
18 read attributes failed
22 too many read errors
23 empty directory list
System Response
The operation was terminated.
Procedure
Eliminate the cause of the error and repeat the operation. -
Java does not get file list from shared folder in another server.
Hi,
I'm using java 1.4.2.16,
Command below does not get file list.
import java.io.;*..
File file = new File("\\\\10.242.22.28\\SapMII");
File[] files = file.listFiles();
SapMII folder is Everyone full Control permission.
How can i solve this problem?
Thanks.Could you please post replies in a more helpful way? Just informing me that it was an NPE doesn't really tell me anything. Post the stacktrace (Exception#printStackTrace()). And the listFile() methods API has this to say:
Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.I'm able to run this sample code easily:
import java.io.File;
public class TestFileList {
public static void main(String[] args) {
File file = new File("\\\\10.40.55.33\\shared");
File [] files = file.listFiles();
for(File currentFile: files )
System.out.println(currentFile.getName());
} -
FTP Get File List Action Block, It's double listing files! ver 11.5
Hi guys.. I have a good one! I have an FTP Get File List action block in my BLS transaction. Occasionally, it double lists the files in its output. For testing I put a repeater with a logevent output where I log the filename, date, and size. Heres what I saw for my action block output.
2009-02-13 00:38:00,963 [UserEvent] : File Name: DMM_Export_0010056.txt, File Date 2009-02-13T00:36:00, File Size 339
2009-02-13 00:38:00,963 [UserEvent] : File Name: DMM_Export_0010056.txt, File Date 2009-02-13T00:36:00, File Size 339
This is xMII version 11.5.6 b73 with java 1.4.2_07
I have a workaround by putting in a distinct action block, after the filelist, but anybody have an idea why this might happen? My theory is that something might be occuring if the file is being written to while we try to process it, but not sure.
I've been building BLS parsers since 2003, (Remember those fun times with Jeremy?) I've never seen this happen.My example is a sample log file before the distinct action. The general log shows nothing other than the subsequent transaction errors I get as a result of running the same error twice (Tcode return from BAPI calls etc)
Here is something else interesting.. my userlog file is acting funny, like its trying to write on top of itself. could it be the transaction is actually running twice or parts of it?
For example look at the following log entries
This is how my log file entry for a production confirmation should look
2009-02-13 00:38:06,854 [LHScheduler-Int10_NestingWOProdConf] INFO UserLog - [UserEvent] :
However sometimes... its looking like this...
2009-02-13 2009-02-13 00:38:11,854 [LHScheduler-Int10_NestingWOProdConf] INFO UserLog - [UserEvent] :
Like it started writing to the log, then started again.
The problem we are having is that we have JCO calls to SAP in this transaction that does goods movement, we get locking / block errors back from our saying that we (our sap account) is already updating the information. Sometimes the information would be posted twice! You can see how this has become a HUGE issue posting data to a LIVE system twice.
This is happening on 2 xMII servers. -
Get the file list of a given directory
does anyone know how to get the file list of a given directory? I tried "list"/"filelist" but the class not found.
THanks!What made you assume that there exist classes called list or filelist etc.
Do you read API documentation etc ?
Anyways, here is a hint java.io.File.listFiles() -
Function Module To read all the Files in a Given UNIX directory.
Can anyone provide me with a FUNCTION MODULE which reads all the files available in a UNIX directory?
I have the UNIX directory given. I need to find all the files available in that particular Directory so that I can choose and process accordingly. Probably I can store all files in an Internal Table.
Thanks in advance.
SunilHi Nick,
Thankyou very much for the response.
The Function Module /SAPDMC/LSM_F4_SERVER_FILE is interactive wherein we can select only one file.
But my requirement is I need to collect (probably in an internal table) all the files exixting in the given UNIX directory.
Can you please find in that direction. I would be very grateful.
Thanks.
Sunil -
hi,
i'm having some problems getting the list of files into a vector, all the images are .jpg stored in a directory called ads under the classes directory, where all the .class files are stored. here is what i have so far:
File directory = new File("/ads");
System.out.println(directory.getAbsolutePath());
File[] ads = directory.listFiles();
if(ads!=null) {
for(int i = 0; i < ads.length; i++) {
System.out.println("Files are: " + ads);
else {
System.out.println("Empty directory");
i have images in the ads directory but i always prints out empty directory, i am using sdk 1.4.
Thanks.In Windows, preceeding the directory name with a "/" means go to the root directory. Say you are on the "C" drive it would look for a directory named "C:/ads". Not sure how it works on Unix.
Try:
File directory = new File("ads");
This will look for a directory "ads" in the current directory. -
Why I just get file list?
hi,I compiled j2ee tutorial example hello3,I deploy it by asant and config it by deploytool,when connect from IE(http://localhost:8080/hello3),I just get a file list,when I click the greeting.jsp,I get the web content displayed,everything likes fine.I just want know why I got file list(I got same situation with other example).
thanks advance!
davidYou can make a screenshot picture of each page of the list right from Preview, via
File menu>Grab>Selection
drag over the list and let go.
The resulting tiff file snapshot on the desktop (and itself now open in Preview) is readable and printable, but since it is an image, it is not editable or copyable as text.
If you really need editable text , and if you also have an OCR program that might have come free with a scanner, then.. (ugh..)
(Yes, it's not only a kludge, but a really BAD one! There's got to be a better way.. ) -
Hi,
How can i get the files liste in a directory from forms ? I want to know all the files in c:\my_dir\
Thanx
HeromeThanks but my form must run on different environement and dir will not return the same output to my_file.txt ! Is there any other "cleaner" way to do the job ?
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Dino ([email protected]):
U can use Host command. I.e.
Host ('dir c:\my_dir > my_file.txt');
and then u can read this ascii file.
Hope this helps.
Bye Dino<HR></BLOCKQUOTE>
null -
Get File List From webserver!
hello !
I want to get the list of files residing in webserver.Actually these files r image files and i want to show thumbnails of these images to the user for selection. Please Help..Unless the webserver is poorly secured and allows directory browsing you're not going to get it.
-
Get file list of directory files from URL ?
Hello,
GIven a URL directory, I would like to get a list of all the files in that URL directory:
url = new URL("http//www.example.com");
c = url.getContent();
// Suppose there is a file http://www.example.com/myfile.txt
// How do I get a list from c?
Essentially, I want something equivalent to the File "list" method
file = new File("H:/tmp");
list = file.list()
Thanks in advanced.Crosspost: http://forum.java.sun.com/thread.jsp?thread=518669&forum=17&message=2475782
-
Get file list from directory(t.code: AL11).
Hi Frnds,
i need to get the list of file for particular directory from t.code AL11,
is there any Function Module to display the list of File from the directory in executable program,
i have directory like '/home/im3/hrintf/processed/..... ' and now i need to get the list of file from that directory,
the list is available in t.code AL11( standard program :RSWATCH0 ).
pls suggest me with relevant FM or relevant logic.
Thank you.
Regards
Ramesh MHi
use this code i have checked its working fine
Data:
w_itab type table of EPSFILI,
w_dirnam type EPSF-EPSDIRNAM.
w_dirnam = 'C:\usr\sap\E6S\DVEBMGS00\work'.
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
dir_name = w_dirnam
* FILE_MASK = ' '
* IMPORTING
* DIR_NAME =
* FILE_COUNTER =
* ERROR_COUNTER =
tables
dir_list = w_itab
* EXCEPTIONS
* INVALID_EPS_SUBDIR = 1
* SAPGPARAM_FAILED = 2
* BUILD_DIRECTORY_FAILED = 3
* NO_AUTHORIZATION = 4
* READ_DIRECTORY_FAILED = 5
* TOO_MANY_READ_ERRORS = 6
* EMPTY_DIRECTORY_LIST = 7
* OTHERS = 8
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
write: 'test'.
Thanks
Viquar Iqbal
Maybe you are looking for
-
How can I print from my ipad2 to my hp 6210 all in one using printopia? I see my printer on my iPad, I select it and say print and nothing happens. The printer is connected to an older Mac with OS X 10.4.11 but I do have an imac in another room. I ha
-
A logical question about why we update firmware
just being real here we all like the latest and greatest products, especially mobiles, and we all know they have their share of isues. but yet still we buy even though the device we owned previously worked fine or almost something like 90%. the quest
-
How do you install scanners?
I have an Epson NX105 printer/scanner attached to my Airport Express. I don't know how to use the scanner on this device. I downloaded the scanner driver from the Epson site and installed it. When I go to HELP, it tells me to go to Apple>System P
-
EGrace AIM invoice form is failing with FRM-92101
I had a form named AIM invoice form; it contains all AIM invoices. In the form there are five different sub forms called "Header, Items, Texes, Terms, and Messages". When ever I search a specific invoice it will shows the header details of invoice. T
-
Best calendar for iphone 5 sync with Windows vista ?
I use windows vista at home/work. I need a new calendar/software ( eg Outlook ), and am considering purchasing the iphone5 as well. Which software do you recommend for windows vista that will easily sync back and forth with the iphone 5 ?