Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

FTP_COMMAND directory listing (ls/dir) without details

afordham
Participant
0 Kudos

Hi,

Our SAP system is accessing an FTP server which has some files with very long names on it.  When using function module FTP_COMMAND to get the directory listing, using either "ls" or "dir", we get the "ls -l" type listing with permissions, usernames, etc. so the end of the filename is getting cut off. This would appear to be because SAP truncates everything in the return over 100 characters.  As a result, I can't use this data to "get" the files, as the filename is incomplete.   I can use "mget" to get all the files that match a certain pattern, but the output from "mget" doesn't tell you the names of the files that it's downloaded.

This is a batch program, so we're using the RFC destination SAPFTPA.

Is there a way of getting just the filenames, without the permission/user details, when using FTP_COMMAND.  Alternatively, is there any way of getting the filenames returned with an "mget" command?  I've been looking at various command options on Windows FTP clients, but SAPFTPA seems to behave quite differently and ignore most of the options.  I've tried using "verbose off" - this makes no difference to the output from "ls" and but stops the output from "mget" completely, which is pretty much the opposite of what I was after!

Thanks,

Andrew

2 REPLIES 2

shipra_verma6
Explorer
0 Kudos

You should use 'nlist' command instead of 'ls' command.

juan_suros
Contributor
0 Kudos

Your problem is coming from the implementation of the FTP server used by your target machine.

Function Module FTP_COMMAND is sending your commands, exactly as you type them, to the FTP server. You only have control over the client side of the FTP transaction.The server's response is entirely controlled by its own software.

It must be possible to set the simplified version of the ls display as the default, but you will need to do it in the remote system.