‎2006 Sep 22 11:18 AM
Hi Experts,
Is there any SAP defined method available to read a directory from App.server?
Regards
‎2006 Sep 22 11:26 AM
Use the Below function module:
DATA: lcl_directory TYPE char128.
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.
‎2006 Sep 22 11:21 AM
Hi
Check this FM
CALL 'C_DIR_READ_NEXT'
ID 'TYPE' FIELD FILE-TYPE
ID 'NAME' FIELD FILE-NAME
ID 'LEN' FIELD FILE-LEN
ID 'OWNER' FIELD FILE-OWNER
ID 'MTIME' FIELD FILE-MTIME
ID 'MODE' FIELD FILE-MODE
ID 'ERRNO' FIELD FILE-ERRNO
ID 'ERRMSG' FIELD FILE-ERRMSG.
For reading a directory on Appl server.
Regards,
Raj
‎2006 Sep 22 11:22 AM
You can use the FM <b>"DX_FILE_READ"</b> to read files from application server.
‎2006 Sep 22 11:23 AM
use the trabsaction AL11...
IT WILL LIST THE DIRECTORIES
REGARDS
LOKESH
‎2006 Sep 22 11:25 AM
‎2006 Sep 22 11:26 AM
Use the Below function module:
DATA: lcl_directory TYPE char128.
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.
‎2006 Sep 22 2:54 PM
Hi ,
I am aware of all these FMs.But the directory path which i will get can contain any n.of characters.In all these FMs the path is limited to certain length.
That's y i am asking is there any method available to read directory from App.server.which contains directory path as type string..
Any suggessions on this will be great full to me.
‎2006 Sep 22 2:57 PM
chk this EPS_GET_DIRECTORY_LISTING
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
.
‎2006 Sep 22 3:01 PM
Here is application server browser program.
report zrich_0001 .
data: begin of itab occurs 0,
rec(1000) type c,
end of itab.
data: wa(1000) type c.
data: p_file type localfile.
data: ifile type table of salfldir with header line.
parameters: p_path type salfile-longname
default '/usr/sap/TST/DVEBMGS01/data/'.
call function 'RZL_READ_DIR_LOCAL'
exporting
name = p_path
tables
file_tbl = ifile
exceptions
argument_error = 1
not_found = 2
others = 3.
loop at ifile.
format hotspot on.
write:/ ifile-name.
hide ifile-name.
format hotspot off.
endloop.
at line-selection.
concatenate p_path ifile-name into p_file.
clear itab. refresh itab.
open dataset p_file for input in text mode.
if sy-subrc = 0.
do.
read dataset p_file into wa.
if sy-subrc <> 0.
exit.
endif.
itab-rec = wa.
append itab.
enddo.
endif.
close dataset p_file.
loop at itab.
write:/ itab.
endloop.
Regards,
Rich Heilman
‎2006 Sep 22 3:03 PM
Hi,
Thanks.But in this Fm the length of Directory name path is 60 characters.
‎2006 Sep 22 3:19 PM
‎2006 Sep 22 3:09 PM
Hi,
Yes, thats correct. But then a path of 60 character should be more than enough.
Best regards,
Prashant