2009 Jun 29 9:07 AM
Hi experts,
I have a requirement where i need to modify the existing word/excel template with some values. I know this can be done by uploading, modifying and then downloading the document. But i want to know how to achieve this using OLE concepts ?
Regards,
Vijayalakshmi
2009 Jun 29 10:29 AM
Thanks Gary. Is there any way to retrieve the document from application server directly ? Or i have to use front end services to bring that in presentation and do the remaining stuff ?
Regards,
Vijayalakshmi
2009 Jun 29 9:18 AM
hai use methods of ole2_object
and u can search on it an du will get help on it
m.a
2009 Jun 29 9:20 AM
HI,
Can you be mnore specific as to what changes you are to make.
like changes values or images... etc ?
Mebbe I can help in a bit more then
2009 Jun 29 10:02 AM
Hi, I will be changing values in the already existing templates. My template will have some checkpoints and i need to read the program to ensure that the checkpoints are fulfilled or not. Based on that i ll update the checkpoint with a yes or no value.
Thanks for replying.
Regards,
Vijayalakshmi
2009 Jun 29 10:23 AM
HI,
another question,
will the template be available from SAP DMS, or will it be on presentation/application server?
If it is in SAP DMS, then using CVAPI_DOC_VIEW you can create a replica of it in the SAP working directory, use OLE objects to read/update values in the cell and SAVE it as a new copy ata given location.
If the file is on the presentation server then you can make a copy of it in SAp working directory, again make use of SAP OLE objects to read/update values in the cell and SAVE it as a new copy ata given location.
Sample code
* START THE EXCEL APPLICATION
CREATE OBJECT excel 'EXCEL.APPLICATION'.
CALL METHOD OF excel 'WORKBOOKS' = workbooks.
SET PROPERTY OF excel 'VISIBLE' = 0.
CALL METHOD OF workbooks 'OPEN' EXPORTING
#1 = filep.
CALL METHOD OF excel 'Worksheets' = sheet
EXPORTING #1 = 1.
CALL METHOD OF sheet 'Activate'.
* FREE OBJECT sheet.
* Fill the requried cells
CALL METHOD OF excel 'CELLS' = cells EXPORTING #1 = 1 #2 = 31.
SET PROPERTY OF cells 'VALUE' = l_sign_path.
FREE OBJECT cells.
GET PROPERTY OF excel 'ACTIVESHEET' = sheet.
CALL METHOD OF sheet 'SAVEAS' EXPORTING
#1 = g_file_dest
#2 = 1.
CALL METHOD OF workbooks 'CLOSE'.
CALL METHOD OF excel 'QUIT'.
FREE OBJECT excel.
Hope this helps.
2009 Jun 29 10:29 AM
Thanks Gary. Is there any way to retrieve the document from application server directly ? Or i have to use front end services to bring that in presentation and do the remaining stuff ?
Regards,
Vijayalakshmi
2009 Jun 29 10:43 AM
Yes,if I am right, OLE does not work on Application server.
You will need to copy the file from app server to pres server.
You can try to see what happens in CG3Y or chk F< C13Z_FILE_DOWNLOAD_ASCII