Sitemap

Amicuk Programming Answers

Download Internal table to Excel with different Tabs -  ole2_object

-0001-11-30   Views:0

Advertisement

Hi All, I am using  ole2_object to download the data from internal table to Excel file. As per different values in sorting key, data will be downloading in different tab in same Excel file. In my internal table one field is of character type and some

Hi All,
I am using  ole2_object to download the data from internal table to Excel file. As per different values in sorting key, data will be downloading in different tab in same Excel file.
In my internal table one field is of character type and some times contains number as value.
e.g.  itab-code = ‘000002’.
While downloading to Excel, Excel consider this value as numeric and remove the leading zero.
Any suggestions for how to set format property as ‘Text’ for this cell, will highly appreciated.
Sample  code -
   data: gs_excel type ole2_object,
         gs_wbooklist type ole2_object,
         gs_application type ole2_object,
         gs_wbook type ole2_object,
         gs_activesheet type ole2_object,
         gs_sheets type ole2_object,
         gs_newsheet type ole2_object,
         gs_cell type ole2_object.
   create object gs_excel 'EXCEL.APPLICATION'.
   get property of gs_excel 'workbooks' = gs_wbooklist.
   get property of gs_wbooklist 'Application' = gs_application.
   set property of gs_application 'SheetsInNewWorkbook' = 1.
   call method of gs_wbooklist 'Add' = gs_wbook.
   get property of gs_application 'ActiveSheet' = gs_activesheet.
   set property of gs_activesheet 'Name' = datasheet_name.
  call method of gs_excel 'Cells' = gs_cell exporting #1 = v_row           
                                          #2 = v_col.
  set property of gs_cell 'value' = <f>.
GET PROPERTY OF gs_cell 'Font' = gs_Font.
SET PROPERTY OF gs_Font 'Bold' = 1 .
Thanks.
Regards,
Meenakshi.

The replay answer
Advertisement
Hello,
Just concatenate ' infont of the fields, which you want to treat as a text.
Like,
itab-code = '00002'.
concatenate '''' itab-code  into itab-code.
modify itab.
You can also set the text properties of the cell by,
  SET PROPERTY OF gs_cell 'NumberFormat' = '@' .
but, it will remove the leading zeros and set the format as text.
Regards,
Naimesh

Go to See the other 3 answers

Hot
Hello, I just registered and would like to ask two questions. Everything else I'll use the search function for but I need the answer right away. Ok First question. I have a mac pro at home and a intel macbook both with FCS4 during the holiday season [More]
I use the BADI  ME_GUI_PO_CUST added customer subscreen ( new TAB) on the PO item detail.  if PO order type is NB ,  the TAB can show both me23n and me22n . if  PO order type is UB  , the TAB can show ME23N , but can't show ME22N .    Please Help, th [More]
This thread regards ISE operation (and options) where a policy node becomes unavailable - so, in the case of either a single standalone ISE appliance (no HA), or more often a PSN becoming unavailable due to a WAN failure to a remote branch. The inten [More]
Dear All, My database is 10gR2 and Linux is the operating system. One of my table in production database is huge and contains lot of data. Table is growing on daily basis. There are many queries that users execute on this table and the criteria of se [More]
I have a richtextarea field and whenever I load it to edit existing text I get an alert that says "Error in fieldname text." If I click the OK button everything works fine but is driving my users crazy. I do not get this error in Firefox or Safa [More]
Hi guys I need to know how can I make a image like this one http://img31.imageshack.us/img31/2710/69823211.gif I need step by step instructions please. How can I animate it like that? Whats the font? Tell me everything please.To do a step by step ins [More]
Hiho, is there a way to set the compression or quality of a jpeg image that is requested using the MapViewer JavaBean API? Thx in advance, DirkHi Dirk, in MapViewer you can apply some image processing operations on GeoRaster (contrast, linear stretch [More]
Hi All, I'm new to Engineer To Order (ETO) and Make To Order (MTO) Costing and my client like to implement ETO and MTO costing with Project Systems(PS) integration. Any one worked on these proccess? and if you have Blue Print Documents, Business Proc [More]
hi, I have a problem with the billing output YCTD appearing for lump sum agreements. Is there any way i can reconfigure this output type so it does not appear for the billing type? points will be rewarded generouslyhello, if you have an output in a d [More]
i created a business closure in crm 2015 on a particular date,business closure is associating successfully with facility and equipment's but not associating with users. So how can be set business closure for a users ????Hello, The TechNet Wiki Discus [More]