How to download the output of a report along with column header

Hi,
Could someone please tell me on how to download the output of a report along with column header to .txt format. A download option needs to be given to the user using physical and logical file names .The report basically contains header details and item details and requirement is to download the same format into an .txt format.

Hello,
Try this FM:
Data: being of itab occurs 0,
matnr like mara-matnr,
maktx like makt-maktx,
end of itab.
data:begin of fld_tab occurs 0,
fld_name(20),
end of fld_tab.
fld_tab = 'Material'.
append fld_tab.
fld_tab = 'Material Desc'.
append fld_tab.
CALL FUNCTION 'WS_DOWNLOAD'
   EXPORTING
        BIN_FILESIZE            = ' '
        CODEPAGE                = ' '
         FILENAME                = 'C:\1.txt '
         FILETYPE                = 'DAT'
        MODE                    = ' '
        WK1_N_FORMAT            = ' '
        WK1_N_SIZE              = ' '
        WK1_T_FORMAT            = ' '
        WK1_T_SIZE              = ' '
        COL_SELECT              = ' '
        COL_SELECTMASK          = ' '
        NO_AUTH_CHECK           = ' '
   IMPORTING
        FILELENGTH              =
     TABLES
          DATA_TAB                = itab
          FIELDNAMES              = fld_tab
   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
        OTHERS                  = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Naimesh

