‎2018 Jul 26 8:34 AM
Hello Friends,
I am looking function modules for get files from application server path to internal table, I got some function modules but it is not working. Please suggest.
RZL_READ_DIR_LOCAL
EPS_GET_DIRECTORY_LISTING
both are giving error file not found, but if I go with same path in AL11, I can see the files.
Thanks.
‎2018 Jul 26 9:51 AM
I don't know of any function modules but here's something I've seen used in the past.
data: begin of lt_tabl occurs 0,
line type c length 2000,
end of lt_tabl.
data: ls_line type c length 2000.
data: i_tab type table of string.
data: l_f_dir type c length 128,
l_t_dir type c length 128,
l_dir type c length 128,
l_file type c length 30.
l_file = '*.*'.
l_t_dir = '/usr/sap/trans/log/'.
concatenate l_t_dir l_file into l_f_dir.
* get files in directory.
clear: l_dir.
l_dir(7) = 'ls -ld '.
l_dir+7(45) = l_f_dir.
refresh lt_tabl.
call 'SYSTEM' id 'COMMAND' field l_dir
id 'TAB' field lt_tabl-*sys*.
loop at lt_tabl into ls_line.
refresh i_tab.
clear l_file.
split ls_line at '/' into table i_tab.
check not i_tab[] is initial.
loop at i_tab into l_file.
endloop.
endloop.
‎2018 Jul 26 10:38 AM
‎2018 Jul 26 10:51 AM
Hi Horst,
Thanks for the warning. As I said in my answer, it's something I came across in the past that fulfilled the purpose. Knowing the possible issues thanks to your link will have me looking for alternatives.
Regards,
Arthur
‎2018 Jul 26 10:39 AM
‎2018 Jul 26 12:00 PM
The link you provided is for presentation server not application server.
‎2018 Jul 26 2:21 PM
‎2018 Jul 26 1:15 PM
"Not working"
Is that the actual error message you get?
‎2018 Jul 26 1:17 PM
got solution I was trying in SE37, If we try with program level these function modules will work fine.
‎2018 Jul 26 2:20 PM
‎2018 Jul 26 2:56 PM
Hello Guys,
Now i got new requirement while collecting files from path should filter with date as per user entered. Any one can suggest how to achieve this kind of requirement.
Thanks.
‎2018 Jul 26 3:53 PM
‎2018 Jul 26 3:54 PM
Ask a new question as a new question. Don't continue this one. Though you might confirm that your problem was caused because you didn't check the "lower case" check box when testing in SE37.
‎2018 Jul 26 5:33 PM
Hi Sahoo,
Try this FM TXW_FILE_OPEN_FOR_READ or creating "Z" Class~method or FM with below ABAP code.
...
OPEN DATASET <filename> FOR ... IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
MESSAGE or EXCEPTION...
ELSE.
DO.
READ DATASET <filename> INTO work-area.
IF sy-subrc NE 0.
EXIT.
ELSE.
APPEND work-area TO internal table.
ENDIF.
CLEAR: work-area.
ENDDO.
ENDIF.
CLOSE DATASET <filename>.
IF sy-subrc NE 0.
MESSAGE or EXCEPTION...
ENDIF.
...
Regards,