Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Updating or Modifying using OLE

Former Member
0 Kudos
684

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos
195

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

6 REPLIES 6

Former Member
0 Kudos
195

hai use methods of ole2_object

and u can search on it an du will get help on it

m.a

Former Member
0 Kudos
195

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

Former Member
0 Kudos
195

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

0 Kudos
195

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.

Former Member
0 Kudos
196

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

0 Kudos
195

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