How to download data from itab to Excel sheet..

Hi sap Experts,
I develop one report to download data from itab to excel sheet.I done it perfectly.
My doubt is in the excel sheet i need to put headings. and also at last i need to display total no.of Records.
Please help me how to do this.
     Thanks in Advance....
Thanks and Regards
Siri.......................

u can either use GUI_DOWNLOAD or the method below...just give a try
DATA:WK_string TYPE STRING.
DATA:Wk_EXT(4) TYPE C value '.xls'.
DATA:WK_path TYPE STRING.
DATA:wk_file_name type string.
data:wk_records type sy-tfill.
wk_file_name = 'Downloaded'.
describe table itab lines wk_records.
LOOP AT ITAB.
at first.
**Provide path
concatenate 'C:\' wk_file_name Wk_EXT into wk_path.
open dataset WK_path for output in text mode encoding default.
if sy-subrc  0.
write:'ERROR while opening dataset !!!!!!'.
EXIT.
endif.
CONDENSE wk_path.
**Heading Part
concatenate 'Part No' 'Description'
     into wk_string separated by cl_abap_char_utilities=>horizontal_tab.
endat.
**Data ITAB
CONCATENATE ITAB-MATNR itab-maktx into wk_string
     separated by cl_abap_char_utilities=>horizontal_tab.
transfer wk_string to WK_path.
at last.
clear wk_string.
Concatenate  'Records Passed:' wk_string into wk_string.
transfer wk_string to WK_path.
close dataset WK_path.
endat.
endloop.