Similar Messages

  • How to download the output of two reports in WebTemplate into excel sheet?

    How to download the output of webtemplate which consists of two reports in one  Web Template into same Excel sheet?

    hi sunil,
    here is the HTML code for 'export to excel'
    <!-- Display Export Excel--->
    <td class="SAPBEXNavLine"> <SAP_BW_TEXT program="SAPLRRSV" key="T72">" src="Mime/BEx/Icons/S_X_XLS.gif" border=0 ></td>
    you can also use BEx download scheduler to download the precalculated webtemplate report to excel sheet.
    Check the link below.
    https://websmp104.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_OBJECT=011000358700000401962004E
    i think this will help u
    regards,
    sindhu.

  • Download internal table data into excel sheet with column heading and data

    Hi,
      I am having one internal table with column headings and other table with data.
    i want to download the data with these tables into an excel sheet.
    It should ask the user for file name to save it on their own name. They should give the file name in runtime and it should be downloaded into an excel sheet.
    Can anyone tell what is the right function module for downloading these two internal table data with column heading and data.
    what we have to do for storing the file name in runtime.
    Can anyone help me on this.
    Thanks,
    Rose.

    Hi Camila,
        Try this
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME                        = PATH2
       FILETYPE                        = 'XLS'
      TABLES
        DATA_TAB                        = IT_DATA
       FIELDNAMES                      = IT_HEADINGS
    EXCEPTIONS
       FILE_WRITE_ERROR                = 1
       NO_BATCH                        = 2
       GUI_REFUSE_FILETRANSFER         = 3
       INVALID_TYPE                    = 4
       NO_AUTHORITY                    = 5
       UNKNOWN_ERROR                   = 6
       HEADER_NOT_ALLOWED              = 7
       SEPARATOR_NOT_ALLOWED           = 8
       FILESIZE_NOT_ALLOWED            = 9
       HEADER_TOO_LONG                 = 10
       DP_ERROR_CREATE                 = 11
       DP_ERROR_SEND                   = 12
       DP_ERROR_WRITE                  = 13
       UNKNOWN_DP_ERROR                = 14
       ACCESS_DENIED                   = 15
       DP_OUT_OF_MEMORY                = 16
       DISK_FULL                       = 17
       DP_TIMEOUT                      = 18
       FILE_NOT_FOUND                  = 19
       DATAPROVIDER_EXCEPTION          = 20
       CONTROL_FLUSH_ERROR             = 21
       OTHERS                          = 22

  • How to print the top of page part along with the ALV list and generate PDF

    HI all,
             I have created one ALV by using oops concept .
             and also am able to get the top of page where I have One standard logo on the right hand side
             and some details on the left side .
               Now my requirement is to while printing the list the logo and other top of page details should appear
               In the PDF output but currently while am pressing the print preview button only the alv data is coming
              am already using the method
        handle_top_of_page
          FOR EVENT print_top_of_page
                 OF cl_gui_alv_grid,
    may be am missing something ... How to get the top of page along with the logo printed ?

    Hi  Surya,
    After generating the grid display  click on print button,
    a spool number is generated. capture the spool number and convert it to pdf using the fm:
    CONVERT_ABAPSPOOLJOB_2_PDF  and save the file
    Hope this will solve your problem.
    Regards,
    R K.

  • How to automate the adding of check-box along with each numbered item in Framemaker file ?

    I tried using the wingdings font as check-box. But I don't want to use it manually every time. I want to have it as a style part of my procedure style (numbering style).   I need the check-box along with each numbered item. Whenever I apply my numbering style in FM, I should get something like:
    " <checkbox> 1. <text> "

    Use "N:\u2751\ <n+>.\ " for the autonumber format.
    "N" Use counter N
    "\u2751" One of many checkboxes available in Unicode
    "<n+>" increment the counter
    "." ordinary period
    "\ " non-breaking space
    This assumes that you are on FM8 or later, and your Unicode font has that glyph code point populated (Arial Unicode MS does if your font doesn't).
    Don't use WingDings (or Zaph Dingbats) anymore. Using codepage overlays has any number of issues, and these two sets of legacy codepage dingbats don't even match each other.

  • How to display the output of a reports called from forms in the same window

    Hi all.
    I have installed Forms / Reports 11g Rel2 developer only installation on my windows 7 box.
    I can successfully call a reports from forms using RUN_REPORT_OBJECT and WEB_SHOW.document, but the report is opened in a new window.
    I'd like to open it in the same widow, in a new tab, similar to ctrl-t and make a call.
    How is that possible?.
    I'm using Chrome 25.0. Could this be done through browser settings?.
    Thanks in advance ...!
    Edited by: myluism on 14-mar-2013 6:09

    Don't know for Chrome, so Google for it.
    One more thing, though. what is the 2nd parameter in web.show_document? Is it '_blank'? If not, try that.

  • How to update the Dataset of a report running with universe?

    I am facing some issue in cross-tab.
    My requirement is , on click of any cell in cross-tab i want to convert  it into editable cell.
    Converting into editable cell is something which I achieved using below code:
    function onCellClick(e) {
      var text=this.innerHTML;
      var text = $.trim(this.innerHTML);
             $('<input />').attr({ type: 'text', name: 'text' }).appendTo($(this)).val(text).select().blur(
            function () {
                var newText = $(this).val();
                $(this).parent().text(newText).find('input').remove();
                var rIndex=$(this).closest('tr').index();
                data.data[rIndex]=newText;
                that.firePropertiesChanged(["data"]);
                //that.firePropertiesChanged(["visSelection"]);
        that.fireEvent("onSelect");
    I just modified the sample code.
    My report is  running with universe.
    Now I want to update the Dataset with this updated value.
    Can anyone provide any help on the same?
    Thanks

    Hi Michael,
    You got it right.
    Let me tell you the whole story:
    I have a weird requirement of creating editable grid. And the values which I edit into grid get saved into database.
    By using javascript I am able to edit grid cell item into HTML.
    Now after this I have two hitches:
    1. I am not able to get the updated cell values in Design Studio. I think this issues goes to SDK side. I try to create a external script variable and use this into Design Studio.But somehow it always throw blank.
    2.  I am not able to update dataset. I know updating the dataset permanently is not possible as its getting created from universe. But I just want to update the dataset so that any change in measure values also update total of that column.
    I start this thing this week only. So might be I am asking few stupid question. Please bear with me.
    Thanks
    Amit

  • I downloaded the new Safari 5.05 along with latest Snow Leopard and now my hotmail account causes my Safari and Firefox to crash suddenly.  I tried repairing but still getting the same results.  Please help...

    Problem report for Safari reads:  Safari quit unexpectedly while using the coreclr plugin.

    Go to /Library/Internet Plug-Ins. If you see the Silverlight.plugin, move it to the Trash.
    Now click your Apple icon (top left in your screen) then click Software Update to make sure all your software is up to date.
    Restart your Mac if any updates were installed.
    Try Safari / Hotmail.
    If Safari crashes again, press the Report button on the CrashReporter dialog box to view the crash  information.
    Copy/paste the entire contents of the Crash Reporter window into your reply. If the crash report dialog does not appear or the crash is hard to reproduce, crash logs can be retrieved from the ~/Library/Logs/CrashReporter> folder.

  • How to download the report output  into PDF format

    Hi friedns
    from the report output when user clicks download button
    it has to download to PDF format
    how to do this
    thanks in advance
    venu

    hi venu,
    check this sample code
    Save Report Output to a PDF File
    This report takes another report as input, and captures the output of that report. The output is then converted to
    PDF and saved to a local file. This shows how to use some of the PDF function modules, as well as an easy way to
    create PDF files.
    Source Code Listing
    report zabap_2_pdf.
    *-- Enhancements: only allow to be run with variant. Then called
    *-- program will be transparent to users
    *-- TABLES
    tables:
    tsp01.
    *-- STRUCTURES
    data:
    mstr_print_parms like pri_params,
    mc_valid(1) type c,
    mi_bytecount type i,
    mi_length type i,
    mi_rqident like tsp01-rqident.
    *-- INTERNAL TABLES
    data:
    mtab_pdf like tline occurs 0 with header line,
    mc_filename like rlgrap-filename.
    *-- SELECTION SCREEN
    parameters:
    p_repid like sy-repid, " Report to execute
    p_linsz like sy-linsz default 132, " Line size
    p_paart like sy-paart default 'X_65_132'. " Paper Format
    start-of-selection.
    concatenate 'c:\'
    p_repid
    '.pdf'
    into mc_filename.
    *-- Setup the Print Parmaters
    call function 'GET_PRINT_PARAMETERS'
    exporting
    authority= space
    copies = '1'
    cover_page = space
    data_set = space
    department = space
    destination = space
    expiration = '1'
    immediately = space
    in_archive_parameters = space
    in_parameters = space
    layout = space
    mode = space
    new_list_id = 'X'
    no_dialog= 'X'
    user = sy-uname
    importing
    out_parameters = mstr_print_parms
    valid = mc_valid
    exceptions
    archive_info_not_found = 1
    invalid_print_params = 2
    invalid_archive_params = 3
    others = 4.
    *-- Make sure that a printer destination has been set up
    *-- If this is not done the PDF function module ABENDS
    if mstr_print_parms-pdest = space.
    mstr_print_parms-pdest = 'LOCL'.
    endif.
    *-- Explicitly set line width, and output format so that
    *-- the PDF conversion comes out OK
    mstr_print_parms-linsz = p_linsz.
    mstr_print_parms-paart = p_paart.
    submit (p_repid) to sap-spool without spool dynpro
    spool parameters mstr_print_parms
    via selection-screen
    and return.
    *-- Find out what the spool number is that was just created
    perform get_spool_number using sy-repid
    sy-uname
    changing mi_rqident.
    *-- Convert Spool to PDF
    call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
    exporting
    src_spoolid= mi_rqident
    no_dialog = space
    dst_device = mstr_print_parms-pdest
    importing
    pdf_bytecount = mi_bytecount
    tables
    pdf = mtab_pdf
    exceptions
    err_no_abap_spooljob = 1
    err_no_spooljob = 2
    err_no_permission = 3
    err_conv_not_possible = 4
    err_bad_destdevice = 5
    user_cancelled = 6
    err_spoolerror = 7
    err_temseerror = 8
    err_btcjob_open_failed = 9
    err_btcjob_submit_failed = 10
    err_btcjob_close_failed = 11
    others = 12.
    call function 'DOWNLOAD'
    exporting
    bin_filesize = mi_bytecount
    filename = mc_filename
    filetype = 'BIN'
    importing
    act_filename = mc_filename
    tables
    data_tab = mtab_pdf.
    FORM get_spool_number *
    Get the most recent spool created by user/report *
    --> F_REPID *
    --> F_UNAME *
    --> F_RQIDENT *
    form get_spool_number using f_repid
    f_uname
    changing f_rqident.
    data:
    lc_rq2name like tsp01-rq2name.
    concatenate f_repid+0(8)
    f_uname+0(3)
    into lc_rq2name separated by '_'.
    select * from tsp01 where rq2name = lc_rq2name
    order by rqcretime descending.
    f_rqident = tsp01-rqident.
    exit.
    endselect.
    if sy-subrc ne 0.
    clear f_rqident.
    endif.
    endform." get_spool_number
    Regards,
    Naveen

  • SAP WEBGUI - How to download the report output to Excel ?

    Hi Folks ,
    We have generated a report in standard SAP GUI 7.1 . But our requirement is to view the report in SAP WEBGUI and download as EXCEL .
    We can view the report output in SAP WEBGUI , but could find an option to download as excel  !
    Is there any option in webgui ?
    Please provide you valuable inputs !
    Thanks.,
    V.Rangarajan

    Hi V.Ranjarajan,
    Have you created an ALV report?
    If yes, there are many ways to download the output to excel:
    Go to Menu -> Export - > Local File... , local file button, etc.
    In SAP CRM 7.0 there is a std functionality to even download search result list to excel.
    Hope this helps!
    Regards,
    Saumya

  • How to download the ALV output with colors into the excel sheet

    Hi,
      I'm having an ALV Grid report output where each and every row has some colors in it. When i download it to an excel sheet whatever the colors that comes on the output of the report the same should come in the excel sheet. When i download the output to an excel sheet using List --> Export -->Local file . If i open the excel files no colors are coming in the excel sheet.
    can anyone tell how to get the colors in the excel sheet also. thanks...
    Regards,
    Rose.

    Hi Camila,
    Use the OLE concept.
    Check the below threads:
    Colors in Excel Sheet
    colors in alv
    Regards,
    Soumya.

  • How to download the blocked ALV output to PDF file.

    How to download the blocked ALV output to PDF file.
    I am able to download the BLocked ALV output in PDF format,
    but the each bolck in ALV is displaying different pages of PDF.
    In my report I have 4 block in 1 page, I am able to see the output in PDF but in different page.
    How to avoid the Page-break in PDF.
    Thanks,
    Ravi Yasoda.

    hi,
    I believe that your have 4 containers on the screen with individual ALV display. in this case, there is no way to get combined PDF output to my knowledge.
    However you can use Smartform/Sapscript as output which would allow you to display ALV in blocks and also print it in one.
    Regards,
    Nirmal

  • How to send the output to PDF format in reports 6i?

    Hi,
    How to send the output to PDF format in reports 6i? I given Mode = BITMAP.
    DESTYPE = File, DESFORMAT = PDF, DESNAME = C:\x.pdf.
    Report is running fine. But PDF file not generated. I don't know what i missed. Any one can help this?
    Thanks
    Kavitha

    Hello,
    Do you get this problem only for DESFORMAT=PDF ?
    Test with :
    DESFORMAT = RTF, DESNAME = C:\x.rtf
    or
    DESFORMAT = HTMLCSS, DESNAME = C:\x.html
    does it work ?
    Check if DESNAME is modified in the reports itself.
    Regards

  • How to get the output of the report in pdf format

    how to get the output of the report in pdf format?
    Thanks in advance,
    madan.

    Refer these links
    http://www.sap-img.com/bc037.htm
    http://www.members.tripod.com/abap4/Save_Report_Output_to_a_PDF_File.html
    CONVERT_ABAPSPOOLJOB_2_PDF FM convert abap spool output to PDF

  • How to download the report data in xml format

    Hi All,
    how to download the report data (sql/interactive) in xml format...
    Thanks,
    Vinoth

    You will want to do something like this:
    http://spendolini.blogspot.com/2006/04/custom-export-to-csv.html
    except customize it for xml.
    hth,
    John

Maybe you are looking for