‎2006 Feb 02 7:46 AM
Can anyone pls let me know is there any function module to get all the files from a directory in the application server to an internal table ??? If not a function module is there anyway which i can get the files to FTP them to Non sap system......Pls help me out
‎2006 Feb 02 7:50 AM
Hi,
Use FM EPS_GET_DIRECTORY_LISTING, pass the file path & get the list in an internal table.
Best regards,
Prashant
‎2006 Feb 02 7:51 AM
OPEN DATASET FNAME FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
MESSAGE s107(yaero_ps) DISPLAY LIKE c_e.
message e008.
ELSE.
DO.
CLEAR: l_string.
READ DATASET FNAME INTO l_string LENGTH l_wllength.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT l_string AT con_tab INTO wa_data_file-ebeln
wa_data_file-ebelp.
APPEND wa_data_file TO fp_flatfile.
ENDIF.
ENDDO.
CLOSE DATASET FNAME.
and to get the file name use FM
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
LOGICAL_FILENAME = FP_FILE
OPERATING_SYSTEM = SY-OPSYS
IMPORTING
FILE_NAME = FNAME
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2.
Regards,
Bikash
‎2006 Feb 02 7:58 AM
HI
here is the code for app server to internal table
parameters: v_data(132) lower case.------ file path
data: begin of record OCCURS 0,
-
structure-----
end of record.
start-of-selection.
open dataset v_data for input in text mode encoding default .
perform open_group.
do.
read dataset v_data into record.
if sy-subrc <> 0. exit. endif.
enddo.
perform close_group.
close dataset v_data.
regards
kishore
‎2006 Feb 02 7:59 AM
‎2006 Feb 02 8:00 AM
HI mivrickk
what's your problem is using the functional module?
regards
kishore
‎2006 Feb 02 8:02 AM
open data set,----
opens file in app server
transfer,----
writes contents of file to int table
read data set-------reads contents from int table to file
close data set----
closes file