08-29-2008 4:39 AM
hi,
i need to come out a program, which can copy/delete file from unix directory A to directory B, on the application server.
does any one have any idea how am i going to code the abap program for this?
thanks
08-29-2008 4:48 AM
> i need to come out a program, which can copy/delete file from unix directory A to directory B, on the application server.
>
i am assuming that your Application server is Unix.
unixcommand cp is used to copy the a file from one directory to another.
cp /dir/file1 /dir2/file2
the above command will copy the file1 of dir1 to file2 of dir2.
for delete use the command rm,
rm /dir/fiel1
the above command will remove the file1 from directory dir.
REPORT ZUNIX line-size 400
no standard page heading.
parameters : unixcom like rlgrap-filename.
data: begin of tabl occurs 500,
line(400),
end of tabl.
data: lines type i.
*----------------------------------------------------------------------
start-of-selection.
refresh tabl.
call 'SYSTEM' id 'COMMAND' field unixcom
id 'TAB' field tabl[].
"if any error or any thing you get in the tabl
"just check the tabl once after the finishing
08-29-2008 4:47 AM
It's simple.
Use the FM's:
1. gui_upload (in order to copy the file into your internal table).
2. WS_FILE_DELETE (in order to delete the file).
3. gui_download (in order to create the file at the new path).
Hope it's solving your problem.
Regards,
Rebeka
08-29-2008 4:48 AM
> i need to come out a program, which can copy/delete file from unix directory A to directory B, on the application server.
>
i am assuming that your Application server is Unix.
unixcommand cp is used to copy the a file from one directory to another.
cp /dir/file1 /dir2/file2
the above command will copy the file1 of dir1 to file2 of dir2.
for delete use the command rm,
rm /dir/fiel1
the above command will remove the file1 from directory dir.
REPORT ZUNIX line-size 400
no standard page heading.
parameters : unixcom like rlgrap-filename.
data: begin of tabl occurs 500,
line(400),
end of tabl.
data: lines type i.
*----------------------------------------------------------------------
start-of-selection.
refresh tabl.
call 'SYSTEM' id 'COMMAND' field unixcom
id 'TAB' field tabl[].
"if any error or any thing you get in the tabl
"just check the tabl once after the finishing
08-29-2008 4:52 AM
hi,
but from the program you show, how am i going to code the command into the program, or where it pass from? can you please advice in the details?
really appreciate. thanks
08-29-2008 5:07 AM
REPORT ZUNIX line-size 400
no standard page heading.
data : unixcom like rlgrap-filename.
data: begin of tabl occurs 500,
line(400),
end of tabl.
data: lines type i.
*----------------------------------------------------------------------
start-of-selection.
refresh tabl.
"cp /dir/file1 /dir2/file2
"the above command will copy the file1 of dir1 to file2 of dir2.
"for delete use the command rm,
"rm /dir/fiel1
"the above command will remove the file1 from directory dir.
unixcom = 'cp /dir/file1 /dir/file2'. "<----here you fill the command
"if you want to use the rm
unixcom = 'rm /dir/file1 '. "<----here you fill the command
call 'SYSTEM' id 'COMMAND' field unixcom
id 'TAB' field tabl[].
"if any error or any thing you get in the tabl
"just check the tabl once after the finishing
01-07-2011 5:25 PM