02-12-2007 6:49 AM
Hi All,
I am sending a mail to SAP inbox with an excel Sheet as an attachment.
I am creating the Excel sheet Dynamically from the internal table,
Now the Problem is the Headings i am putting in each colum are mixed with the data of the colums,
So I have to make the headings<b> BOLD</b> or atleast I have to Differentiate them with the rest of the Data,
Please Help me out in this,
Thanx, Girish.
02-12-2007 6:55 AM
03-14-2007 9:45 AM
Hi,
This is working fine but I want to know how can we transfer this file data to apllication server corresponding as we do with normal open-dataset ....
thanks in advance
02-12-2007 6:56 AM
Hi ,
Using OLE you can as follows.
ii. Setting attribute bold
SET PROPERTY OF gs_font 'Bold' = '1' .
Here, it is seen that to retrieve lower level instances we use GET PROPERTY OF statement. One will ask how to instantiate selection object which seems to be the topmost object, although in the whole picture it is not. This object is reached following the class hierarchy from the root OLE object created for the application. This procedure is illustrated in code parts in following sections.
*--Reseting font attributes for the title
SET PROPERTY OF gs_font 'Name' = 'Times New Roman' .
SET PROPERTY OF gs_font 'Size' = '16' .
SET PROPERTY OF gs_font 'Bold' = '1' . "Bold
SET PROPERTY OF gs_font 'Italic' = '0' . "Not Italic
SET PROPERTY OF gs_font 'Underline' = '0' . "Not underlined
PLease reward if useful.
02-12-2007 7:18 AM
Hi Dinesh,
Can u give me any Examle code for the OLE u gave,
i just wanted to know the type of "gs_font" an the other mandatory things.
Girish.
02-12-2007 8:42 AM
Hi Girish,
Check out the example.gs_font is marked in bold
Code Part B.1 Data declarations
REPORT zole_tutor_example_ms_word .
*--Include for OLE-enabling definitions
INCLUDE ole2incl .
*--Global variables
*--Variables to hold OLE object and entity handles
DATA gs_word TYPE ole2_object . "OLE object handle
DATA gs_documents TYPE ole2_object . "Documents
DATA gs_actdoc TYPE ole2_object . "Active document
DATA gs_application TYPE ole2_object . "Application
DATA gs_options TYPE ole2_object . "Application options
DATA gs_actwin TYPE ole2_object . "Active window
DATA gs_actpan TYPE ole2_object . "Active pane
DATA gs_view TYPE ole2_object . "View
DATA gs_selection TYPE ole2_object . "Selection
<b>DATA gs_font TYPE ole2_object . "Font</b>
DATA gs_parformat TYPE ole2_object . "Paragraph format
DATA gs_tables TYPE ole2_object . "Tables
DATA gs_range TYPE ole2_object . "Range handle for various ranges
DATA gs_table TYPE ole2_object . "One table
DATA gs_table_border TYPE ole2_object . "Table border
DATA gs_cell TYPE ole2_object . "One cell of a table
DATA gs_paragraph TYPE ole2_object . "Paragraph
DATA gv_pos(5) TYPE n . "Position information for table
Step 2 Creating the OLE object and get main entities to handle variables.
START-OF-SELECTION .
*--Creating OLE object handle variable
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' .
*--Getting active document handle
GET PROPERTY OF gs_word 'ActiveDocument' = gs_actdoc .
*--Getting applications handle
GET PROPERTY OF gs_actdoc 'Application' = gs_application .
Code Part B.2 Creating the OLE object
Step 3 Setting the measurement unit to CM.
Code Part B.3 Setting measurement unit
*--Setting the measurement unit
GET PROPERTY OF gs_application 'Options' = gs_options .
SET PROPERTY OF gs_options 'MeasurementUnit' = '1' . "CM
Step 4 Some header text.
Code Part B.4 Setting header content
*--Getting handle for the selection which is here the character at the
*--cursor position
GET PROPERTY OF gs_application 'Selection' = gs_selection .
GET PROPERTY OF gs_selection 'Font' = gs_font .
GET PROPERTY OF gs_selection 'ParagraphFormat' = gs_parformat .
*--Setting font attributes
SET PROPERTY OF gs_font 'Name' = 'Arial' .
SET PROPERTY OF gs_font 'Size' = '10' .
SET PROPERTY OF gs_font 'Bold' = '0' . "Not bold
SET PROPERTY OF gs_font 'Italic' = '1' . "Italic
SET PROPERTY OF gs_font 'Underline' = '0' . "Not underlined
*--Setting paragraph format attribute
SET PROPERTY OF gs_parformat 'Alignment' = '2' . "Right-justified
CALL METHOD OF gs_selection 'TypeText'
EXPORTING
#1 = 'This is an OLE example!'.
*--Setting the view to the main document again
SET PROPERTY OF gs_view 'SeekView' = '0' . "Main document view
Step 5 Writing the title.
Code Part B.5 Writing the title
*--Reseting font attributes for the title
SET PROPERTY OF gs_font 'Name' = 'Times New Roman' .
SET PROPERTY OF gs_font 'Size' = '16' .
SET PROPERTY OF gs_font 'Bold' = '1' . "Bold
SET PROPERTY OF gs_font 'Italic' = '0' . "Not Italic
SET PROPERTY OF gs_font 'Underline' = '0' . "Not underlined
*--Setting paragraph format attribute
SET PROPERTY OF gs_parformat 'Alignment' = '1' . "Centered
CALL METHOD OF gs_selection 'TypeText'
EXPORTING
#1 = text-000.
*--Advancing cursor to the new line
CALL METHOD OF gs_selection 'TypeParagraph' .
Step 6 Writing some text.
Code Part B.6 Writing some text
*--Reseting font attributes for ordinary text
SET PROPERTY OF gs_font 'Name' = 'Times New Roman' .
SET PROPERTY OF gs_font 'Size' = '12' .
SET PROPERTY OF gs_font 'Bold' = '0' . "Not bold
SET PROPERTY OF gs_font 'Italic' = '0' . "Not Italic
SET PROPERTY OF gs_font 'Underline' = '0' . "Not underlined
Please reward if useful.
03-14-2007 9:43 AM
Hi,
How can we store this XL after formatting into application server...I mean how can we transfer the data to application server..
Thanks in advance