Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Download to Multiple sheets in Excel

Former Member
0 Kudos

Hi,

My requirement is to download 3 different data to three different sheets of the Excel.I have followed this weblog "/people/sudheer.junnuthula2/blog/2006/12/27/creating-excel-with-more-than-one-page " the problem is am getting the first sheet in the place of Sheet no.1 but the second and third sheets are just adding to the Excel ..that is

altogether am getting % sheets ,"Third ,Second,First,Sheet2,Sheet3 ".

What has to be done so that the second and third sheets come in the place of sheet2 and Sheet3.

Thanks in advance.

Bhanu.

1 ACCEPTED SOLUTION

former_member189059
Active Contributor
0 Kudos

Hello Bhanu,

The method i use is to create all the sheets first and then activate and use them as required

* creating sheets
  DO 3 TIMES.
    IF sy-index GT 1.
      CALL METHOD OF excel 'WORKSHEETS' = sheet.
      CALL METHOD OF sheet 'ADD'.
      FREE OBJECT sheet.
    ENDIF.
  ENDDO.



data: lv_count type i.
* using them
  count = 1.
  DO 3 TIMES.

    CALL METHOD OF excel 'WORKSHEETS' = sheet
      EXPORTING
        #1 = count.

    CASE count.
      WHEN '1'.
 "code
      WHEN '2'.
 "code
      WHEN '3'.
 "code

    ENDCASE.
    count = count + 1.

  ENDDO.

2 REPLIES 2

Former Member
0 Kudos

hi..

if u have output in ALV... u following steps r supposed to be followed...

-> click button 'change layout' (at output screen..)

-> deselect fields u dont want to be there in excel...

-> now it'll display selectd columns only...

-.> export list by ctrlshftf7...

->follow same for rest of the sheets....

if u have output thru script or smartform...then u cant split output in different excel sheet...it'll merge whole data in one sheet only...

revert back if it is not sufficient..

former_member189059
Active Contributor
0 Kudos

Hello Bhanu,

The method i use is to create all the sheets first and then activate and use them as required

* creating sheets
  DO 3 TIMES.
    IF sy-index GT 1.
      CALL METHOD OF excel 'WORKSHEETS' = sheet.
      CALL METHOD OF sheet 'ADD'.
      FREE OBJECT sheet.
    ENDIF.
  ENDDO.



data: lv_count type i.
* using them
  count = 1.
  DO 3 TIMES.

    CALL METHOD OF excel 'WORKSHEETS' = sheet
      EXPORTING
        #1 = count.

    CASE count.
      WHEN '1'.
 "code
      WHEN '2'.
 "code
      WHEN '3'.
 "code

    ENDCASE.
    count = count + 1.

  ENDDO.