<?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 how we can rectify this in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-we-can-rectify-this/m-p/2845445#M666562</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the program we upload the contract details from an excel sheet into the R/3.&lt;/P&gt;&lt;P&gt;The excel sheet is having 2 pages..1. contract header and 2.contract header conditions.&lt;/P&gt;&lt;P&gt;But in the program we are trying to upload a third page which contains item details. But in the excel sheet we have no maintained a third page because of which the programs gives a short dump.&lt;/P&gt;&lt;P&gt;CALL METHOD OF l_v_application 'WORKSHEETS' = l_v_sheet EXPORTING #1 =3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here 3 indicated the page 3 in the excel sheet which is not there and hence going to  a dump.&lt;/P&gt;&lt;P&gt;How can we avoid this&amp;#133;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Oct 2007 09:55:42 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-10-03T09:55:42Z</dc:date>
    <item>
      <title>how we can rectify this</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-we-can-rectify-this/m-p/2845445#M666562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the program we upload the contract details from an excel sheet into the R/3.&lt;/P&gt;&lt;P&gt;The excel sheet is having 2 pages..1. contract header and 2.contract header conditions.&lt;/P&gt;&lt;P&gt;But in the program we are trying to upload a third page which contains item details. But in the excel sheet we have no maintained a third page because of which the programs gives a short dump.&lt;/P&gt;&lt;P&gt;CALL METHOD OF l_v_application 'WORKSHEETS' = l_v_sheet EXPORTING #1 =3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here 3 indicated the page 3 in the excel sheet which is not there and hence going to  a dump.&lt;/P&gt;&lt;P&gt;How can we avoid this&amp;#133;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2007 09:55:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-we-can-rectify-this/m-p/2845445#M666562</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-03T09:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: how we can rectify this</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-we-can-rectify-this/m-p/2845446#M666563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try to check a sy-subrc .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please reward if useful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2007 11:29:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-we-can-rectify-this/m-p/2845446#M666563</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-03T11:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: how we can rectify this</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-we-can-rectify-this/m-p/2845447#M666564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abhishek&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check this code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is taken from Rich Heilman...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report zole123.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;INCLUDE ole2incl.&lt;/P&gt;&lt;P&gt;DATA:  count TYPE i,&lt;/P&gt;&lt;P&gt;       application TYPE ole2_object,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       workbook TYPE ole2_object,&lt;/P&gt;&lt;P&gt;       excel     TYPE ole2_object,&lt;/P&gt;&lt;P&gt;       sheet TYPE ole2_object,&lt;/P&gt;&lt;P&gt;       cells TYPE ole2_object.&lt;/P&gt;&lt;P&gt;CONSTANTS: row_max TYPE i VALUE 256.&lt;/P&gt;&lt;P&gt;DATA index TYPE i.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DATA: BEGIN OF itab1 OCCURS 0, first_name(10), END OF itab1.&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF itab2 OCCURS 0, last_name(10), END OF itab2.&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF itab3 OCCURS 0, place(50), END OF itab3.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;*START-OF-SELECTION&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  APPEND: 'name1' TO itab1, 'surname1' TO itab2,&lt;/P&gt;&lt;P&gt;                              'worli' TO itab3,&lt;/P&gt;&lt;P&gt;            'nam2' TO itab1, 'surname2' TO itab2,&lt;/P&gt;&lt;P&gt;                              'chowpatty' TO itab3,&lt;/P&gt;&lt;P&gt;           'name3' TO itab1, 'surname3' TO itab2,&lt;/P&gt;&lt;P&gt;                              'versova' TO itab3,&lt;/P&gt;&lt;P&gt;            'name4' TO itab1, 'surname4' TO itab2,&lt;/P&gt;&lt;P&gt;                              'grant road' TO itab3,&lt;/P&gt;&lt;P&gt;            'name5' TO itab1, 'surname5' TO itab2,&lt;/P&gt;&lt;P&gt;                              'gaon' TO itab3,&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;            'name6' TO itab1, 'surname6' TO itab2,&lt;/P&gt;&lt;P&gt;                              'mahim' TO itab3.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; CREATE OBJECT application 'excel.application'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; SET PROPERTY OF application 'visible' = 1.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; CALL METHOD OF application 'Workbooks' = workbook.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; CALL METHOD OF workbook 'Add'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  CREATE OBJECT excel 'EXCEL.APPLICATION'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;    WRITE: / 'No EXCEL creation possible'.&lt;/P&gt;&lt;P&gt;    STOP.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  SET PROPERTY OF excel 'DisplayAlerts' = 0.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  CALL METHOD OF excel 'WORKBOOKS' = workbook .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  SET PROPERTY OF excel 'VISIBLE' = 1.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Create worksheet&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  SET PROPERTY OF excel 'SheetsInNewWorkbook' = 1.&lt;/P&gt;&lt;P&gt;  CALL METHOD OF workbook 'ADD'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  DO 3 TIMES.&lt;/P&gt;&lt;P&gt;IF sy-index GT 1.&lt;/P&gt;&lt;P&gt;      CALL METHOD OF excel 'WORKSHEETS' = sheet.&lt;/P&gt;&lt;P&gt;      CALL METHOD OF sheet 'ADD'.&lt;/P&gt;&lt;P&gt;      FREE OBJECT sheet.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDDO.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  count = 1.&lt;/P&gt;&lt;P&gt;  DO 3 TIMES.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    CALL METHOD OF excel 'WORKSHEETS' = sheet&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        #1 = count.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   perform get_sheet_name using scnt sname.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CASE count.&lt;/P&gt;&lt;P&gt;      WHEN '1'.&lt;/P&gt;&lt;P&gt;        SET PROPERTY OF sheet 'NAME' = 'firstName'.&lt;/P&gt;&lt;P&gt;        CALL METHOD OF sheet 'ACTIVATE'.&lt;/P&gt;&lt;P&gt;        " add header here&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;        LOOP AT itab1.&lt;/P&gt;&lt;P&gt;          index = row_max * ( sy-tabix - 1 ) + 1. " 1 - column name " for headings change the - 1 to + 1 to accomodate 2 extra lines&lt;/P&gt;&lt;P&gt;          CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.&lt;/P&gt;&lt;P&gt;          SET PROPERTY OF cells 'Formula' = itab1-first_name.&lt;/P&gt;&lt;P&gt;          SET PROPERTY OF cells 'Value' = itab1-first_name.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;        ENDLOOP.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;      WHEN '2'.&lt;/P&gt;&lt;P&gt;        SET PROPERTY OF sheet 'NAME' = 'LastName'.&lt;/P&gt;&lt;P&gt;        CALL METHOD OF sheet 'ACTIVATE'.&lt;/P&gt;&lt;P&gt; " add header here&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;        LOOP AT itab2.&lt;/P&gt;&lt;P&gt;          index = row_max * ( sy-tabix - 1 ) + 1. " 1 - column name " for headings change the - 1 to + 1 to accomodate 2 extra lines&lt;/P&gt;&lt;P&gt;          CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.&lt;/P&gt;&lt;P&gt;          SET PROPERTY OF cells 'Formula' = itab2-last_name.&lt;/P&gt;&lt;P&gt;          SET PROPERTY OF cells 'Value' = itab2-last_name.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;        ENDLOOP.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;      WHEN '3'.&lt;/P&gt;&lt;P&gt;        SET PROPERTY OF sheet 'NAME' = 'place'.&lt;/P&gt;&lt;P&gt;        CALL METHOD OF sheet 'ACTIVATE'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; " add header here&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;        LOOP AT itab3.&lt;/P&gt;&lt;P&gt;          index = row_max * ( sy-tabix - 1 ) + 1. " 1 - column name " for headings change the - 1 to + 1 to accomodate 2 extra lines&lt;/P&gt;&lt;P&gt;          CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.&lt;/P&gt;&lt;P&gt;          SET PROPERTY OF cells 'Formula' = itab3-place.&lt;/P&gt;&lt;P&gt;          SET PROPERTY OF cells 'Value' = itab3-place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        ENDLOOP.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    ENDCASE.&lt;/P&gt;&lt;P&gt;    count = count + 1.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  ENDDO.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Save excel speadsheet to particular filename&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  GET PROPERTY OF excel 'ActiveSheet' = sheet.&lt;/P&gt;&lt;P&gt;  CALL METHOD OF sheet 'SaveAs'&lt;/P&gt;&lt;P&gt;                   EXPORTING #1 = 'c:\temp\exceldoc1.xls'     "filename&lt;/P&gt;&lt;P&gt;                             #2 = 1.                          "fileFormat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: to make headings, change the -1 to +1 where specified in the above code and add the following where i have mentioned to add it&lt;/P&gt;&lt;P&gt;index = row_max * ( sy-tabix - 1 ) + 1.&lt;/P&gt;&lt;P&gt; CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.&lt;/P&gt;&lt;P&gt; SET PROPERTY OF cells 'value' = header1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2007 11:40:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-we-can-rectify-this/m-p/2845447#M666564</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-03T11:40:13Z</dc:date>
    </item>
  </channel>
</rss>

