‎2008 Jan 30 3:07 AM
hi guys,
i am trying to get all the folders that are available at directory:
/exchange/DEV , inside this fiolder it contains:
000alSuv.DEV
000alSuv.DEVs
000aljxx.DEV
000aljxx.DEVs
000b8Z1d.DEV
000b8Z1d.DEVs
0010cTWT.DEV
0010cTWT.DEVs
0010diF7.DEV
0010diF7.DEVs
0014IIXh.DEV
0014IIXh.DEVs
0014IR4D.DEV
0014IR4D.DEVs
0014IZaj.DEV
0014IZaj.DEVs
0014Jwpt.DEV
0014Jwpt.DEVs
0014KMPR.DEV
0014KMPR.DEVs
0014Ti4X.DEV
0014Ti4X.DEVs
0014Tqb3.DEV
0014Tqb3.DEVs
0014UGAb.DEV
0014UGAb.DEVs
0014VUtF.DEV
0014VUtF.DEVs
but it displays weird result
this is my coding:
DATA:
dsn(40) TYPE c VALUE '/exchange/DEV',
rec(100) TYPE c.
OPEN DATASET dsn FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc <> 0.
EXIT.
ENDIF.
READ DATASET dsn INTO rec.
WHILE sy-subrc = 0.
WRITE / rec. READ DATASET dsn INTO rec.
ENDWHILE.
CLOSE DATASET dsn.
the problem is: rec contains #/###########################'#########D#############Ae#####ae#################o###d##################
how can i get these results as per the folder
000alSuv.DEV
000alSuv.DEVs
000aljxx.DEV
000aljxx.DEVs
000b8Z1d.DEV
000b8Z1d.DEVs
0010cTWT.DEV
0010cTWT.DEVs
0010diF7.DEV
0010diF7.DEVs
0014IIXh.DEV
0014IIXh.DEVs
0014IR4D.DEV
0014IR4D.DEVs
0014IZaj.DEV
0014IZaj.DEVs
0014Jwpt.DEV
0014Jwpt.DEVs
0014KMPR.DEV
0014KMPR.DEVs
0014Ti4X.DEV
0014Ti4X.DEVs
0014Tqb3.DEV
0014Tqb3.DEVs
0014UGAb.DEV
0014UGAb.DEVs
0014VUtF.DEV
0014VUtF.DEVs
‎2008 Jan 30 3:33 AM
Ester,
DATA: dsn(40) TYPE c VALUE '/exchange/DEV',
ifile type table of salfldir with header line.
call function 'RZL_READ_DIR_LOCAL'
exporting
name = dsn
tables
file_tbl = ifile
exceptions
argument_error = 1
not_found = 2
others = 3.
loop at ifile.
write:/ ifile-name.
endloop.
Don't forget to reward if useful....
‎2008 Jan 30 3:21 AM
Hi Ester
Are you trying to get the list of folders in the specified path or file contents? As per your code i see it as you are reading file DEV in the folder.
Regards
Eswar
‎2008 Jan 30 3:22 AM
Hi Eswar,
i am trying to get the list of folders in the specified path .
‎2008 Jan 30 3:38 AM
As Murali provided, you can use FM: RZL_READ_DIR_LOCAL to ge the directory contents.
But it retreives both files and directories as well.
For each of the contents, pass it to FM: EPS_GET_FILE_ATTRIBUTES to determine whether it is a directory or a file.
Regards
Eswar
‎2008 Jan 30 3:33 AM
Ester,
DATA: dsn(40) TYPE c VALUE '/exchange/DEV',
ifile type table of salfldir with header line.
call function 'RZL_READ_DIR_LOCAL'
exporting
name = dsn
tables
file_tbl = ifile
exceptions
argument_error = 1
not_found = 2
others = 3.
loop at ifile.
write:/ ifile-name.
endloop.
Don't forget to reward if useful....