Download to MS WORD using OLE
Hi All,
I am developing a program to download data to MS WORD using OLE. I would like to know answers for my below questions,
1) What is the equivalent ABAP code for VB macro
Selection.Style = ActiveDocument.Styles("No Spacing")
Issue is when i say new line it prints one blank line and then start printing. This is because of format Style = Normal.
If i set it up as No Spacing it would resolve my issue.
2) How to insert a bitmap image in MS WORD using OLE?
Thanks in advance.
Found answer by myself.
Below is the code to add picture
GET PROPERTY OF selection 'InlineShapes' = shapes.
CALL METHOD OF shapes 'AddPicture'
EXPORTING
#1 = 'C:\Temp\untitled.bmp'
#2 = 0
#3 = 1.
Below is the code for no line spacing
SET PROPERTY OF parformat 'SpaceAfter' = 0.
Similar Messages
-
What is an alternative download for microsoftt word using a mac bookair?
what is an alternative download for microsoftt word using a mac bookair?
Office 2004 and Other Applications Don't Work in Lion/Mountain Lion
If you have Office 2004 which is a PPC-only suite, it will not work in Lion/Mountain Lion. You need to upgrade to Office 2011 - Mactopia - or you can try the freeware suite, Libre Office, that is functionally similar to Office 2007 for Windows except it works on Lion/Mountain Lion.
You may want to consider as well:
These two suites are similar to Libre Office but not as current or as well-supported:
NeoOffice
Open Office
And, then there is Apple's iWork suite:
Pages - word processing and layout
Keynote - presentation
Numbers - spreadsheet
Each can open and save Office compatible files. They may be purchased separately via the Mac App Store for $19.99 each.
As for other software, any PPC-based software will not run in Lion or Mountain Lion because Rosetta is no longer part of OS X. You will need to upgrade to Intel versions of the software.
(Access to the Mac App Store requires Snow Leopard 10.6.6 or higher and an Apple ID.) -
Problem about the macro in word using ole
Hi,
Now i have an urgent problem.
I want to use ole2_object to control a word document by calling the macro. i want to pass a parameter for the marco but i don't know how to pass it . the main method i use as following:
macro = 'startmerge."
call method document->open_document_from_table
exporting
document_size = doc_size
document_table = doc_table[]
open_inplace = 'X'
startup_macro = macro. " here is my problem?????
the macro's code as following:
Sub startmerge(file As String)
' startmerge Macro
' Macro recorded 2000-1-23 by Ryan
Dim fs As Object
'Dim file As String
'file = "C:\SAPTEMP.JPG"
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.fileexists(file) Then
Application.GoBack
Selection.InlineShapes.AddPicture FileName:=file, LinkToFile:= _
False, SaveWithDocument:=True
Else
MsgBox "no file found"
End If
Set myMerge = ThisDocument.MailMerge
If myMerge.State = wdMainAndSourceAndHeader Or _
myMerge.State = wdMainAndDataSource Then
End If
With myMerge
.MainDocumentType = wdEnvelopes
.OpenDataSource Name:="c:\appraial_tmp.txt", ReadOnly:=True
.Destination = wdSendToNewDocument
.Execute
End With
End Sub
now i want to pass a value for the parameter 'file' in abap by calling a macro 'startmerge'.
Can anyone give me some advice? or give me some advice?
Thanks a lot in advance.
qiuguoHi, aRs,
thank you very much . i have get the approach to solve this problem form the link you given. In abap sap have provided a method to call a marco using parameters. Following is the kernel code:
macro = 'startmerge'."()
call method document->open_document_from_table
exporting
document_size = doc_size
document_table = doc_table[]
open_inplace = 'X'
startup_macro = macro.
data: error like I_OI_ERROR.
create object error.
CALL METHOD DOCUMENT->EXECUTE_MACRO
EXPORTING
MACRO_STRING = macro
NO_FLUSH = ' '
PARAM1 = 'C:\3.JPG'
PARAM10 =
PARAM11 =
PARAM12 =
PARAM2 =
PARAM3 =
PARAM4 =
PARAM5 =
PARAM6 =
PARAM7 =
PARAM8 =
PARAM9 =
PARAM_COUNT = 1
SCRIPT_NAME =
IMPORTING
ERROR = error
RETCODE =
CHANGING
ERROR_STRING =
RETVALUE =
so appreciate for you response.
qiuguo -
Using OLE for download MS-Word
Hello,
can I use a MS-Word Template while creating an word obejct to write on the template
I mean here-->
CREATE OBJECT gs_word 'WORD.APPLICATION'. "Create word object
Thank youHi,
Chek out this wiki page:
[Sample program to create a Word document from ABAP (using OLE) |http://wiki.sdn.sap.com/wiki/display/Snippets/SampleprogramtocreateaWorddocumentfromABAP%28usingOLE%29]
Regards -
Download classical report to MS word with OLE
hi experts,
I have a Classical HR Report that contains profile information of the employee.Now I have to Download the Report to Ms word through OLE . I tried some threads but they were just displaying the static text.I have to download the data for the following format.could some one help me on this?
WRITE : 'Salary Information '.
SKIP 1.
WRITE : 1 SY-ULINE(83).
WRITE : /1'|',2 'Period Ending On 31ST',25'|',26'Rating(If Any)',42'|',43'Basic Salary',57'|',58'Gpm',70'|',71'CTC',83'|'.
WRITE : /1 SY-ULINE(83).
CLEAR YEARSAL.CLEAR CURRENT.
CLEAR GROSS.CLEAR GROSS1.CLEAR CTC1.
LOOP AT ISAL INTO WSAL WHERE PERNR = WP01-PERNR AND ENDDA = '99991231' ."AND CURRENT BETWEEN WSAL-BEGDA AND WSAL-ENDDA.
GROSS = WSAL-BET01 + WSAL-BET02 + WSAL-BET03 + WSAL-BET04.
GROSS1 = GROSS.CONDENSE GROSS1.
CTC1 = WSAL-BET10.CONDENSE CTC1.
WRITE : /1'|',2 'Current' ,25'|',26 WSAL-RTEXT,42'|',43 WSAL-BET01 ,57'|',58 GROSS1,70'|',71 CTC1,83'|'.
WRITE : /1 SY-ULINE(83).
ENDLOOP.
"need to download such information as above to ms word
"ole format
CREATE OBJECT gs_word 'WORD.APPLICATION' .
IF sy-subrc NE 0 .
MESSAGE s000(su) WITH 'Error while creating OLE object!'.
LEAVE PROGRAM .
ENDIF .
*--Setting object's visibility property
SET PROPERTY OF gs_word 'Visible' = '1' .
*--Opening a new document
GET PROPERTY OF gs_word 'Documents' = gs_documents .
CALL METHOD OF GS_DOCUMENTS 'ADD' = V_DOCUMENTS.
CALL METHOD OF gs_selection 'TypeText'
EXPORTING
#1 = 'Overview Of The Employee'.
"the output format would be like this .
pernr | year | salary | .......
Edited by: SYED_ibbu on Feb 23, 2011 11:07 AM
Edited by: SYED_ibbu on Feb 24, 2011 5:57 AMhi experts,
i Have to display multiple tables in the word document . i am displaying the first table but when i try to display the second table it is getting displayed inside the first table. When i debugged , i found that that the cursor is still in the first row of the first table even after the first table is displayed and the second table is displayed from that cursor position. How to get the cursor position after the end of the table ie outside the table to the main document.could some one help me on this. Below is the code i have used.
GET PROPERTY OF GS_WORD 'ActiveDocument' = gs_actdoc.
GET PROPERTY OF gs_actdoc 'Tables' = gs_tables .
GET PROPERTY OF gs_selection 'Range' = gs_range .
CALL METHOD OF gs_tables 'Add' = gs_table
EXPORTING
#1 = gs_range
#2 = LINES
#3 = '7'.
GET PROPERTY OF gs_table 'Borders' = gs_table_border .
SET PROPERTY OF gs_table_border 'Enable' = '1' .
GET PROPERTY OF gs_cell 'Range' = gs_range .
SET PROPERTY OF gs_range 'Text' = value .
CALL METHOD OF gs_table 'Cell' = gs_cell
EXPORTING
#1 = P_TABIX1
#2 = CNT.
GET PROPERTY OF GS_WORD 'ActiveDocument' = gs_actdoc1.
GET PROPERTY OF gs_actdoc1 'Tables' = gs_tables1 .
GET PROPERTY OF gs_selection 'Range' = gs_range1 .
CALL METHOD OF gs_tables1 'Add' = gs_table1
EXPORTING
#1 = gs_range1
#2 = '2'
#3 = '4'.
with thanks in advance,
syed
Edited by: SYED_ibbu on Feb 25, 2011 5:39 AM -
Download alv-table to MS-Word using OLE2
Hello,
I need to download an internal table like ALV to MS-Word using OLE2.
thank you 4 ur help.
I fund this Report, but here i just can write a text in word but I can not show/write a Table.
http://wiki.sdn.sap.com/wiki/display/Snippets/SampleprogramtocreateaWorddocumentfromABAP%28usingOLE%29
CALL METHOD OF v_objselection 'TypeText'
EXPORTING #1 = 'Olé World!'.
when i wrote a table 4 Exmpel lt_outab insteat of 'Ole World' I got a trouble during compling because lt_outab is not a CHAR:-(I recommend reading this article:
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/204d1bb8-489d-2910-d0b5-cdddb3227820
You will get all the information you need to do with OLE2 Automation.
It is also useful to dig into VB a little bit.
In the article on page 7 you have a sample code which shows how to do with tables. You need to loop in ABAP on the internal table and inside this loop you need to loop on fields. Use VB methods ADD and CELL.
FIELD-SYMBOLS: <wrk> LIKE LINE OF itab, <field> TYPE ANY.
CALL METHOD OF word 'Add' = table
EXPORTING
#1 = range_table
#2 = lines "lines( itab )
#3 = fields. "number of fields
LOOP AT itab ASSIGNING <wrk>.
l_index = sy-tabix.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <wrk> TO <field>.
IF sy-subrc NE 0.
EXIT.
ENDIF.
CALL METHOD OF word 'Cell' = cell
EXPORTING
#1 = l_index
#2 = sy-index.
GET PROPERTY OF cell 'Range' = range
SET PROPERTY OF range 'Text' = <field>.
ENDDO.
ENDLOOP.
Regards
Edited by: Krzysztof Usowicz on Sep 15, 2010 9:45 AM -
Using OLE add Header to MS Word Document in ABAP Program
Dear Friends,
I have a requirement where I want to add Header and Footer to MS Word through OLE in ABAP Program
I am able to open the word document, through OLE,
I am stuck @ the following step.
CALL METHOD OF LO_APPLICATION 'ActiveDocument' = LO_DOCUMENT.
IF SY-SUBRC <> 0. EXIT. ENDIF.
CALL METHOD OF LO_DOCUMENT 'Sections' = LO_SECTIONS.
IF SY-SUBRC <> 0. EXIT. ENDIF.
Please let me know.
Thanks
RajeshHi Rajesh,
You have to use GET PROPERTY & SET PROPERTY attributes of OLE2_OBJECT to use headers.
Just a sample code snippet for your reference :-
DATA : GS_TABLE TYPE OLE2_OBJECT ,
GS_RANGE TYPE OLE2_OBJECT,
GS_CELLTYPE OLE2_OBJECT,
CALL METHOD OF GS_TABLE 'Cell' = gs_cell
EXPORTING #1 = '1'
#2 = '1'.
GET PROPERTY OF gs_cell 'Range' = gs_range.
SET PROPERTY OF gs_range 'Text' = 'VGUID'.
CALL METHOD OF gs_table 'Cell' = gs_cell
EXPORTING #1 = '1'
#2 = '2'.
For more details search on SCN for code on creating MS word document using OLE automation.
Regards
Abhii -
ALV download to Excel onto desktop using OLE concept.
Hi Experts,
I requriement is , through my se38 program i need to download report output to excel.
i did this using OLE concepts code and excel is being downloaded good.
But problem is all columns data is dumped into First column. But in my ALV i have 20 columns. So i except data in excel sheet to be in 20 columns.
Below is the OLE code i used
CREATE OBJECT wa_excel 'EXCEL.APPLICATION'. "Create object for Excel
SET PROPERTY OF wa_excel 'VISIBLE' = 1. "In background Mode
CALL METHOD OF wa_excel 'WORKBOOKS' = w_workbook.
CALL METHOD OF w_workbook 'ADD'. "Create a new Workbook
SET PROPERTY OF wa_excel 'SheetsInNewWorkbook' = 3. "No of sheets
* Downloading header details to first sheet
PERFORM download_sheet TABLES i_final USING 1 'Master Material Details'.
GET PROPERTY OF wa_excel 'ActiveSheet' = w_worksheet.
* Protect the first worksheet with a password
CALL METHOD OF w_worksheet 'PROTECT
EXPORTING #1 = 'infy@123'.
* Save the Excel file
GET PROPERTY OF wa_excel 'ActiveWorkbook' = w_workbook.
CALL METHOD OF w_workbook 'SAVEAS'
EXPORTING #1 = p_infile.
FREE OBJECT: w_worksheet, wa_excel.
FORM download_sheet TABLES p_tab USING p_sheet TYPE i p_name TYPE string.
CALL METHOD OF wa_excel 'WORKSHEETS' = w_worksheet
EXPORTING
#1 = p_sheet.
CALL METHOD OF w_worksheet 'ACTIVATE'.
SET PROPERTY OF w_worksheet 'NAME' = p_name.
CALL METHOD OF wa_excel 'Range' = w_range
EXPORTING
#1 = 'A1'
#2 = 'D1'.
CALL METHOD OF w_range 'INTERIOR' = w_int.
SET PROPERTY OF w_int 'ColorIndex' = 6.
SET PROPERTY OF w_int 'Pattern' = 1.
* Initially unlock all the columns( by default all the columns are locked )
CALL METHOD OF wa_excel 'Columns' = w_columns.
SET PROPERTY OF w_columns 'Locked' = 0.
* Locking and formatting first column
CALL METHOD OF wa_excel 'Columns' = w_columns
EXPORTING
#1 = 1.
* Locking and formatting second column
CALL METHOD OF wa_excel 'Columns' = w_columns
EXPORTING
#2 = 2.
SET PROPERTY OF w_columns 'Locked' = 2.
SET PROPERTY OF w_columns 'NumberFormat' = '@'.
* Export the contents in the internal table to the clipboard
CALL METHOD cl_gui_frontend_services=>clipboard_export
IMPORTING
data = p_tab[]
CHANGING
rc = w_rc
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
* Paste the contents in the clipboard to the worksheet
CALL METHOD OF w_worksheet 'Paste'.
* Autofit the columns according to the contents
CALL METHOD OF wa_excel 'Columns' = w_columns.
CALL METHOD OF w_columns 'AutoFit'.
FREE OBJECT: w_columns, w_range.
Please help me if there is any SET Property of WA_EXCEL with which i can handle ALV data into Diffrenet columns.
Regards,
jayant.hi nabheet,
we have implemnted this logic and it is workign fine. Bit it takes long time to download data in Excel sheet. Actually it is happening feild by field.
Please advice any perfomance tuning to this logic.
Rgs,
jayant -
Techniques needed for Automated (OLE) PDF Creation from Word using Adobe 9
My client currently uses Adobe 5, PDF Writer, Word and OLE automation to generate PDF files. This is done on a server. A queue of Word documents are read. A watermark is added via a VB Macro. Then, also via a macro (below) a pdf file version of the Word doc is generated. The pdf file is generated as temp.pdf, which the program uniquely renames later.
Unfortunately, Adobe 5 and PDF Writer cannot handle Chinese characters and now needs to. Seems like the process above cannot be the same with Adobe 9. How should I approach this server driven, pdf file generation from Word docs with Adobe 9? This is a 24 x 7 ongoing, 100s of documents a day process. It isn’t clear to me that PDF Writer is still an option. With Adobe 9 installed on a client, it is possible to save a Chinese character Word document using the Adobe ‘Convert to PDF’ toolbar button
Sub WritePdfFile()
Windows(1).Activate
ActivePrinter = "Acrobat PDFWriter"
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
Collate:=True, Background:=True, PrintToFile:=False
End SubI think that type of question would go in
Scripting http://forums.adobe.com/community/acrobat/acrobat_scripting
or
SDK http://forums.adobe.com/community/acrobat/acrobat_sdk
Or, for Microsoft parts of the process, search at
http://search.microsoft.com/search.aspx?mkt=en-US&setlang=en-US -
Data download to multiple sheets in Excel without using OLE
Hi,
Please let me know if it is possible to download data to multiple sheets in excel without using OLE method
I am in SRM system and the OLE methods are not working
Please share some sample code or reference links if any
Thanks
SekharJ
Edited by: SekharJ on Sep 8, 2009 8:43 AMHere is my code
LOOP AT it_final INTO wa_final.
AT FIRST.
l_ixml = cl_ixml=>create( ).
l_document = l_ixml->create_document( ).
l_element_flights = l_document->create_simple_element(
name = 'PO_Details'
parent = l_document ).
ENDAT.
l_element_airline = l_document->create_simple_element(
name = 'PO'
parent = l_element_flights ).
l_value = wa_final-object_id.
l_rc = l_element_airline->set_attribute( name = 'Objectid' value =
l_value ).
l_value = wa_final-description.
l_rc = l_element_airline->set_attribute( name = 'Description' value =
l_value ).
l_value = wa_final-number_int.
l_rc = l_element_airline->set_attribute( name = 'Item' value =
l_value ).
l_value = wa_final-description1.
l_rc = l_element_airline->set_attribute( name = 'Description1' value =
l_value ).
l_value = wa_final-quantity.
l_rc = l_element_airline->set_attribute( name = 'Quantity' value =
l_value ).
l_value = wa_final-capex.
l_rc = l_element_airline->set_attribute( name = 'Capex' value =
l_value ).
l_value = wa_final-ser_num.
l_rc = l_element_airline->set_attribute( name = 'SerialNo' value =
l_value ).
l_value = wa_final-plant.
l_rc = l_element_airline->set_attribute( name = 'Plant' value =
l_value ).
l_value = wa_final-loc.
l_rc = l_element_airline->set_attribute( name = 'Location' value =
l_value ).
l_value = wa_final-bundle.
l_rc = l_element_airline->set_attribute( name = 'Bundle' value =
l_value ).
ENDLOOP.
l_streamfactory = l_ixml->create_stream_factory( ).
l_ostream = l_streamfactory->create_ostream_itable( table =
l_xml_table ).
l_renderer = l_ixml->create_renderer( ostream = l_ostream
document = l_document ).
l_rc = l_renderer->render( ).
l_xml_size = l_ostream->get_num_written_raw( ).
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = l_xml_size
filename = 'c:\temp\flights.xlsx'
filetype = 'BIN'
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 24.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Edited by: SekharJ on Sep 8, 2009 12:04 PM
Edited by: SekharJ on Sep 8, 2009 12:15 PM -
Problem in excel download using OLE concept
Hi ,
i am trying to create two sheets using OLE concept.
i am able to create the excel successfully but i can't save it .
i have one problem .
GET PROPERTY OF excel 'ActiveSheet' = sheet.
CALL METHOD OF sheet 'FILESAVEAS' EXPORTING #1 = w_filename1.
IF sy-subrc eq 0.
the sy-subrc value comes as 2.
i am passing 'C:\SKD.XLS' to w_filename.
is anything wrong.
how can check this method and it's exceptions.i am getting the file name from user input using the method
*"Calling method for getting file name as saved by the user.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = w_title
CHANGING
filename = w_filnam
path = w_path
fullpath = w_filename1
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
w_filename1 is of sting type .
i am passing the full path to it .
please let me i am doing anything wrong . -
Insert SAP ICONS into from SAP into Word document (OLE)
Hi ,
I want to Insert SAP ICONS into from SAP into Word document (OLE) .
Please let me know how can I do it? I would really appreciate it.
Regards,
SanjeevHello,
Try this out:
(1) Copy program DD_ADD_PICTURE into your own version called ZDD_ADD_PICTURE. Make sure
you select all the checkboxes (including GUI Status and screens).
(2) Paste the modified code at the end of this reply into your ZZ_ADD_PICTURE program.
(3) Run ZZ_ADD_PICTURE for a range of Icons (e.g. enter Icon name ICON_IN* on the selection screen)
(4) When you get the result list, type in ok-code EXPO directly in the ok-code
field (you could also add a button for this function in the GUI status).
(5) Download all the displayed icons as .gif files into a Windows folder
that you have created to hold the icon .gif files (e.g. C:SAPICONS)
(6) Now you can work with the icon files as you would any .gif file. (e.g. In a Word doc, use menu path
Insert -> Picture -> From file.)
Here is the code:
REPORT dd_add_picture.
TYPE-POOLS: sdydo.
DATA: do TYPE REF TO cl_dd_document.
DATA: is_displayed.
TABLES: icont.
DATA: BEGIN OF icontab OCCURS 0.
INCLUDE STRUCTURE icon.
DATA: END OF icontab.
select-options: s_icon for icontab-name obligatory.
SELECT * FROM icon INTO TABLE icontab WHERE locked NE 'X'
AND name in s_icon.
* Event Handler Definition, handling changes of GUI fonts, colors,...
CLASS cl_my_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
use_new_resources FOR EVENT resources_changed OF cl_gui_resources.
ENDCLASS.
DATA: my_handler TYPE REF TO cl_my_event_handler.
CREATE OBJECT my_handler.
* Call Screen
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
IF is_displayed IS INITIAL.
SET PF-STATUS 'BRP'.
SET HANDLER my_handler->use_new_resources.
* create document
CREATE OBJECT do.
* fill document
PERFORM dd_add_icon USING do.
* merge document
CALL METHOD do->merge_document.
* display document .
CALL METHOD do->display_document
EXPORTING container = 'HTML'
EXCEPTIONS html_display_error = 1.
" do some exception handling ...
is_displayed = 'X'.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'. "Beenden
LEAVE PROGRAM.
WHEN 'PRN'.
CALL METHOD do->print_document
EXPORTING reuse_control = 'X'.
WHEN 'PRN_NEW'.
DATA text TYPE sdydo_text_element.
CALL METHOD do->initialize_document.
text = 'Dies Dokument wurde speziell fürs Drucken erstellt!' &
' Druckdatum: '(500).
CALL METHOD do->add_text EXPORTING
text = text
sap_fontsize = cl_dd_area=>large.
WRITE sy-datum TO text DD/MM/YYYY.
CALL METHOD do->add_text EXPORTING text = text .
CALL METHOD do->new_line EXPORTING repeat = 2.
PERFORM dd_add_icon USING do.
CALL METHOD do->merge_document.
CALL METHOD do->print_document.
WHEN 'EXPO'.
CALL METHOD do->export_document EXPORTING to_filesystem = 'X'.
ENDCASE.
CLEAR sy-ucomm.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form DD_ADD_ICON
* text
FORM dd_add_icon USING p_do TYPE REF TO cl_dd_document.
DATA ta TYPE REF TO cl_dd_table_element.
DATA col1 TYPE REF TO cl_dd_area.
DATA col2 TYPE REF TO cl_dd_area.
DATA col3 TYPE REF TO cl_dd_area.
DATA text TYPE sdydo_text_element.
* set Heading
text = ' Bilder in Dynamischen Dokumenten'(001).
CALL METHOD p_do->add_text EXPORTING text = text
sap_style = 'heading'.
CALL METHOD p_do->new_line.
CALL METHOD p_do->new_line.
CALL METHOD p_do->add_table EXPORTING with_heading = 'X'
no_of_columns = 3
width = '100%'
IMPORTING table = ta.
* set columns
text = 'Ikone'(011).
CALL METHOD ta->add_column EXPORTING heading = text
IMPORTING column = col1.
* fill table
LOOP AT icontab.
SELECT SINGLE * FROM icont WHERE langu = sy-langu
AND id = icontab-id.
CALL METHOD col1->add_icon EXPORTING sap_icon = icontab-name
sap_color = 'LIST_GROUP'.
ENDLOOP.
ENDFORM. " DD_ADD_ICON
* CLASS cl_my_event_handler IMPLEMENTATION.
CLASS cl_my_event_handler IMPLEMENTATION.
METHOD use_new_resources.
IF is_displayed EQ 'X'.
* initialize document
CALL METHOD do->initialize_document.
* fill document
PERFORM dd_add_icon USING do.
* merge document
CALL METHOD do->merge_document.
* display document
CALL METHOD do->display_document
EXPORTING reuse_control = 'X'
reuse_registration = 'X'.
ENDIF.
ENDMETHOD.
ENDCLASS.
Regards,
Vasanth -
Updating or Modifying using OLE
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,
VijayalakshmiHI,
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. -
To upload excel file directly to the application server using OLE concept
hi experts
i have done a coding in OLE to download excel with graph to presentation server, is it possible to upload excel with graph directly to the application server , the excel should have graph while downloading to presentation server fom app server.
Moderator message - duplicate post locked
Edited by: Rob Burbank on Jun 25, 2009 9:49 AMHI,
have a look at tcode cg3z and then FM 'C13Z_FILE_UPLOAD_ASCII'.
What you can do is, first create the file on presentation server using OLE automation, and then using this FM, write the file to Application server -
How to use saveas webarchive in word using OLE2
Hello,
I am using the webutil word demo (without webutil) on the client. This demo is working fine.
Now I like to save the file not as a word document, but as a WebArchive or html file. How can I pass the fileformat argument to the saveas invoke call. Or is there a other way to do this using ole2.
Below the demo code.
Thanks in advance,
Fred.
DECLARE
app OLE2.OBJ_TYPE;
docs OLE2.OBJ_TYPE;
doc OLE2.OBJ_TYPE;
selection OLE2.OBJ_TYPE;
args OLE2.LIST_TYPE;
BEGIN
-- create a new document
app := OLE2.CREATE_OBJ('Word.Application');
OLE2.SET_PROPERTY (app,'Visible',1);
docs := OLE2.GET_OBJ_PROPERTY(app, 'Documents');
doc := OLE2.INVOKE_OBJ(docs, 'add');
selection := OLE2.GET_OBJ_PROPERTY(app, 'Selection');
-- insert data into new document from long item
OLE2.SET_PROPERTY(selection, 'Text', 'this is a test message');
-- save document as example.tmp
args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 'c:\example.doc');
OLE2.INVOKE(doc, 'SaveAs', args);
OLE2.DESTROY_ARGLIST (args);
-- close example.tmp
args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 0);
OLE2.INVOKE(doc, 'Close', args);
OLE2.DESTROY_ARGLIST(args);
OLE2.RELEASE_OBJ(selection);
OLE2.RELEASE_OBJ(doc);
OLE2.RELEASE_OBJ (docs);
Using OLE Commands
OLE2.INVOKE(app,'Quit');
END;Hi Fred,
Word's SaveAs() method takes file format as it's second argument. The following code snippet shows how to save as HTML:
args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 'c:\example.html');
OLE2.ADD_ARG(args, 8);
OLE2.INVOKE(doc, 'SaveAs', args);Eric Adamson
Lansing, Michigan
Maybe you are looking for
-
Conversion of XML file in Noepad
Hi Folks, i have a requiremnt like sending .TXT file and output is .XML. when i open the file in internet explorer i Got right output. when open the same file in notepad the file is look like below <?xml version="1.0" encoding="UTF-8"?> <EDS_PII_XML>
-
The loading of OPSS java security policy provider failed due to exception
Hi, The issue is execution of startWebLogic.cmd failed,once shutting down the system and restarting it.At first time,after the installation ,it worked and I was able to log in to web logic server.I also created boot.properties file with user name and
-
What is the internal mailing list for Oracle SES
Hello, I had this mailing list: : [email protected] but it appears to not be available now. Does anyone know where should I write now? Thanks in advance.
-
Recieving e-mail issue - only get them after I perform a browser action
I am baffled. For some reason, i can only receive e-mails after i go to Facebook for blackberry and search for status updates. I assume when i do that, it polls for the e-mails. Any idea how to fix this?
-
Not able to connect to internet...Please Help!
I switched from PC to mac today and bought a Mac Book. I have been trying to connect to network and have had no success. It identifies my network and asks for my WEP password, which I retrieved from my internet company. I tried with every type of sec