Similar Messages

  • How to download data from spool to excel file

    Hi,
    I have requirement like....i need to download data from spool to excel file.
    Please let me know the process how to download...
    <removed by moderator>
    <removed by moderator>
    Thanks,
    Khasimsa
    Moderator message: please (re)search yourself before asking, do not assign priorities, do not offer re-ward
    locked by: Thomas Zloch on Sep 8, 2010 1:18 PM

    Hi try this way..
    *FM called that returns the Spool Request Number data into and internal table
      CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
        EXPORTING
          rqident              = p_spool                     "Spool Request Number
          first_line           = 1
        TABLES
          buffer               = it_spool_xls                            "Internal table that will have the Spool Request No data
        EXCEPTIONS
          no_such_job          = 1
          not_abap_list        = 2
          job_contains_no_data = 3
          selection_empty      = 4
          no_permission        = 5
          can_not_access       = 6
          read_error           = 7
          OTHERS               = 8.
    *To convert the spool data into excel format
      CALL FUNCTION 'SO_RAW_TO_RTF'
        TABLES
          objcont_old = it_spool_xls               "Internal table having spool data
          objcont_new = it_xls_spool.           "Int table having Excel format data converted from Spool data
    "call GUI down Load by passing  it_xls_spool
    Prabhudas

  • How to Save Data from DataGrid to Excel Sheet?

    Hi All,
    I am trying to use Adobe Flex 3.0 for making web pages.
    I want to save the data from DataGrid and Advanced DataGrid of Adobe Flex 3.0 to Excel Sheet file. I am trying Flex Help, but didn't find answer for it.
    In the application there is a button for 'save' by pressing which the 'Save As' window should appear.
    And giving the path to the '.xls' file, the data from DataGrid should be saved on that location in .xls format.
    This is my requirement.
    If anybody knows how to do this please help.
    Thank You,
    Sharad

    Hi
    Using document.applet.saveAsCSVFile(); code you can not get data in proper format.
    For  one of my application i have stored the data from Grid to excel.
    But i am not sure about Adobe Flex 3.0, my code will work or not.
    Also you need to make the "Initialize and Script Activex Control Not marked as Safe" as enabled in your IE.
    You can share ur email. So that i can send the code. Here I am not able to paste the code.
    Thanks

  • Download data from itab to excel in background (POINTS WILL BE REWARDED )

    Hi Guys...
    Is it possible to transfer data from an internal table to excel through a report which runs in background...???
    thnx in advance...

    Please refer following code.
    LOOP AT IT_EXCEL_LAYOUT.
      CONCATENATE: IT_EXCEL_LAYOUT-SLNO             ','
                   IT_EXCEL_LAYOUT-HERST            ','
                   IT_EXCEL_LAYOUT-QMNUM            ','
                   IT_EXCEL_LAYOUT-QERDAT           ','
                   IT_EXCEL_LAYOUT-AUFNR            ','
                   IT_EXCEL_LAYOUT-ERDAT            ','
                   IT_EXCEL_LAYOUT-EBELN            ','
                   IT_EXCEL_LAYOUT-AEDAT            ','
                   IT_EXCEL_LAYOUT-BELNR_M          ','
                   IT_EXCEL_LAYOUT-BSART            ','
                   IT_EXCEL_LAYOUT-MATNR            ','
                   IT_EXCEL_LAYOUT-TXZ01            ','
                   IT_EXCEL_LAYOUT-MTART            ','
                   IT_EXCEL_LAYOUT-MENGE            ','
                   IT_EXCEL_LAYOUT-CBAMT            ','
                   IT_EXCEL_LAYOUT-MMCRAMT          ','
                   IT_EXCEL_LAYOUT-CRN_NO           ','
                   IT_EXCEL_LAYOUT-MMDBAMT          ','
                   IT_EXCEL_LAYOUT-DBN_NO           ','
                   IT_EXCEL_LAYOUT-REJAMOUNT        ','
                   IT_EXCEL_LAYOUT-DBN_REJ_CODE_TEXT','
                   IT_EXCEL_LAYOUT-STAMT            ','
                   IT_EXCEL_LAYOUT-STXCAMT          ','
                   IT_EXCEL_LAYOUT-CRNNO            ','
                   IT_EXCEL_LAYOUT-LRNO             ','
                   IT_EXCEL_LAYOUT-LRDATE           ','
                   IT_EXCEL_LAYOUT-TRANSPORTERNAME
            INTO   IT_EXCEL-FLD.
          APPEND   IT_EXCEL.
    ENDLOOP.
    DATA:w_filename LIKE  CFFILE-FILENAME.
    CONCATENATE '/usr/sap/EC2/SYS/global/backup/'SY-UNAME '.csv' INTO w_filename.
    OPEN DATASET w_filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    IF SY-SUBRC = 0.
      LOOP AT IT_EXCEL.
         TRANSFER IT_EXCEL TO w_filename.
      ENDLOOP.
    ENDIF.
    CLOSE DATASET w_filename.
    It will help u to download data on to application server in csv format
    Regards,
    Swarup

  • How to download data from abap-ouput to excel sheet with logo

    how to download data from abap-ouput to excel sheet with standard logo
    Edited by: Harish Kasyap on Nov 18, 2008 8:19 AM
    Edited by: Harish Kasyap on Nov 18, 2008 8:20 AM

    For saving the report you can goto System -> List -> Save -> Local File -> Location where you want to save in your presentation server.
    You can also give a option in your selection screen to save the file to Presentation server using FM GUI_DOWNLOAD.
    Hope it helps.
    Thanks,
    Jayant.

  • How to download data from a an external hard drive ?j

    How to download data from an external hd ?

    You need to copy the data onto your computer and transfer it via that (either via iTunes, or if the app that you want to transfer the data to supports, via wifi). Like the previous reply said, you can't do it directly without a computer being involved.

  • How to download data from the icloud?

    How to download data from the icloud?

    Settings>General>Reset>reset all content and settings. When iPhone restarts you will guide to restore from iCloud backup

  • How to download Data from Database directly into excel

    I have a requirement to download very large quantity of data from database into Excel file.
    But condition is excel file should have only 65,536 rows in a single spread sheet(that's the limit i suppose),if i have more data points(rows) than it should be stored into different spreadsheet.......this continues so there can be many spread sheets in a single excel file.
    Data size can be 1 GB or more.
    Also specific naming conventions need to be followed for giving name to excel as well as different spread sheets in it.
    Please see if someone could help me out.

    Thanks for ur reply,
    But my requirement is to call "download to excel" method,in a java program on click by user for downloading an excel sheet on his machine.
    This is be done as part of a web application which is to be made (so can't open the excel first)

  • How to download data in Word or Excel file from webdynpro?

    Hello everybody,
    In my webdynpro application, I want to download my Table control data in word or excel file. Is there anyway to do this?
    Thanks in advance,
    Bhavik

    I am sorry.Please ignore this reply
    Please go through the following
    downloading internal table contents to excel sheet
    Regards,VIP
    Message was edited by: Anilkumar Vippagunta
    Message was edited by: Anilkumar Vippagunta

  • Download data from memory to Excel format.

    Hi Gurus,
        How can I download data from Memory( not in application server ) to Excel format ? Now I am using below function modules  but not coming in proper format.
    CALL FUNCTION 'LIST_FROM_MEMORY'
           TABLES
                listobject = listobject
           EXCEPTIONS
                OTHERS     = 1.
    CALL FUNCTION 'LIST_TO_ASCI'      "report to ASCII text
             TABLES
                  listasci           = listasci
                  listobject         = listobject
             EXCEPTIONS
                  empty_list         = 1
                  list_index_invalid = 2
                  OTHERS             = 3.

    Hi,
    use this function module.
    CALL FUNCTION  'SAPGUI_PROGRESS_INDICATOR'
    Regards,
    NNR.

  • Download data from ui to excel

    Hello Experts,
    We have a requirement wherein, we need to download data from SAP CRM Web-ui (Assignment Block/View) to excel sheet(CSV) using a custom button.
    Kindly help me in doing so.
    Thanks,
    Anubhuti Dixit

    Hey Guys,
    anybody has a answer on this issue?

  • Download data from cube to excel

    Hello gurus.
    I need to download data from a cube to excel... but is not possible to download all the data, because excel restrictions.
    Do you know a way to download all the data?
    Thanks in advance,
    Vitor Ramalho

    Open Hub Service can be invoked either directly as a transaction in the BW GUI
    ( RSBO ) or using the menu item u201CToolsu201D in the administrator workbench ( transaction
    RSA1 )
    Check the below link for further details.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7d63ec90-0201-0010-a2a7-898c08c589f8

  • How to download data from an internal table to a text

    Hi All,
    I want to download data  from an internal table to a text file.
    The fields should be pipe(|) separated. I have tried GUI_DOWNLOAD but it is not taking the field separator.
    The sample of the desired data that i require should be this way:-
    13456TR|M|COUP|MATERIAL|KGS
    Thanks in advance.
    Regards
    Satish.

    Hi,
    Try this..
    REPORT  zc1download message-id zc1dwnmsg.
    *& Declaration Section for the Tables *
    TABLES: makt.
    *& Declaration Section for the Internal Tables
    DATA: intab TYPE TABLE OF makt,
          wa_intab LIKE LINE OF intab,
          no_of_rec TYPE i,
          count TYPE i.
    DATA: BEGIN OF f_intab,
            str(255) TYPE c,
          END OF f_intab.
    DATA: t_intab LIKE TABLE OF f_intab,
          w_intab LIKE LINE OF t_intab,
          temp(255) TYPE c.
    FIELD-SYMBOLS: <f> TYPE ANY.
    *& Selection ScreenSection for the file download
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: file TYPE rlgrap-filename MEMORY ID file,
                tab RADIOBUTTON GROUP rad1 DEFAULT 'X',
                others RADIOBUTTON GROUP rad1,
                delimit TYPE c.
    SELECTION-SCREEN END OF BLOCK b1.
    START-OF-SELECTION.
      IF file IS INITIAL. " check to ensure file.
        MESSAGE i001.
        EXIT.
      ENDIF.
      IF others = 'X'.    " check to ensure delimiter.
        IF delimit = ' '.
          MESSAGE i002.
          EXIT.
        ENDIF.
      ENDIF.
      SELECT * FROM makt INTO TABLE intab.
      IF tab = 'X'.       " default delimiter tab is used
          CALL FUNCTION 'WS_DOWNLOAD'
          EXPORTING
            filename                = file
            filetype                = 'DAT'
            mode                    = 'A'
          TABLES
            data_tab                = intab
          EXCEPTIONS
            file_open_error         = 1
            file_write_error        = 2
            invalid_filesize        = 3
            invalid_type            = 4
            no_batch                = 5
            unknown_error           = 6
            invalid_table_width     = 7
            gui_refuse_filetransfer = 8
            customer_error          = 9
            no_authority            = 10
            OTHERS                  = 11.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ELSE.             " If user defind delimiter is to be used
                  Counts the number of fields                *
        DO.
          ASSIGN COMPONENT sy-index OF STRUCTURE wa_intab TO <f>.
          IF sy-subrc <> 0.
            EXIT.
          ELSE.
            count = count + 1.
          ENDIF.
        ENDDO.
        LOOP AT intab INTO wa_intab.
          DO count TIMES. " Adding the delimiter in required places
            ASSIGN COMPONENT sy-index OF STRUCTURE wa_intab TO <f>.
            CONCATENATE temp delimit <f> INTO temp.
          ENDDO.
          SHIFT temp.
          APPEND temp TO t_intab.
          CLEAR temp.
        ENDLOOP.
        CALL FUNCTION 'WS_DOWNLOAD'
          EXPORTING
            filename                = file
            filetype                = 'ASC'
            mode                    = 'A'
          TABLES
            data_tab                = t_intab
          EXCEPTIONS
            file_open_error         = 1
            file_write_error        = 2
            invalid_filesize        = 3
            invalid_type            = 4
            no_batch                = 5
            unknown_error           = 6
            invalid_table_width     = 7
            gui_refuse_filetransfer = 8
            customer_error          = 9
            no_authority            = 10
            OTHERS                  = 11.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDIF.
      WRITE:/ 'The Data has been tranfered to :', file.
    Cheers
    Kathir!~

  • How to export data from report to excel using report 10g

    Hi,
    usnig report 10g, can we export the data from report to excel.
    Regards
    Randhir

    Hi,
    have a look at metalink note 209770.1: Getting Reports Ouput to MS Excel - Techniques and References
    Regards
    Rainer

  • How to export the data from table to excel sheet

    hi experts i have some problem am trying to export the data fro table to Excel sheet  in the view controller i have created one button wit public void onActionCLEAR(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionCLEAR(ServerEvent)
       //wdContext.nodeBapi_Salesorder_Getlist_Input().
       //wdContext.nodeBapi_Salesorder_Getlist_Input().invalidate();
        //@@end
      //@@begin javadoc:onActionExporToExcel(ServerEvent)
      /** Declared validating event handler. */
      //@@end
      public void onActionExporToExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionExporToExcel(ServerEvent)
         try{
         FileOutputStream fos=new FileOutputStream("Test.xls");
          PrintStream ps=new PrintStream(fos);
          ps.println("<html><body><table border=1>");
          int size=wdContext.nodeBapi_Salesorder_Getlist_Input().size();
           Iterator attributes=wdContext.getNodeInfo().iterateAttributes();
           ps.println("<tr>");
           while(attributes.hasNext()){
            ps.println("<th>");
            DataAttributeInfo attrName=(DataAttributeInfo)attributes.next();
            ps.println(attrName.getName());
            ps.println("</th>");
           ps.println("</tr>");
          for(int i=0; i<wdContext.nodeBapi_Salesorder_Getlist_Input().size();i++)
            attributes=wdContext.getNodeInfo().iterateAttributes();
            ps.println("<tr>");
            IWDNodeElement ele=wdContext.getElementAt(i);
            while(attributes.hasNext()){
              ps.println("<td>");
              DataAttributeInfo attrName=(DataAttributeInfo)attributes.next();
              ps.println(""+ele.getAttributeAsText(attrName.getName()));
              ps.println("</td>");
            ps.println("</tr>");
           ps.println("</table></body></html>");
           ps.flush();
           ps.close();
           fos.close();
          catch(Exception e){
           wdComponentAPI.getMessageManager().reportException(e.getMessage(), false);
          finally{
         //return("Test.xls")  ;
        //@@end
      }h action and i have return the code
    its running sucessfully but am not able to perform the action plz help me

    Hi,
    You shouldn't use DataAttributeInfo as it is an internal object, if I'm correct.
    Use IWDAttributeInfo instead of DataAttributeInfo and it should work
    (See also API doc of IWDNodeInfo.iterateAttributes() at http://help.sap.com/javadocs/nwce/ce711sp02/wdr/com.sap.wdr/com/sap/tc/webdynpro/progmodel/api/IWDNodeInfo.html#iterateAttributes())
    Cheers,
    Robin

Maybe you are looking for