<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic OLE programming - read data from EXCEL file in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/ole-programming-read-data-from-excel-file/m-p/4038694#M965307</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have some requirement like this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Open an Excel document, read data from one of the cells and close the document. There are two more things I need to take care of with this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. After I read the data from a document, I need to take that document and put it somewhere else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. There could be any number of Excel documents in the folder on my PC. I would not have the file names in my hand. I've to read all the documents that are in the folder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any thoughts with sample code is appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Jun 2008 13:17:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-20T13:17:15Z</dc:date>
    <item>
      <title>OLE programming - read data from EXCEL file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ole-programming-read-data-from-excel-file/m-p/4038694#M965307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have some requirement like this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Open an Excel document, read data from one of the cells and close the document. There are two more things I need to take care of with this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. After I read the data from a document, I need to take that document and put it somewhere else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. There could be any number of Excel documents in the folder on my PC. I would not have the file names in my hand. I've to read all the documents that are in the folder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any thoughts with sample code is appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 13:17:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ole-programming-read-data-from-excel-file/m-p/4038694#M965307</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T13:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: OLE programming - read data from EXCEL file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ole-programming-read-data-from-excel-file/m-p/4038695#M965308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see these: [https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/how%2bto%2bread%2bexcel%2bfile%2bfrom%2bapplication%2bor%2bpresentation%2bserver%2band%2bdownload%2binto%2binternal%2btable.]&lt;/P&gt;&lt;P&gt;[/people/subramanian.venkateswaran2/blog/2006/10/02/enhanced-file-upload--uploading-and-processing-excel-sheets]&lt;/P&gt;&lt;P&gt;[/people/kathirvel.balakrishnan2/blog/2006/05/08/data-upload-into-sap-from-microsoft-excel-150-abap-part]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 13:40:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ole-programming-read-data-from-excel-file/m-p/4038695#M965308</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T13:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: OLE programming - read data from EXCEL file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ole-programming-read-data-from-excel-file/m-p/4038696#M965309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hiii&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can open &amp;amp; display data by using following code in excel file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA:
 excel       TYPE ole2_object,
 workbook    TYPE ole2_object,
 book        TYPE ole2_object,
 activesheet TYPE ole2_object,
 range       TYPE ole2_object,
 cell        TYPE ole2_object,
 bold        TYPE ole2_object,
 w_temp     TYPE ole2_object,         " OLE Object for Sheet
 w_sheet    TYPE ole2_object,         " OLE Object for Sheet
 interior    TYPE ole2_object.
******Here Fetch data from table********

LOOP AT t_material.
    MOVE 1 TO  w_col_num.
    ADD  1 TO  w_row_num.
* For selecting the cell
    CALL METHOD OF excel 'CELLS' = cell NO FLUSH
      EXPORTING
        #1 = w_row_num
        #2 = w_col_num.
    SET PROPERTY OF cell 'NumberFormat' = '@'.
    SET PROPERTY OF cell 'VALUE'               = t_material-matnr.
    SET PROPERTY OF cell 'HorizontalAlignment' =  -4108.
    SET PROPERTY OF cell 'ColumnWidth'         = 12.
.


* For displaying the matnr information in the cell.
    ADD 1 TO w_col_num.
    MOVE w_row_num TO w_char.
    CONCATENATE 'B' w_char  INTO w_cell1.
    CONCATENATE 'D' w_char  INTO w_cell2.

* Merging third(b1), fouth(c1) cells of row one.
    CALL METHOD OF excel 'range' = range NO FLUSH
      EXPORTING
        #1 = w_cell1
        #2 = w_cell2.
    CALL METHOD OF range 'merge'.

* For bordering the material description
    CALL METHOD OF RANGE 'BORDERAROUND'
      EXPORTING
       #1 = 1
       #2 = 2
       #3 = -4105
       #4 = 35000.

* For putting the data inthe corresponding cell.
    CALL METHOD OF excel 'CELLS' = cell NO FLUSH
      EXPORTING
        #1 = w_row_num
        #2 = w_col_num.
    SET PROPERTY OF cell 'VALUE'               = t_material-maktx.
    SET PROPERTY OF cell 'HorizontalAlignment' =  -4108.
    SET PROPERTY OF cell 'ColumnWidth'         = 12.

  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if useful&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;&lt;P&gt;twinkal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 13:47:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ole-programming-read-data-from-excel-file/m-p/4038696#M965309</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T13:47:22Z</dc:date>
    </item>
  </channel>
</rss>

