2006 Jan 17 6:26 AM
Dear all
I have a requirement in ABAP where i should read a file from a particular folder say to be processed folder after sucessful proceesing the file i should move this file to another folder say processed folder. This program will run in the background.
Is there any FM for this process or any other way to achive this.
Thank you in advance.
Karan
2006 Jan 17 6:31 AM
Hi,
You can use <b>CL_GUI_FRONTEND_SERVICES=>FILE_COPY</b>.
after process use file_copy method of the above class.
regards
vijay
2006 Jan 17 6:46 AM
Hi
If you are talking about the application server files.
then
data: begin of tabl occurs 500,
line(400),
end of tabl.
refresh tabl.
data: unixcom like rlgrap-filename.
unixcom = 'cp file1 processed'.
call 'SYSTEM' id 'COMMAND' field unixcom
id 'TAB' field tabl[].
2006 Jan 17 6:32 AM
Karan,
I hope the files are on the app server. If they are the Presentation Server, you cannot execute the program in the background. So, CL_GUI_FRONTEND_SERVICES will not work in the background mode.
1. You can read the files and then rewrite the files into a different folder.
2. You can try using the OS Command.
Regards,
Ravi
Message was edited by: Ravikumar Allampallam
2006 Jan 17 6:41 AM
Hi Ravi
Yes you are right, the file is in the application server. Can you please tell me the os command and how to use in the ABAP program.
Thanks
2006 Jan 17 7:48 AM
Hi Karan,
If it is in the application server, then you can actually read the file with OPEN DATASET and READ DATASET, and TRANSFER each record to another file wherever you would like the file to be. Once the reading and the transfer operation is over, you can delete the original file using DELETE dataset.
Hope this helps.
Regards,
Srikanth
2006 Jan 17 6:39 AM
2006 Jan 17 6:49 AM
Hi Karan,
1. First use GUI_UPLOAD function module to read the file content. Here U built the Internal table.
2. then use GUI_DOWNLOAD function module with ur destination path. Here u pass thar Internal table.
Regards,
Digesh Panchal
2006 Jan 17 7:12 AM
Hi,
Maintain an OS command in SM69 and get it executed using SXPG_COMMAND_EXECUTE.
Cheers
JK