Download to multiple excel sheets

Hi all,
How can we download data to different sheets in one excel using 2 internal tables.
Thanks,
Rajesh.

Hi thanks for the reply,
i almost solved the problem, except i need to save the excel file in a particular directory.
what is the procedure. the following code dosen't do that.
this is my code.
data: begin of itab occurs 0,
      posnr like vbap-posnr,
      vbeln like vbak-vbeln,
      end of itab.
select vbeln
       posnr
       from vbap
       up to 20 rows
       into corresponding fields of table itab.
data : V_COL   LIKE SY-TABIX.     " column number of the cell
data : v_row  like sy-tabix.
data : zmeng like vbap-zmeng.
data : posnr1 like vbap-posnr.
data : count(3) type n.
DATA: gs_excel TYPE ole2_object ,
      H_CELL  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 .
DATA gv_sheet_name(20) TYPE c .
DATA gv_outer_index LIKE sy-index .
DATA gv_intex(2) TYPE c .
DATA gv_line_cntr TYPE i . "line counter
*PARAMETERS: p_sheets TYPE i .
data : p_sheets TYPE i .
START-OF-SELECTION .
sort itab by posnr.
loop at itab to 1.
posnr1 = itab-posnr.
endloop.
count = 1.
loop at itab.
at new posnr.
p_sheets = p_sheets + 1.
endat.
endloop.
DO p_sheets TIMES .
*--Forming sheet name
gv_intex = sy-index .
gv_outer_index = sy-index .
CONCATENATE 'Excel Sheet #' gv_intex INTO gv_sheet_name .
*--For the first loop, Excel is initiated and one new sheet is added
IF sy-index = 1 .
CREATE OBJECT gs_excel 'EXCEL.APPLICATION' .
SET PROPERTY OF gs_excel 'Visible' = 1 .
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' = gv_sheet_name .
*--For the rest of loops, other sheets are added
ELSE .
GET PROPERTY OF gs_wbook 'Sheets' = gs_sheets .
CALL METHOD OF gs_sheets 'Add' = gs_newsheet .
SET PROPERTY OF gs_newsheet 'Name' = gv_sheet_name .
ENDIF .
gv_line_cntr = 1 . "line counter
sort itab by posnr.
  LOOP AT ITAB where posnr = posnr1.
    V_COL = v_col + 1.
    PERFORM FILL_CELL USING v_col 1 ITAB-vbeln.
    PERFORM FILL_CELL USING v_col 2 ITAB-posnr.
    zmeng = zmeng + ITAB-posnr.
    at end of posnr.
      v_col = v_col + 1.
      PERFORM FILL_CELL USING v_col 2 zmeng.
      clear v_row.
      clear zmeng.
    endat.
  ENDLOOP.
  delete itab where posnr = posnr1.
  loop at itab to 1.
    posnr1 = itab-posnr.
  endloop.
clear v_col.
enddo.
*--Deallocating memory
FREE: gs_excel, gs_wbooklist, gs_application, gs_wbook,
gs_activesheet,gs_sheets, gs_newsheet.
FORM FILL_CELL USING  ROW COL VAL.
  CALL METHOD OF gs_EXCEL 'Cells' = H_CELL
                 EXPORTING #1 = ROW #2 = COL.
  PERFORM ERR_HDL.
  SET PROPERTY OF H_CELL 'Value' = VAL .
  PERFORM ERR_HDL.
ENDFORM.                    " FILL_CELL
FORM ERR_HDL.
  IF SY-SUBRC <> 0.
    WRITE: / 'Error in processing Excel File:'.
    STOP.
  ENDIF.
ENDFORM.
please send your suggestions,
rajesh.

