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: 

How to get the list of files from the application server

Former Member
0 Kudos

I need the list of files in the application server available in a path...

Format of application file is /usr/.../zprogram_datetime...

I need to retrieve all files and then read data from the required dataset ...

Eg: I need to search for date: 26/09/2007

time : not mandatory..

Then I should get list of application server files path..eg.

/zprog_26092007093435---at 9:34 (time)

/zprog_26092007103020--at 10.30 (time)..

Then do some manipulations to open the required dataset...

I need a function module which can give list of files available in a directory....

4 REPLIES 4

Former Member
0 Kudos

DATA: L_DIRNAME LIKE EPSF-EPSDIRNAM,

L_FILEMASK LIKE EPSF-EPSFILNAM,

CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'

EXPORTING

dir_name = l_dirname

file_mask = l_filemask

  • IMPORTING

  • DIR_NAME =

  • FILE_COUNTER =

  • ERROR_COUNTER =

TABLES

dir_list = pi_filelist

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

.

****************************************************

FM '/SAPDMC/LSM_F4_FRONTEND_FILE' for fetching the data from the application server path/presentation server path

Tables

FM F4_dxfilename_toprecursion F4 help of application file.

*****************************************

You can use the FM 'F4_DXFILENAME_TOPRECURSION'

CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'

EXPORTING

I_LOCATION_FLAG = 'A'

I_SERVER = ' '

I_PATH = '/usr/users/'

IMPORTING

O_PATH = L_PATH

ABEND_FLAG = L_ABEND_FLAG

EXCEPTIONS

COMMUNICATION_FAILURE = 1

SYSTEM_FAILURE = 2

RFC_ERROR = 3.

IF SY-SUBRC EQ 0.

P_FILE = L_PATH.

ENDIF.

************************************

refer.

************************************

Regards

Vasu

varma_narayana
Active Contributor
0 Kudos

Hi..Lavanya..

Try this..

PARAMETERS : P_FILE(40).

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_afile.

CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'

EXPORTING

directory = './'

IMPORTING

serverfile = p_afile

EXCEPTIONS

canceled_by_user = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

then u wil get f4 help for application server.

<b>reward if Helpful.</b>

0 Kudos

check..

PARAMETER: p_fdir            type pfeflnamel DEFAULT '/usr/sap/tmp'.

data: begin of it_filedir occurs 10.
        include structure salfldir.
data: end of it_filedir.


************************************************************************
*START-OF-SELECTION
START-OF-SELECTION.
* Get Current Directory Listing for OUT Dir
  call function 'RZL_READ_DIR_LOCAL'
       exporting
            name     = p_fdir
       tables
            file_tbl = it_filedir.

* List of files are contained within table it_filedir
  loop at it_filedir.
    write: / it_filedir-NAME.
  endloop.

Former Member
0 Kudos

Thanks a lot folks!!!

It's solved!!!

'RZL_READ_DIR_LOCAL' is the function module apt to my situation...

Regards,

Lavanya....