‎2011 Jul 27 12:33 PM
Hi All ...
Is there any Function Module or program to Pick multiple *.ccd files from a folder and process them in to SAP ECC ???
Thanks in advance ...
Regards ,
Sijin K P.
Edited by: SIJIN K P on Jul 27, 2011 1:34 PM
‎2011 Jul 27 12:41 PM
Use this static method:
CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
Regards
‎2011 Jul 27 12:41 PM
Use this static method:
CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
Regards
‎2011 Jul 27 12:47 PM
In case you need to filter the Directory files by a given extension, you can use the following method:
CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
‎2011 Jul 27 1:54 PM
Hi Jose ,
Thanks for your reply ..
My requirement is to create one report and this will run in background and it should pick multiple files from the given folder and process it to SAP . But here if i use the above method how it is possible to make the file selection automatically ..ie if suppose 5 files are there in the folder it should pick five files and process all of them. ..
Regards ,
Sijin K P.
‎2011 Jul 27 3:35 PM
Then you can use this method: CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES, specifying the directory path in which the files are located, as well as the filtering criteria, and once you have the internal table with all the files you have to upload, then call GUI_UPLOAD, as many times as you need.
‎2011 Jul 28 4:48 AM
You cannot access files on the presentation server in the background mode.
‎2011 Jul 28 6:18 AM
Hi Jose ,
Will this metthod work for Files in application server ..??
Regards,
Sijin KP.
‎2011 Jul 28 6:24 AM
Use FM EPS2_GET_DIRECTORY_LISTING to the list of files on Application server directory. This FM works great in both foreground and background.
‎2011 Jul 28 7:05 AM
Hi rumhat ,
Thanks for your reply ..
Tested this FM . But i am not able to read multiple file name using this . Please correct me if i am wrong ..
CALL FUNCTION 'EPS2_GET_DIRECTORY_LISTING'
EXPORTING
iv_dir_name = '/usr/sap/ED5/DVEBMGS00/work'
*
FILE_MASK = '*.txt'
IMPORTING
DIR_NAME = lv_dir
FILE_COUNTER =
ERROR_COUNTER =
tables
dir_list = lit_table.
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
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
There are multile .txt files in ' usr/sap/ED5/DVEBMGS00/work' directory . But in lit_table contains only one entry ie last file .
Regards ,
Sijin K P.
‎2011 Jul 28 7:09 AM
Pass value '.' to parameter filemask to get all the available files in the application server directory and then process the necessary files.
Cheers,
Rupesh
Edited by: rumhat on Jul 28, 2011 8:09 AM
‎2011 Jul 28 7:54 AM
Hi Rupesh ,
Thanks for reply...
Is there any keyword to filter respective file extension ( .txt , .ccd etc ) from table or do we need to loop the table and check each records ..??
Is there any FM to upload a file in to an archive folder in application server .
I have to move the file to archive folder after the competition of file process.
Regards ,
Sijin KP
‎2011 Jul 28 8:02 AM
I did it by looping through the internal table and filtering files accordingly.
As far as moving files across application server is considered, you can do it by using external system command(SM69).
For Host OS -
1. UNIX - Use command "mv" (works great in both foreground & background mode)
2. Windows - Use command "move" (not sure if it works in background mode)
An alternate way is to use Dataset handling technique -
1. OPEN DATASET
2. READ DATASET
3. TRANSFER to dest_file
4. DELETE source_file
I know this is cumbersome, but it surely does works.
Cheers,
Rupesh