Downloading Report output to a Local File

Hi,
I want to download the my ALV Report output to a local file.
I am following the menu options from ALV output:
  LIST --> Export --> Local File --> Unconverted Format  --> I entered a text file name on the desktop.
The data is being downloaded to Local text file, but some columns are missing.
I don't know what is the reason?  Can anybody tell what may be the reason?
Has anybody come across this issue earlier?
Please let me know the solution.
Thanks in advance,
Sreenivas Reddy.

Hi vik,
I have followed the same steps
   LIST --> Export --> Local File --> Here I enter test.xls file on the desktop.
I am missing the same columns, The heading are displayed for all fields, but data for some initial columns are missing.
Can you please through some light on this error.
Thanks,
Sreeni.

Similar Messages

  • How to write the code to send the report output to the local file.

    dear all,
    how to write the code to send the report output to the local file.
    Thanks & Regards,
    Jyothi.

    Hi,
    Try this , it will display report and download the file as well. Just vhange the path and execute
    TYPE-POOLS : SLIS.
    DATA : IT_SCARR TYPE TABLE OF SCARR,
           IT_FCAT  TYPE SLIS_T_FIELDCAT_ALV.
    SELECT *
    FROM SCARR
    INTO TABLE IT_SCARR.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    *   I_PROGRAM_NAME               =
    *   I_INTERNAL_TABNAME           =
        I_STRUCTURE_NAME             = 'SCARR'
    *   I_CLIENT_NEVER_DISPLAY       = 'X'
    *   I_INCLNAME                   =
    *   I_BYPASSING_BUFFER           =
    *   I_BUFFER_ACTIVE              =
      CHANGING
        CT_FIELDCAT                  = IT_FCAT
    * EXCEPTIONS
    *   INCONSISTENT_INTERFACE       = 1
    *   PROGRAM_ERROR                = 2
    *   OTHERS                       = 3
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    *   I_INTERFACE_CHECK              = ' '
    *   I_BYPASSING_BUFFER             =
    *   I_BUFFER_ACTIVE                = ' '
    *   I_CALLBACK_PROGRAM             = ' '
    *   I_CALLBACK_PF_STATUS_SET       = ' '
    *   I_CALLBACK_USER_COMMAND        = ' '
    *   I_STRUCTURE_NAME               =
    *   IS_LAYOUT                      =
       IT_FIELDCAT                    = IT_FCAT
    *   IT_EXCLUDING                   =
    *   IT_SPECIAL_GROUPS              =
    *   IT_SORT                        =
    *   IT_FILTER                      =
    *   IS_SEL_HIDE                    =
    *   I_DEFAULT                      = 'X'
    *   I_SAVE                         = ' '
    *   IS_VARIANT                     =
    *   IT_EVENTS                      =
    *   IT_EVENT_EXIT                  =
    *   IS_PRINT                       =
    *   IS_REPREP_ID                   =
    *   I_SCREEN_START_COLUMN          = 0
    *   I_SCREEN_START_LINE            = 0
    *   I_SCREEN_END_COLUMN            = 0
    *   I_SCREEN_END_LINE              = 0
    *   IR_SALV_LIST_ADAPTER           =
    *   IT_EXCEPT_QINFO                =
    *   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER        =
    *   ES_EXIT_CAUSED_BY_USER         =
      TABLES
        T_OUTTAB                       = IT_SCARR
    * EXCEPTIONS
    *   PROGRAM_ERROR                  = 1
    *   OTHERS                         = 2
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
      EXPORTING
    *    BIN_FILESIZE              =
        FILENAME                  = 'C:\Documents and Settings\sap\Desktop\Hi.xls' " Change path
    *    FILETYPE                  = 'ASC'
    *    APPEND                    = SPACE
    *    WRITE_FIELD_SEPARATOR     = SPACE
    *    HEADER                    = '00'
    *    TRUNC_TRAILING_BLANKS     = SPACE
    *    WRITE_LF                  = 'X'
    *    COL_SELECT                = SPACE
    *    COL_SELECT_MASK           = SPACE
    *    DAT_MODE                  = SPACE
    *    CONFIRM_OVERWRITE         = SPACE
    *    NO_AUTH_CHECK             = SPACE
    *    CODEPAGE                  = SPACE
    *    IGNORE_CERR               = ABAP_TRUE
    *    REPLACEMENT               = '#'
    *    WRITE_BOM                 = SPACE
    *    TRUNC_TRAILING_BLANKS_EOL = 'X'
    *  IMPORTING
    *    FILELENGTH                =
      CHANGING
        DATA_TAB                  = IT_SCARR
    *  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
    *    NOT_SUPPORTED_BY_GUI      = 22
    *    ERROR_NO_GUI              = 23
    *    others                    = 24
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
      EXPORTING
        DOCUMENT               = 'C:\Documents and Settings\sap\Desktop\Hi.xls' "Change path
    *    APPLICATION            =
    *    PARAMETER              =
    *    DEFAULT_DIRECTORY      =
    *    MAXIMIZED              =
    *    MINIMIZED              =
    *    SYNCHRONOUS            =
    *    OPERATION              = 'OPEN'
    *  EXCEPTIONS
    *    CNTL_ERROR             = 1
    *    ERROR_NO_GUI           = 2
    *    BAD_PARAMETER          = 3
    *    FILE_NOT_FOUND         = 4
    *    PATH_NOT_FOUND         = 5
    *    FILE_EXTENSION_UNKNOWN = 6
    *    ERROR_EXECUTE_FAILED   = 7
    *    SYNCHRONOUS_FAILED     = 8
    *    NOT_SUPPORTED_BY_GUI   = 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.

  • How to download report output to excel file??

    Hi all,
    I have a problem with downloading a report output to an excel file? May i know is there any functions or methods to do it?
    My situation is like this. I used Write function to print out the report. After user click on the execute button. The report output will show to the user in a table format. And there is one button 'Save To Excel' in the report output dipslay screen for user to click to save it into excel format.
    Appreciate if you could help.
    Thanks.
    Regards,
    Rachel

    Hi Rachel,
           You can use FM GUI_DOWNLOAD for transferring the data from your report program into excel sheet.
    And while saving give the filename extension as .xls.
    Reward if helpful.
    With regards,
    Syed

  • Report output to desktop as file.

    Hi all,
      I need to send a standard reports output to desktop as file (text).
      how can i do that. if possible give me an example.
    Thanks,
    Nagaraju.

    Hi Nagaraju ,
      You can use the FM 'LIST_DOWNLOAD' to download the list.
    see the code below .
    START-OF-SELECTION.
    Write: / 'test1' ,
           / 'Test2'.
    CALL FUNCTION 'LIST_DOWNLOAD'
    EXPORTING
       LIST_INDEX                = '0'
       METHOD                    = 'NOCO'
    ** EXCEPTIONS
    **   LIST_DOWNLOAD_ERROR       = 1
    **   OTHERS                    = 2
    *IF SY-SUBRC <> 0.
    ** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    **         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    Reagrds
    Arun

  • Not able to save report output in a text file and RTF file

    I am using Oracle Developer6.0 . I am facing problem with reports. I am invoking reports from form using run_product.
    1. I could not able to save the report in text file . Whenever i try to save the report output in a text file.It gives dump and application get closed.
    2. In RTF format , it execute the query which i have given at the design time while creating a report . But while running i am passing query either through lexical parameter or passing value of where criteria user parameters. It display the output for the specified value. But when i save this report output in rtf file . It execute design time query and save that in a rtf file.
    If any body is having any idea about it . Please let me ASAP . It is very urgent for me.
    Thanks in advance

    Try the following:
    Do not generate the report to .rep file, but rename/copy the .rdf file to .rep file and execute it.

  • Problem while downloading report output

    Hi friends,
    I want to download the report output to local disk in excel file format. The report is developed using ALV grid display (using type poolSLIS). When I run the report all the values are displaying correctly.
    When I download the same in excel file using spreadsheet/unconverted option, some fields are getting cut. For example Vendor code in report showing as 4060070, but in downloaded file it is showing as 406007 (last character missing.).
    I tried GUI_DOWNLOAD function module(for practice), and it is downloading correct values in excel format.
    The problem occurs for only one column. What will be the problem.
    Is this something system problem or we what else.
    Thank you,
    madan

    Hi,
    Did you set the outlen property for your ALV Grid display?
    Please check this.
    Also, check whether you are exceeding the size for uploading a row in Excel or not.
    Thanks and Best Regards,
    Suresh

  • Download alv output to an excel file

    Dear experts,
                    I am using oops alv if i click file download button if i select anything except <b>spread sheet</b> it gives a short dump . Downloaded values are correct i want to know how to save it as a local file also to resolve for other options.
    regards,
    balaji

    Hi Balaji,
    Refer this link (Very helpful): http://www.****************/Tutorials/ALV/ColoredOutput/Program.htm
    Multi-colored output of ALV in EXCEL
    There would be many situations where we need to highlight some of the records in bold or different color depending on some value. In this document, we showcase how this can be achieved. Look at the screenshot of an excel sheet with different colors and bold in some cells.
    Following is a demo program in achieving the same:
    Report ZMULTICOLOR_TEST no standard page heading.
    this report demonstrates how to send some ABAP data to an
    EXCEL sheet using OLE automation.
    include ole2incl.
    handles for OLE objects
    data: h_excel type ole2_object,        " Excel object
          h_mapl type ole2_object,         " list of workbooks
          h_map type ole2_object,          " workbook
          h_zl type ole2_object,           " cell
          h_f type ole2_object,            " font
          h_c type ole2_object.            " color
    DATA: FILENAME LIKE RLGRAP-FILENAME.
    tables: spfli.
    data  h type i.
    table of flights
    data: it_spfli like spfli occurs 10 with header line.
    *&   Event START-OF-SELECTION
    start-of-selection.
    read flights
      select * from spfli into table it_spfli.
    display header
      uline (61).
      write: /     sy-vline no-gap,
              (3)  'Flg'(001) color col_heading no-gap, sy-vline no-gap,
              (4)  'Nr'(002) color col_heading no-gap, sy-vline no-gap,
              (20) 'Von'(003) color col_heading no-gap, sy-vline no-gap,
              (20) 'Nach'(004) color col_heading no-gap, sy-vline no-gap,
              (8)  'Zeit'(005) color col_heading no-gap, sy-vline no-gap.
      uline /(61).
    display flights
      loop at it_spfli.
        write: / sy-vline no-gap,
                 it_spfli-carrid color col_key no-gap, sy-vline no-gap,
                 it_spfli-connid color col_normal no-gap, sy-vline no-gap,
                 it_spfli-cityfrom color col_normal no-gap, sy-vline no-gap,
                 it_spfli-cityto color col_normal no-gap, sy-vline no-gap,
                 it_spfli-deptime color col_normal no-gap, sy-vline no-gap.
      endloop.
      uline /(61).
    tell user what is going on
      call function 'SAPGUI_PROGRESS_INDICATOR'
         exporting
              PERCENTAGE = 0
               text       = text-007
           exceptions
                others     = 1.
    start Excel
      create object h_excel 'EXCEL.APPLICATION'.
    PERFORM ERR_HDL.
      set property of h_excel  'Visible' = 1.
    CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'  .
    PERFORM ERR_HDL.
    tell user what is going on
      call function 'SAPGUI_PROGRESS_INDICATOR'
         exporting
              PERCENTAGE = 0
               text       = text-008
           exceptions
                others     = 1.
    get list of workbooks, initially empty
      call method of h_excel 'Workbooks' = h_mapl.
      perform err_hdl.
    add a new workbook
      call method of h_mapl 'Add' = h_map.
      perform err_hdl.
    tell user what is going on
      call function 'SAPGUI_PROGRESS_INDICATOR'
         exporting
              PERCENTAGE = 0
               text       = text-009
           exceptions
                others     = 1.
    output column headings to active Excel sheet
      perform fill_cell using 1 1 1 200 'Carrier id'(001).
      perform fill_cell using 1 2 1 200 'Connection id'(002).
      perform fill_cell using 1 3 1 200 'City from'(003).
      perform fill_cell using 1 4 1 200 'City to'(004).
      perform fill_cell using 1 5 1 200 'Dep. Time'(005).
      loop at it_spfli.
    copy flights to active EXCEL sheet
        h = sy-tabix + 1.
        if it_spfli-carrid cs 'AA'.
          perform fill_cell using h 1 0 000255000 it_spfli-carrid.
        elseif it_spfli-carrid cs 'AZ'.
          perform fill_cell using h 1 0 168000000 it_spfli-carrid.
        elseif it_spfli-carrid cs 'JL'.
          perform fill_cell using h 1 0 168168000 it_spfli-carrid.
        elseif it_spfli-carrid cs 'LH'.
          perform fill_cell using h 1 0 111111111 it_spfli-carrid.
        elseif it_spfli-carrid cs 'SQ'.
          perform fill_cell using h 1 0 100100100 it_spfli-carrid.
        else.
          perform fill_cell using h 1 0 000145000 it_spfli-carrid.
        endif.
        if it_spfli-connid lt 400.
          perform fill_cell using h 2 0 255000255 it_spfli-connid.
        elseif it_spfli-connid lt 800.
          perform fill_cell using h 2 0 077099088 it_spfli-connid.
        else.
          perform fill_cell using h 2 0 246156138 it_spfli-connid.
        endif.
        if it_spfli-cityfrom cp 'S*'.
          perform fill_cell using h 3 0 155155155 it_spfli-cityfrom.
        elseif it_spfli-cityfrom cp 'N*'.
          perform fill_cell using h 3 0 189111222 it_spfli-cityfrom.
        else.
          perform fill_cell using h 3 0 111230222 it_spfli-cityfrom.
        endif.
        if it_spfli-cityto cp 'S*'.
          perform fill_cell using h 4 0 200200200 it_spfli-cityto.
        elseif it_spfli-cityto cp 'N*'.
          perform fill_cell using h 4 0 000111222 it_spfli-cityto.
        else.
          perform fill_cell using h 4 0 130230230 it_spfli-cityto.
        endif.
        if it_spfli-deptime lt '020000'.
          perform fill_cell using h 5 0 145145145 it_spfli-deptime.
        elseif it_spfli-deptime lt '120000' .
          perform fill_cell using h 5 0 015215205 it_spfli-deptime.
        elseif it_spfli-deptime lt '180000' .
          perform fill_cell using h 5 0 000215205 it_spfli-deptime.
        else.
          perform fill_cell using h 5 0 115115105 it_spfli-deptime.
        endif.
      endloop.
    EXCEL FILENAME
      CONCATENATE SY-REPID '_' SY-DATUM6(2) '_' SY-DATUM4(2) '_'
                  SY-DATUM(4) '_' SY-UZEIT '.XLS' INTO FILENAME.
      CALL METHOD OF H_MAP 'SAVEAS' EXPORTING #1 = FILENAME.
      free object h_excel.
      perform err_hdl.
          FORM FILL_CELL                                                *
          sets cell at coordinates i,j to value val boldtype bold       *
    form fill_cell using i j bold col val.
      call method of h_excel 'Cells' = h_zl
        exporting
          #1 = i
          #2 = j.
      perform err_hdl.
      set property of h_zl 'Value' = val .
      perform err_hdl.
      get property of h_zl 'Font' = h_f.
      perform err_hdl.
      set property of h_f 'Bold' = bold .
      perform err_hdl.
      set property of h_f 'Color' = col.
      perform err_hdl.
    endform.                    "FILL_CELL
    *&      Form  ERR_HDL
          outputs OLE error if any                                       *
    -->  p1        text
    <--  p2        text
    form err_hdl.
      if sy-subrc <> 0.
        write: / 'OLE-Automation Error:'(010), sy-subrc.
        stop.
      endif.
    endform.                    " ERR_HDL
    Good Luck and thanks
    AK

  • Re: Solution for Downloading Report Output  which contains about 370

    HI ,
       I need suggestion on the statements or functions to Download
      output of a report into  a txt file and download it to the local dir.
    Please note: This legnth of the filesize  is about 360.
    Rgds
    Perumal Srinivas
    91816500

    Hi..
    there is option..
    SUBMIT report  EXPORTING LIST TO MEMORY
    Effect
    This addition stores the basic list for the program accessed in the ABAP Memory. It can only be used together with the addition AND RETURN.
    The list is stored in the ABAP Memory as an internal table of the row type ABAPLIST, ABAPLIST being a structured data type in the ABAP Dictionary.
    The calling program can access the list stored once program access is completed, using function modules belonging to the function group SLST.
    The function module LIST_FROM_MEMORY loads the list from the ABAP Memory to an internal table of the row type ABAPLIST.
    The function module WRITE_LIST inserts the content of an internal table of the row type ABAPLIST in the current list.
    The function module DISPLAY_LIST displays the content of an internal table of the row type ABAPLIST in a separate list screen.
    Note
    The addition can only work provided the function key Enter is not linked to a function code in the GUI status last defined for the program accessed.
    Example
    Once the program report has been accessed, the list stored there in the ABAP Memory is read by means of function modules and inserted in the current list.
    DATA list_tab TYPE TABLE OF abaplist.
    SUBMIT report EXPORTING LIST TO MEMORY
                  AND RETURN.
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = list_tab
      EXCEPTIONS
        not_found  = 1
        OTHERS     = 2.
    IF sy-subrc = 0.
      CALL FUNCTION 'WRITE_LIST'
        TABLES
          listobject = list_tab.
    ENDIF.
    Now...u have the itab list_tab which you is having the output. Now..using GUI_DOWNLOAD...download the contents to the txt file in your local direcctory..if any prob..come backk to me..
    Ram
    Message was edited by:
            Rammohan Nagam

  • Option to save output list to local file

    What would cause the menu option:
    SYSTEM - > LIST ->SAVE -> LOCAL FILE
    to be greyed out or not available for a report?  I know these use to be an option for all standard output lists, but now I see where this is not an option on some standard SAP reports.

    Hi,
    I am getting the same problem. In VT03N, when I goto System->List->Save->File, the option to save is greyed out.
    Can you please explain how can this be enabled?
    Thanks,
    Manvi

  • Download internal table value to local file from BSP

    Dear all
    I ve converted a word file to XML and doing some modifications with the help of ABAP program .After that am replacing some of the fields by passing values.after that i am getting the same file to the local system.All these i am able to do in our SAP GUI.
    But while trying in BSP am uanle to download it to the local file.
    I am having file which i have to download in the following formats.
    1.XSTRING
    2.ITAB
    3.Rawstring ITAB
    Now am trying this with cl_bsp_utility->download class.....please anybody help how to use this in my application.
    regards
    mei

    Hi,
    You can't directly access the file system of the end user from a BSP.
    Either you create a link on your web page, either you set the mime type of the response with         runtime->server->response->set_header_field( name = 'Content-Type'  value = 'some mime type' ) in order to let the end user save the file.
    Eddy

  • How to download the attachment text to local file.

    Hi Xperts,
    My requirement is at the time of workitem execution, Approver can write the attachment with the reason for Rejection.
    Now, I need to down load that attachment content to local file and then that content needs to be updated in the PO Header changes.
    I can able to get the attachment files' title, size and everything from the DB Table SOOD. But there is no Attachment's content is getting updated in that table.
    Will you pls let me know how to download the content of the attachment to a local file from the sap.
    ThanX in ADvance.
    Krish.

    HI Arghadip Kar,
    By using the Function Module SAP_WAPI_GET_ATTACHMENTS, we can get the Object id of the attachment, but not the content of the Attachment.
    But, my requirement is to get the content of the attachment.
    Best Regards,
    Krishna.

  • Download Report Output ?

    Hi All,
    I have developed a custom report, a classical report. I want to download the report output to excel. Is there any FM or Class to achieve this functionality.
    My report has 5 columns, i want the coulmn to be downloaded into excel in individual coulmns, also the color and vertical/horizontal lines should come as displayed in the report.
    Thanks and Regards,
    Navneeth K.

    refer this call function
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
         I_FIELD_SEPERATOR          = 'X'
        I_LINE_HEADER              =
          I_TAB_RAW_DATA             = i_temp
          I_FILENAME                 = fl_file
        TABLES
          I_TAB_CONVERTED_DATA       = i_articles
       EXCEPTIONS
         CONVERSION_FAILED          = 1
         OTHERS                     = 2
      IF SY-SUBRC <> 0.
       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

  • Downloading report o/p to excel file

    Hi experts,
             I have developed a report in abap. I want to add a functionality in the output display of the report giving user an option to download in excel file. what functions do i need to call? Someone plz help. <b><REMOVED BY MODERATOR></b>
    Thanks
    Message was edited by:
            Alvaro Tejada Galindo

    Hello,
    you can use the FM:
    GUI_DOWNLOAD
    If you want to use the OOP concept, than you can use
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
    regards,
    Naimesh Patel

  • Mailing the Report Output-Does not generating file name

    Dear Gurus,
           The below program fulfils the "mailing the report" requirement .it sends the out put as an attachment in XLS format.But one problem exists i.e.,it does not generate  filename.It gives the filename as ".XLS"(DOT XLS).
    What should be done that system generates a filename?
    *& Report  ZTESTMAIL                                                   *
    REPORT  ZTESTMAIL                               .
    tables: ekko.
    parameters: p_email type somlreci1-receiver.
    types: begin of t_ekpo,
    ebeln type ekpo-ebeln,
    ebelp type ekpo-ebelp,
    aedat type ekpo-aedat,
    matnr type ekpo-matnr,
    end of t_ekpo.
    data: it_ekpo type standard table of t_ekpo initial size 0,
    wa_ekpo type t_ekpo.
    types: begin of t_charekpo,
    ebeln(10) type c,
    ebelp(5) type c,
    aedat(8) type c,
    matnr(18) type c,
    end of t_charekpo.
    data: wa_charekpo type t_charekpo.
    data: it_message type standard table of solisti1 initial size 0
    with header line.
    data: it_attach type standard table of solisti1 initial size 0
    with header line.
    data: t_packing_list like sopcklsti1 occurs 0 with header line,
    t_contents like solisti1 occurs 0 with header line,
    t_receivers like somlreci1 occurs 0 with header line,
    t_attachment like solisti1 occurs 0 with header line,
    t_object_header like solisti1 occurs 0 with header line,
    w_cnt type i,
    w_sent_all(1) type c,
    w_doc_data like sodocchgi1,
    gd_error type sy-subrc,
    gd_reciever type sy-subrc.
    t_object_header = 'Text.xls'. append t_object_header.
    *START_OF_SELECTION
    start-of-selection.
    Retrieve sample data from table ekpo
    perform data_retrieval.
    Populate table with detaisl to be entered into .xls file
    perform build_xls_data_table.
    *END-OF-SELECTION
    end-of-selection.
    Populate message body text
    perform populate_email_message_body.
    Send file by email as .xls speadsheet
    perform send_file_as_email_attachment
    tables it_message
    it_attach
    using p_email
    'Example .xls documnet attachment'
    'XLS'
    'PO'
    changing gd_error
    gd_reciever.
    Instructs mail send program for SAPCONNECT to send email(rsconn01)
    perform initiate_mail_execute_program.
    *& Form DATA_RETRIEVAL
    Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp aedat matnr
    up to 10 rows
    from ekpo
    into table it_ekpo.
    endform. " DATA_RETRIEVAL
    *& Form BUILD_XLS_DATA_TABLE
    Build data table for .xls document
    form build_xls_data_table.
    *CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
    *con_tab TYPE x VALUE '09'. "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    constants:
    con_tab type c value cl_abap_char_utilities=>horizontal_tab,
    con_cret type c value cl_abap_char_utilities=>cr_lf.
    concatenate 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
    into it_attach separated by con_tab.
    concatenate con_cret it_attach into it_attach.
    append it_attach.
    loop at it_ekpo into wa_charekpo.
    concatenate wa_charekpo-ebeln wa_charekpo-ebelp
    wa_charekpo-aedat wa_charekpo-matnr
    into it_attach separated by con_tab.
    concatenate con_cret it_attach into it_attach.
    append it_attach.
    endloop.
    endform. " BUILD_XLS_DATA_TABLE
    *& Form SEND_FILE_AS_EMAIL_ATTACHMENT
    Send email
    form send_file_as_email_attachment tables pit_message
    pit_attach
    using p_email
    p_mtitle
    p_format
    p_filename
    p_attdescription
    p_sender_address
    p_sender_addres_type
    changing p_error
    p_reciever.
    data: ld_error type sy-subrc,
    ld_reciever type sy-subrc,
    ld_mtitle like sodocchgi1-obj_descr,
    ld_email like somlreci1-receiver,
    ld_format type so_obj_tp ,
    ld_attdescription type so_obj_nam ,
    ld_attfilename type so_obj_des ,
    ld_sender_address like soextreci1-receiver,
    ld_sender_address_type like soextreci1-adr_typ,
    ld_receiver like sy-subrc.
    ld_email = p_email.
    ld_mtitle = p_mtitle.
    ld_format = p_format.
    ld_attdescription = p_attdescription.
    ld_attfilename = p_filename.
    ld_sender_address = p_sender_address.
    ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
    w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
    w_doc_data-obj_langu = sy-langu.
    w_doc_data-obj_name = 'SAPRPT'.
    w_doc_data-obj_descr = ld_mtitle .
    w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
    clear w_doc_data.
    read table it_attach index w_cnt.
    w_doc_data-doc_size =
    ( w_cnt - 1 ) * 255 + strlen( it_attach ).
    w_doc_data-obj_langu = sy-langu.
    w_doc_data-obj_name = 'SAPRPT'.
    w_doc_data-obj_descr = ld_mtitle.
    w_doc_data-sensitivty = 'F'.
    clear t_attachment.
    refresh t_attachment.
    t_attachment[] = pit_attach[].
    Describe the body of the message
    clear t_packing_list.
    refresh t_packing_list.
    t_packing_list-transf_bin = space.
    t_packing_list-head_start = 1.
    t_packing_list-head_num = 0.
    t_packing_list-body_start = 1.
    describe table it_message lines t_packing_list-body_num.
    t_packing_list-doc_type = 'RAW'.
    append t_packing_list.
    Create attachment notification
    t_packing_list-transf_bin = 'X'.
    t_packing_list-head_start = 1.
    t_packing_list-head_num = 1.
    t_packing_list-body_start = 1.
    describe table t_attachment lines t_packing_list-body_num.
    t_packing_list-doc_type = ld_format.
    t_packing_list-obj_descr = ld_attdescription.
    t_packing_list-obj_name = ld_attfilename.
    t_packing_list-doc_size = t_packing_list-body_num * 255.
    append t_packing_list.
    Add the recipients email address
    clear t_receivers.
    refresh t_receivers.
    t_receivers-receiver = ld_email.
    t_receivers-rec_type = 'U'.
    t_receivers-com_type = 'INT'.
    t_receivers-notif_del = 'X'.
    t_receivers-notif_ndel = 'X'.
    append t_receivers.
    call function 'SO_DOCUMENT_SEND_API1'
    exporting
    document_data = w_doc_data
    put_in_outbox = 'X'
    sender_address = ld_sender_address
    sender_address_type = ld_sender_address_type
    commit_work = 'X'
    importing
    sent_to_all = w_sent_all
    tables
    object_header = t_object_header
    packing_list = t_packing_list
    contents_bin = t_attachment
    contents_txt = it_message
    receivers = t_receivers
    exceptions
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    others = 8.
    Populate zerror return code
    ld_error = sy-subrc.
    Populate zreceiver return code
    loop at t_receivers.
    ld_receiver = t_receivers-retrn_code.
    endloop.
    endform.
    *& Form INITIATE_MAIL_EXECUTE_PROGRAM
    Instructs mail send program for SAPCONNECT to send email.
    form initiate_mail_execute_program.
    wait up to 2 seconds.
    submit rsconn01 with mode = 'INT'
    with output = 'X'
    and return.
    endform. " INITIATE_MAIL_EXECUTE_PROGRAM
    *& Form POPULATE_EMAIL_MESSAGE_BODY
    Populate message body text
    form populate_email_message_body.
    refresh it_message.
    it_message = 'Please find attached a list test ekpo records'.
    append it_message.
    endform. " POPULATE_EMAIL_MESSAGE_BODY
    Your suggestions will be appreciated and rewarded.
    Thanks in advance
    Murali

    Hi
    Your pgm is not passing anything in obj_descr in packing list for excel file. If you pass a name your excel file will have that.
    Regards
    Sathar
    perform send_file_as_email_attachment
    tables it_message
    it_attach
    using p_email
    'Example .xls documnet attachment'
    'XLS'
    'PO'
    ' '  *------> no value*
    changing gd_error
    gd_reciever.
    form send_file_as_email_attachment tables pit_message
    pit_attach
    using p_email
    p_mtitle
    p_format
    p_filename
    p_attdescription *----> no value*
    p_sender_address
    p_sender_addres_type
    changing p_error
    p_reciever.
    t_packing_list-obj_descr = ld_attdescription.

  • Report output in a text file

    Hello,
    I am using report 6i and I would like to have the output of my report in a file, such as text file.
    I tried with the systems parameters (DESNAME, DESTYPE ...) but it dosent work.
    Does someone could help me with that?
    Thankyou in advance.

    Hi,
    I had tried to do that before. When you write to a file oracle reports create a .lis file containing printer fonts, which is no good. What you can do is define a printer using ascii drivers and use that printer to write to a file inorder to get a text file.
    The other thing I did is used DDE techniques to write the report to .xls file. The online help on reports have good examples on how to do this.
    Hope this helps. Good Luck!

