Application Development and Automation 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: 
Read only

Retrieve files from application server

itabhishek9
Participant
0 Likes
916

Hello SDNites,

I have to retrieve all the files from the application server corecponding to a predefined path.

I have tried using FM RZL_READ_DIR_LOCAL and am getting the output but one of my file name length exceeds the limit set of 32 chars and hence does not retrieve the entire file name. My file name lenth is 36 chars. Can someone help me in this.

I tried creating custom FM of this standard FM but it does't work as there is some SAP system statement,

CALL 'ALERTS' ID 'ADMODE' FIELD AD_RZL

ID 'OPCODE' FIELD RZL_OP_RD_DIR

ID 'FILE_NAME' FIELD FULL_NAME

ID 'DIR_TBL' FIELD LINE_TBL-SYS.

Can someone help me in resolving the above specified issue.

Reagards,

Abhishek

3 REPLIES 3
Read only

MarcinPciak
Active Contributor
0 Likes
701

Hi,

Use below snippet. You will get up to 40 char path name


PARAMETERS: pa_dir TYPE epsf-epsdirnam VISIBLE LENGTH 60 OBLIGATORY,  "max 60 chars as input path

DATA: BEGIN OF dir_list OCCURS 0.
        INCLUDE STRUCTURE epsfili.
DATA END OF dir_list.

CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
    EXPORTING
      dir_name               = pa_dir
    TABLES
      dir_list               = dir_list       "here is your result set, it will return max 40char dir name, so will suffice for you
    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 'No such directory' TYPE 'I' DISPLAY LIKE 'E'.
    LEAVE TO SCREEN 0.
  ENDIF.

Regards

Marcin

Read only

itabhishek9
Participant
0 Likes
701

Thanks for the repy,

I am entering my directory physaical path but still am not getting any values.

Read only

0 Likes
701

pa_dir here is an Application Server path like i.e /usr/sap/trans . It's case sensitive so please ensure that you give right name.

It will return all files in that path in table parameter dir_list

Regards

Marcin