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

Reading a directory from App.server

Former Member
0 Likes
1,309

Hi experts,

I know there is a FM to read a directory from App.server

is RZL_READ_DIR_LOCAL and RZL_READ_DIR. It uses a structure FILE_TBL of type SALFLDIR.This contains a field called "Name" of 32 characters.Suppose if a file in App.server contains more than 32 characters will this FM reads that?I think it reads that but the extension of file or some part of file will miss.So after reading that if read from that file using read dataset which does't conatins extension because of size of that field will it read?...

Can any body tell me What is the alternative for this?

1 ACCEPTED SOLUTION
Read only

anversha_s
Active Contributor
0 Likes
747

Hi,

you can use the follow code:

REPORT zdirtest.

DATA lv_dir TYPE rsmrgstr-path VALUE '/usr/sap/trans/data'.

DATA: wa_files TYPE rsfillst,

it_files LIKE TABLE OF wa_files.

START-OF-SELECTION.

CALL FUNCTION 'SUBST_GET_FILE_LIST'

EXPORTING

dirname = lv_dir

filenm = '*'

TABLES

file_list = it_files

EXCEPTIONS

access_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

WRITE /1 'Error! :-('.

ELSE.

LOOP AT it_files INTO wa_files.

WRITE: /1 wa_files-name,

wa_files-len.

ENDLOOP.

ENDIF.

rgds

anver

Hi experts,

I know there is a FM to read a directory from App.server

is RZL_READ_DIR_LOCAL and RZL_READ_DIR. It uses a structure FILE_TBL of type SALFLDIR.This contains a field called "Name" of 32 characters.Suppose if a file in App.server contains more than 32 characters will this FM reads that?I think it reads that but the extension of file or some part of file will miss.So after reading that if read from that file using read dataset which does't conatins extension because of size of that field will it read?...

Can any body tell me What is the alternative for this?

4 REPLIES 4
Read only

andreas_mann3
Active Contributor
0 Likes
747

hi,

try fm EPS_GET_DIRECTORY_LISTING

A.

Read only

Former Member
0 Likes
747

Use the below FM:

DATA: lcl_directory TYPE char128,

constants: c_mask TYPE char9 VALUE ',.,..'.

lcl_directory = ''/local/data/interface/A28/DM/OUT'.

CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'

EXPORTING

directory = lcl_directory

filemask = c_mask

IMPORTING

serverfile = p_f2

EXCEPTIONS

canceled_by_user = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • MESSAGE e000(zmm) WITH text-039.

  • flg_app = 'X'.

ENDIF.

Regards,

Prakash.

Read only

anversha_s
Active Contributor
0 Likes
748

Hi,

you can use the follow code:

REPORT zdirtest.

DATA lv_dir TYPE rsmrgstr-path VALUE '/usr/sap/trans/data'.

DATA: wa_files TYPE rsfillst,

it_files LIKE TABLE OF wa_files.

START-OF-SELECTION.

CALL FUNCTION 'SUBST_GET_FILE_LIST'

EXPORTING

dirname = lv_dir

filenm = '*'

TABLES

file_list = it_files

EXCEPTIONS

access_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

WRITE /1 'Error! :-('.

ELSE.

LOOP AT it_files INTO wa_files.

WRITE: /1 wa_files-name,

wa_files-len.

ENDLOOP.

ENDIF.

rgds

anver

Read only

0 Likes
747

Hi All,

Thank you very much.