Maybe you are looking for

  • Back up contacts from cloud to samsung galaxy s5

    I just updated to the Samsung Galaxy s5 from the iPhone 4s.  I backed everything up to the cloud. It initial transfer was fine but I noticed I had a lot of duplicates. (It wasn't the clouds fault. It is because of the way I had my contacts in my blac

  • Get 0x80780124 error when trying to restore Windows Server 2008 R2

    We are trying to restore a HP Proliant ML350 G6 Windows 8 R2 Server but every time we do we get a message that states "The system image restore failed error details: Windows Backup failed to extend or mount the file system on the recovered volume. (0

  • Why does Firefox 3.6 conflict with Adobe Flash Player 10.1?

    I HAD MLB.TV running, but had to reboot the OS (XP Pro) and now Adobe FP won't load. What gives?

  • ACH Processing  --- Time Limitation

    Hi All, Our Company process ACH Payments. Once we process the first ACH Payment Run, we are not able to process the second ACH Payment Run immediately. In order to process the Second Payment Run, we need to wait atleast for one hour. Can any one let

  • Colour management on Canon PIXMA ip8750-.

    Hi, I know this is a pretty specific question but just wondered if anyone could help-? I need to turn colour management off on my new printer in order to printer some test sheets for profiling... I cannot see anywhere in the printer settings where th