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: 

UNIX file wildcard

Former Member
0 Kudos

Hi all,

I am developing a program that has the functionalities of uploading and downloading files to UNIX.

Is this scenario possible?

If I enter the filename with an asterisk, (wildcard search)

it will return all matching files in that directory, preferably in a pop up dialog like when choosing a file from PC

(and possibly allow the user to choose the right file from the list...)

example:

input: /tmp/file*

will return:

/tmp/filename

/tmp/file23

/tmp/file_abcde

If so, how do i code this? or is there an FM for this?

4 REPLIES 4

Former Member
0 Kudos

Hello,

As far as I know, there is no standard popup in order to display a list of files coming from UNIX (the popup for files on desktop use the client GUI, but this can not be used for server files).

But you can code this easily. In order to retrieve the list of matching files under UNIX, you can use :


PARAMETERS : p_file TYPE fileextern. " This should be case-dependant

DATA : ld_command TYPE text255. " becareful, this can not be a STRING 
DATA : lt_result TYPE STANDARD TABLE OF text255.

CONCATENATE 'ls -a' p_file 
  INTO ld_command 
  SEPARATED BY space.

CALL 'SYSTEM'
  ID 'COMMAND' FIELD ld_command
  ID 'TAB'     FIELD lt_result[].

Best regards,

Samuel

Former Member
0 Kudos

Hi Samuel, I haven't tested this yet, thanks for the response,

i'll get back to you when i've done it.

Former Member
0 Kudos

hi samuel, I've tested it and it works.

will still have to work on the pop up...

thanks!

Former Member
0 Kudos

Silly me, I was already using FM /SAPDMC/LSM_F4_SERVER_FILE prior to posting this question.

Anyways, for future reference, If anyone should ever need this info.

I used a combination of FMs,

but the general idea is this:

FM DYNP_VALUES_READ for reading the value on the screen field, since this is still Value Request, the text you type on the text field wont be saved in your parameter yet.

FM PFL_CHECK_DIRECTORY to check if directory exists. this section can be taken out depending on the req't. i used this for error trapping thus preventing dumps.

FM /SAPDMC/LSM_F4_SERVER_FILE,, apparently the reason why it wasn't worknig the first time is because of the type. I used w_directory and w_filename of type string. it wouldnt work. changed the type to text255, it works.