‎2008 May 28 3:42 PM
I am using the methods from the Type-Pool OLE2 to open an excel sheet and Modify it.
And this the code I am using to save the file.
CALL METHOD OF H_EXCEL 'ActiveWorkbook' = H_MAPL.
CALL METHOD OF H_MAPL 'SaveAs' EXPORTING #1 = FNAME.
CALL METHOD OF H_MAPL 'Close'.
CALL METHOD OF H_EXCEL 'Quit'.
Now i want to replace an existing file with the new data. When I save it in the background I donot want the prompt
saying that "The file already exists in the location.Do you want to replace it?"
I want it to directly replace it.Can someone tell me how to do that?
Thank You,
Shashi Devi.
‎2008 May 28 9:10 PM
Hi,
Best way to do this is delete the file and then download new one.
I know function module: GUI_DELETE_FILE works absolutely fine in foreground for this task.
You just have to provide complete file path and it will delete file from your PC.
What I am not sure is if this FM will work in background as this is 'GUI'.
But you can find similar FM in SE37 with 'star FILE star DELETE'.
IF sy-batch = 'X'.
CALL FUNCTION 'GUI_DELETE_FILE'
EXPORTING
file_name = 'C:\CUST1.XLS'
* EXCEPTIONS
* FAILED = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
Reward if this helps.
thnx,
ags.
‎2008 May 30 6:09 PM