Application Development and Automation 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: 
Read only

Updating or Modifying using OLE

Former Member
0 Likes
1,787

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
Read only

Former Member
0 Likes
1,298

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
Read only

Former Member
0 Likes
1,298

hai use methods of ole2_object

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

m.a

Read only

Former Member
0 Likes
1,298

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

Read only

Former Member
0 Likes
1,298

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

Read only

0 Likes
1,298

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.

Read only

Former Member
0 Likes
1,299

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

Read only

0 Likes
1,298

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