Similar Messages

  • Download to multiple excel sheets in the backgraoud

    Hi,
    I am trying to download data into multiple excel sheets in the background. I was able to create comma delimited csv file in the server, which can be opened as excel file. This is good when it does not have more that one worksheets.
    I have three internal table and to send these internal tables in different worksheets in the same excel file.
    Is it possible to have multiple sheets excel file from the csv file?

    Check the following thread !!
    Re: Downloading data into excel
    Hope this’ll give you idea!!
    <b>P.S award the points.</b>
    Good luck
    Thanks
    Saquib Khan
    "Some are wise and some are otherwise"

  • Export in multiple excel sheets

    Hi,
    I am using crystal XI and need to export in multiple excel sheets from crystal. How can I do that, please help me.
    Thanks,
    Sagarika.

    One of the 3rd-party Crystal Reports desktop schedulers listed at http://kenhamady.com/bookmarks.html allows you to burst a report so that each group level 1 becomes a separate excel worksheet in a single workbook.  It also allows you to export a report to a worksheet inside an existing workbook.

  • Downloading data in excel sheet

    Hi All,
        I want to download data in excel sheet. My requirment is to use the same excle sheet to fill data.
    The next data should be entered in the column of the excel sheet. Is there a possible to write data in excel sheet at a particular row/column.
       Please let me know if this can be achevied?
    For Ex:
    Data: 10, 20, 30
    Excel sheet:
    10
    20
    30
    Data: 40, 50, 60
    Excel sheet:
    10          40
    20          50
    30          60
    Thanks & Regards,
    Rupali Ray

    Hi,
    This should be possible by OLE concept.
    Have a look at report RSDEMO01
    Regards

  • How to spool data into multiple Excel sheet if result is more then 65k rows

    Hi all,
    Wann spool data into multiple excel sheet bocz my resultant no of rows are more then 65k.
    Thanks to all in advance.....

    many choices
    1) migrate to a newer version of Excel
    2) split the files after spooling
    for instance with split
    split -l65000 file.txtor with perl, java, vb or what-so-ever
    3) do more than one report by using rownum
    spool f1
    select empno,ename  from (select rownum r,empno,ename from emp order by empno) where r<6 ;
    spool off
    spool f2
    select empno,ename  from (select * from (select rownum r,empno,ename from emp order by empno) where r<11) where r>5 ;
    spool off
    spool f3
    select empno,ename  from (select rownum r,empno,ename from emp order by empno) where r>10 ;
    spool off

  • How to uplaod multiple excel sheets in a program

    Hi gurus,
    Can anyone suggest me
    how to upload multiple excel sheets in program.( not in OOPS)
    my excel sheets has 5 sheets like sheet1, sheet2, sheet3 ....like this..
    Thanks & Regards
    kalyan.

    swc_container it_event_container.                       
    swc_create_container it_event_container.                 
    CALL FUNCTION 'SWW_WI_CONTAINER_READ'
                EXPORTING
                  wi_id                    = wd_id
                TABLES
                  wi_container             = it_event_container
                EXCEPTIONS
                  container_does_not_exist = 1
                  read_failed              = 2
                  OTHERS                   = 3.
    if sy-subrc = 0.
    READ TABLE it_event_container WITH KEY element = 'name of your workflow container element'.
                IF sy-subrc = 0.
                  w_variable= it_event_container-value.
                ENDIF.
    endif.
    Regards
    Kedar

  • Adding Multiple excel sheets

    Hi Experts,
    How i want to add multiple excel sheet in Xcelsius using liveoffice in single canvas.Hope i will expect good from you
    Regards,
    surigs

    Hi Surigs,
    Could you clarify what exactly you need? Do you mean adding multiple sheet? If yes, you can insert multiple sheet in the excel and add live office document.
    Thanks,
    Amit

  • Error in importing multiple excel sheets to SQL Server

    I have a package which imports multiple excel sheets to SQL server using a For each Container. However I am getting the following error message "Excel Source failed validation and returns validation status "VS-NEEDSNEWMETADATA".
    Can you please advise me of the steps to potentially resolve this issue ?
    Many thanks
    Scott

    Hi Scott,
    Based on your scenario, you need to implement dynamic columns mapping which is not natively supported by managed source/destination adapters. To achieve dynamic columns mapping, we need to make use of Script Component to parse the input columns and dynamically
    map them to the destination columns.
    References:
    http://munishbansal.wordpress.com/2009/06/09/dynamic-columns-mapping-%E2%80%93-script-component-as-destination-ssis/ 
    http://blog.quasarinc.com/ssis/best-solution-to-load-dynamically-change-csv-file-in-ssis-etl-package/ 
    http://stackoverflow.com/questions/13836874/script-task-in-dft-doesnt-get-excecuted 
    Regards,
    Mike Yin
    TechNet Community Support

  • Loading Multiple excel sheets in to different tables in a DB

    Hi All,
    I have problem in loading multiple excel sheets data in to according to that excelsheets tables in a DB.
    All the excel sheets are in a folder,from that folder i have to  acces all excel sheets.
    For this i am unsing script task and one dataflow task.
    But the error is coming in script task i am not able to put the path in the script..
    Is this the correct way to do like this? Or any other way?
    Can u please tell me the solution for this..Thanks in advance who are responding to this mail...
    Maruthi..

    Hi Vipin,
    Here you go with this requirement
    How to Load Multiple Sheets From Multiple Excel Files to Different Tables in SSIS Package?
    ttps://www.youtube.com/watch?v=1WXKpkwjhX8&feature=youtu.be
    I have other videos as well where you want to load all the sheets from file/s to same table 
    https://www.youtube.com/watch?v=F3sYO-S9icc&feature=youtu.be
    Check out the last links on below links all related to Excel
    http://sqlage.blogspot.com/search/label/SSIS%20Videos
    How to Create Excel file with Date-time on Each Package Execution in SSIS Package?
    How to Load Multiple Sheets to a SQL Server Table in SSIS Package?
    How to Load Data Excel File to SQL Server Table and Solve Data Conversion Issues?
    How to Load Multiple Sheets From Multiple Excel Files to Different Tables in SSIS Package?
    How to Load Data to Pre-Formatted Excel Sheet (Excel Report) in SSIS Package?
    All the best!
    http://sqlage.blogspot.com/

  • Export to Multiple Excel Sheets

    I would like to be able to export a report (or analysis) to multiple excel sheets.
    I have 2 options, 'Answers' and 'BI Publisher'. Ideally I would like to use answers, but will use Publisher if necessary.
    Is there an easy way to export reports to multiple excel sheets?

    Hi jitapong,
    When a Web Intelligence document is exported to a Microsoft Excel Workbook, the export is handled by the Web Intelligence report engine. Excel is not required to be installed on the machine to execute the export. So, regardless of whether Excel 2003 , Excel 2007, or no Excel is installed, the export is performed using the parameters built into the report engine. This export is done in the Excel 97-2003 format.
    A limitation of pre-2007 Excel is the inability to create a worksheet greater than 65,535 rows long. Excel 2007 overcomes that inability thus allowing users to create worksheets of much greater length.
    Resolution:
    Web Intelligence 3.1 versions overcome the 65,000 row limitation by exporting the document to multiple worksheets within the Excel Workbook. Each worksheet will be 65,535 rows long. For example, if a query returns 150,000 rows of data the resultant export to Microsoft Excel would produce a single workbook with 3 worksheets. 2 worksheets of 65,535 rows and 1 worksheet of 18,930 rows. This export is compatable with Excel 2003 and 2007.
    Regards,
    Chirag

  • How to download background o/p in multiple excel sheet?

    hi every body,
                                I am sandipan. I am very new in this field. My  requirement is  a report is showing total  sales report. Fields are kunag, vbeln, name1, netwr and many more fields are there   and it executing in background schdule . After  executing In background it shows the output  sm37  and i have to download this report in different excel sheet from application tool bar  in  sm37  . report will download according to kunag inr different excel sheet. for example- suppose there are 100 kunag. so there will be 100 excel sheet and the name of the  excel sheet according to customer id  means diff. customer id so different excel sheet . how is it  possible ?  please guide me with your valuable suggestion.
                                                                                    thank you.

    Hi,
    Before posting try to search in SCN next time.
    Go through below link, it may help you.
    [excel_sheets|http://www.sapdev.co.uk/ms/ms_excel.htm]

  • Avoid splitting of columns ALV report while download output to Excel sheet

    Hi friends,
                  I have 170 columns in my ALV report
    while downloading the report to Excel sheet
    the column descriptions and values are splitting in two lines.
    How can i avoid the problem.
    before calling REUSE_ALV_GRID_DISPLAY function module in my code
    for the Layout i assigned LS_LAYOUT-MAX_SIZE = 1023.
    but still the problem is not solved.
    Please help me in this Issue.
    Thanks in Advance,
    Ganesh

    Hi friends,
    I dont want to use and Keyboard shiftcntrl....
    or dont want to change any code in ALV report
    by simply assigning some value to any of the export parameter in ALV function module
    can we achieve the functionality
    Thanks in Advance,
    Ganesh

  • How can i download data in excel sheet .

    Hi all
    My Requirement : In a selection screen after giving a VBELN,It will show all the related data from VBRP table through alv  . There are a customize icon ,after clicking the icon it will download all fetched data .
    Can any one help me .how can i download the fetched data through excel ?
    Regards
    Rajesh .

    Hi Rajesh,
    I understood your requirement as from ALV you want to download the data to an Excel sheet.
    In standard ALVs, you need to do this
    In other cases like Z programs etc, often Icon is provided  (as you said) like this
    You need to select Local File option here as shown below
    In both case you will get this pop-up
    Now when you continue you will get SAVE dialog-box, where you can give a name to your excel file and Save.
    Hope this is your query.
    Jogeswara Rao K

  • How to Restict number of rows to download data in excel sheet

    hi,
    my requirement is that i m showing top 50 seller in my dashboard. but when we click on download to excel then all 500 rows are downloading. i want to restrict downloading all data and want show only displayed data of dashboard in excel sheet.(ex if 50 top seller are selected then only 50 rows is downloaded.)
    Edited by: 941334 on Jun 18, 2012 6:15 AM

    Hi,
    Yes.my suggestion is you set each report design analysis page itself(just to -->edit analysis-->look at the table propeties -->here u can set it how ever you want(50 rows, 500 rows etc..analysis visible page) to show/download it as per your requirment.
    Changing instance confic will affect entire report.for controling this you can set dashboard/prompt filter then you control data downloading.
    Check Oracle Doc for more info
    http://docs.oracle.com/cd/E23943_01/bi.1111/e10541/answersconfigset.htm#CIHJGAAH
    -----------------------------------FYI------------------
    Just FYI:If you have bulk volum of data like more than 8MB then you have increase the download size
    steps configure bulk volumn data more than 8MB:
    go to you bi installed drive \oracle\instances\instance1\config\OracleBIJavaHostComponent\coreapplication_obijh1\
    2. Open config.xml file in an editor and search for the below lines
    <XMLP> <InputStreamLimitInKB>8192</InputStreamLimitInKB>
    <ReadRequestBeforeProcessing>true</ReadRequestBeforeProcessing> </XMLP>
    3. The default size is 8 MB, you can increase to the size you want. If you want to set unlimited, then replace 8192 with 0 (zero) but it’s not recommended (performance may impact) then Restart BI Service and test .
    Thanks
    Deva

  • How can I download to one excel sheet from more than two table?

    Hi.
    as you know
    <SAP_BW_URL CMD='EXPORT' FORMAT='XLS' DATA_PROVIDER='DATAPROVIDER_T1' >
    this script can make download excel sheet which is same cotents of table or chart in web template.
    but if template has more than two tables how can we get excel sheet from tables?
    <SAP_BW_URL CMD='EXPORT' FORMAT='XLS' DATA_PROVIDER_1='DATAPROVIDER_T1' DATA_PROVIDER_2='DATAPROVIDER_T2'>
    I hope this gonna work but result was fail same as I expected.
    is there any way put two tables download one excel sheet?

    Welcome to SDN.
    Post this in Business Explorer forum for quicker resposne.
    SAP Business Explorer (SAP BEx)
    Regards
    Raja

Maybe you are looking for

  • Purchase order through E-mail

    Dear all, I have created one message condition type ZMAI copying from NEU for purchase order output and assigned output mode as 5-External send.Communication strategy i have given as CS01.Condition records i have maintained in MN04.My purchase orders

  • CI issues on Linux - CentOS + Hudson

    Hi there, I got some issues to generate the Junit reports, it gets up to "Waiting for client connection" then do nothing for a few seconds. When it gets back this is what I get in the console: runUnitTests:      [java] Loading configuration file /opt

  • c:import character encoding problem (utf-8)

    Aloha @ all, I am currently importing a file using the <c:import> functionallity (<c:import url="module/item.jsp" charEncoding="UTF-8">) but it seems that the returned data is not encoded with utf-8 and hence not displayed correctly. The overall file

  • WD component build error

    Hi all, In my process I have a webDynpro component in which I am uploading an xls file and populate a table. I have downloaded the jlx.jar library, added it to the build path of my component, as well as copying it in the lib folder. But when I try to

  • How to use a third party jar, which is added to classpath at runtime.

    Hi I'm using the classpathhacker posted on the forums somewhere, and want to use the jexcel driver. What I want is to be able to use the excel functions only if the excel driver is availlable. The problem now is that to be able to use the excel funct