ALV list out by microsoft excel

when I use mirosoft excel to output some standard ALV list (CtrlShiftF7) , there will be something lost in the last line.
Why does it happen and how can I resolve it?

hi,
<b>follow this link.</b>
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba5fc35c111d1829f0000e829fbfe/content.htm
regards,
Ashok Reddy

Similar Messages

  • How to add a button on the ALV LIST pop up

    Hi ,
    Can any one help me to add a button on the ALV list which is a pop up using ABAP Objects.
    Thanks in advance.
    Regards,
    Kavya.

    HI ,
    I want to add a push button on the ALV list out put which is comming as a pop up and I want this using classes and methods.
    I have got a method IF_SREL_BROWSER_COMMANDS~ADD_BUTTONS from class cl_gos_attachment_list  but still I am unable to get any additional button on the output ALV popup.
    Please help.
    Regards,
    Kavya.

  • Not displaying the data in the ALV Microsoft Excel (Ctrl+Shift+F7)..

    Hi All,
    I can able to display the data through the FM REUSE_ALV_GRID_DISPLAY in the out put screen.When I click on the Microsoft Excel (CtrlShiftF7) at the ALV toolbar to view the same data in excel sheet it does open the excel sheet WITHOUT ANY DATA. Please help me how to make the data visible in the excel sheet.
    Can anyone help in this regard.
    Thanks & Regards,
    Seshadri G

    Hi,
    Check whether the tool bar export is disabled in the alv.
    check in the alv->set_table_for_first_display  FM the toolbar exclude export list.
    If that is ok, then try download manually by providing abutton and clicking it. You can download data manually in this way.
    refer the code below.
    DATA: lv_path      TYPE string,
            lv_fullpath  TYPE string,
            lc_c         TYPE string,
            v_fnam       TYPE string,
            lc_date(15)      TYPE c.
      TYPES: BEGIN OF ts_fieldnames,
                field_name(1000),
             END OF ts_fieldnames.
      lc_c =  'C:\'.
      WRITE sy-datum TO lc_date.
      DATA:lt_fieldnames TYPE STANDARD TABLE OF ts_fieldnames,
           ls_fieldnames TYPE ts_fieldnames,
           lt_fieldnames1 TYPE STANDARD TABLE OF ts_fieldnames,
           ls_fieldnames1 TYPE ts_fieldnames,
           lt_fieldnames2 TYPE STANDARD TABLE OF ts_fieldnames,
           ls_fieldnames2 TYPE ts_fieldnames,
           lt_fieldnames3 TYPE STANDARD TABLE OF ts_fieldnames,
           ls_fieldnames3 TYPE ts_fieldnames,
           lt_fieldnames5 TYPE STANDARD TABLE OF ts_fieldnames,
           ls_fieldnames5 TYPE ts_fieldnames.
      CONCATENATE 'ContractAccount'
                  'DocumentNumber'
                  'Reference/InvoiceDocumentNumber'
                  'ClearingDocumentNumber'
                  INTO ls_fieldnames-field_name SEPARATED BY
                  cl_abap_char_utilities=>horizontal_tab.
      APPEND ls_fieldnames TO lt_fieldnames.
      CONCATENATE '' ''
                  INTO ls_fieldnames5-field_name SEPARATED BY
                  cl_abap_char_utilities=>newline.
      APPEND ls_fieldnames5 TO lt_fieldnames5.
      DATA :    ls_str1 TYPE string,
                ls_str2 TYPE string.
      ls_str1 = 'Invoice Clearing Posting'.
      ls_str2 = 'Payment On Account Posting'.
      CONCATENATE ls_str1  ' :: ' lc_date INTO ls_fieldnames2-field_name.
      APPEND ls_fieldnames2 TO lt_fieldnames2.
      CONCATENATE ls_str2 ' :: ' lc_date INTO ls_fieldnames3-field_name.
      APPEND ls_fieldnames3 TO lt_fieldnames3.
      CONCATENATE 'ContractAccount'
                  'Reference/InvoiceDocumentNumber'
                  'PostOnAccountDocumentNumber'
                  INTO ls_fieldnames1-field_name SEPARATED BY
                  cl_abap_char_utilities=>horizontal_tab.
      APPEND ls_fieldnames1 TO lt_fieldnames1.
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title      = 'Select file for download'
          default_extension = '.xls'
          default_file_name = lv_path
          initial_directory = lc_c
        CHANGING
          filename          = lv_path
          path              = lc_c
          fullpath          = lv_fullpath
        EXCEPTIONS
          cntl_error        = 1
          error_no_gui      = 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.
      ELSE.
        v_fnam = lv_fullpath.
      ENDIF.
      IF v_fnam IS INITIAL.
        RETURN.
      ENDIF.
      IF i_finalclear[] IS NOT INITIAL.
        CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
            filename              = v_fnam
            filetype              = 'DAT'
           HEADER                = header
            append                = 'X'
            write_field_separator = 'X'
          CHANGING
            data_tab              = lt_fieldnames2
          EXCEPTIONS
            OTHERS                = 8.
        CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
            filename              = v_fnam
            filetype              = 'DAT'
           HEADER                = header
            append                = 'X'
            write_field_separator = 'X'
          CHANGING
            data_tab              = lt_fieldnames
          EXCEPTIONS
            OTHERS                = 8.
    REgards
    sheron

  • Microsoft Excel Icon in ALV Grid Report

    Hi all,
    We have a customized report. When we execute that reports, it open in ALV Grid format. When we choose "Microsoft Excel" Icon to change layout to Excel, it then shows the report in excel without any data.
    Can any one please tell me that why there is no data? should i need to do any settings in excel for this?
    Please respond.
    Best Regards,
    AI

    Hi,
    Refer these:
    Microsoft Excel Icon in ALV Grid Report
    Re: Not able display the Excel Icon in ALV List Display
    Hope it helps
    Regards
    Mansi

  • ALV List output to Excel file

    Hi Friends,
      I want to save the ALV output as a excel file on local drive.
    From the ALV output, I am using menu path :  Views  --> Microsoft Excel (Ctrl + Shift + F7) to switch  from ALV to Excel mode.
    It is switched to excel mode but not showing any data in the columns?
    If I use the Path: List --> Export  --> Local File --> Spread Sheet --> Gave excel file name.
    Here, I am not able get data for all columns. Some columns are not being displayed.
    What is the problem in this? Is this coding error? Do we need to apply any OSS notes?
    Thanks in advance,
    Sreeni

    Hi soumya,
    I want to download from standard functionality only, that means I want to download using standard menu paths only.
    I have tried giving .csv file also, but not able to download all fields. It is missing first 4 fields and downloading all the remaining
    fields.
    Please try to through some light on it.
    Thanks in advance,
    Sreenivas reddy

  • ALV List  download to Excel format

    hi all,
    how to download ALV list to excel?
    i am using Reuse_ALV_List_Display fm to get my list .

    Hi,
    You dont have to do anything extra as such coz transport to excel is already given in the toolbar of the ALV Check report BALVSD04.
    But still you wanna download it then download the final table by using any of the download functions ' GUI_DOWNLOAD' , ' CONVER_SAP_TO_XLS', etc.
    Regards,
    Amit
    Reward all helpful replies.

  • How to convert alv list into excel file?

    Hi Experts,
            i have created one report for Due Date Analysis.
    Now My output is displaying in ALV list. But I need to convert the data which in alv list into Excel File. then only i have to send the Excel File to the Customer Thro Email.
         So i need the Function Module to Convert the Data into Excel File.
    Thanks,
    Neptune.M

    Hi,
      U can use function module gui_download.
      CALL FUNCTION 'GUI_DOWNLOAD'
         EXPORTING
        BIN_FILESIZE       =
          filename           = 'C:\Transportaionlane.XLS'
          filetype                       = 'DAT'
        WRITE_FIELD_SEPARATOR           = ' '
        HEADER                          = '00'
        TABLES
          ata_tab                       = t_trans_lane_dis[]
           OTHERS                          = 22
    if u want with header then pass the header.
    regards
    Ahasan

  • Hierarchical ALV list with control of printout and Excel download

    Hello everybody,
    i have to write a program, that has to generate a hierarchical master/client list. The list should
    have the same functionality, that a standard ALV Grid
    offers (sorting, grouping, OLE export to Excel). The printout must show a new sheet for every master group.
    ALV grid does not allow to display hierarchical lists. The ALV hierarchical list and blocklist view switches to
    text mode with no "single click Excel activation". I have tried to implement the &XXL ok_code, but in text mode, there is no chance to activate this single-table functionality.
    Another possibility seems to be ALV tree, but there is no
    possibility to control the printout (new sheet at group level) and the given practice, to load child nodes at selection, is not acceptable for my kind of program (all childs have to be expanded and the printout must contain a dialog to print i.e. a "from to group" selection).
    Does anyone have an idea, to solve this problem in an easy object oriented way? my only thought at this time is, to use a standard ABAP list and to integrate Excel via document office integration. This gives me the fullcontrol about printout and export, but it needs far more time then ALV.
    Another possibility may be, to develop a custom control, based on VS with Flexgrid, Singray or ComponentOne tools, but ich have to go as near as possible to SAP standard, without using 3rd party programming systems or controls.
    I'm glad about tip's!
    Greets from germany
    Jens

    Jens,
    Take a look at this for ideas:
    REPORT Zsandbox_prog .
    INCLUDE OLE2INCL.
    field-symbols: <Val> type any.
    data: row_cnt type i.
    types:  begin of t_Excel,
              Material_Info(20),
              Sugg_Price(20),
              Cost(20),
              Comments(100),
            end of t_Excel.
    data: r_Excel type t_Excel.
    data: i_Excel type table of t_Excel with header line.
    constants: xlCenter type i value '-4108',
               xlBottom type i value '-4107',
               xlLeft   type i value '-4131',
               xlRight  type i value '-4152'.
    constants: xlContinuous type i value '1',
               xlInsideVertical type i value '11',
               xlThin type i value '2',
               xlLandscape type i value '2',
               xlPortrait type i value '1',
               xlLetter type i value '1',
               xlLegal type i value '5',
               xlThick type i value '4',
               xlNone type i value '-4142',
               xlAutomatic type i value '-4105'.
    DATA: hExcel TYPE OLE2_OBJECT,      " Excel object
          hWorkBooks TYPE OLE2_OBJECT,  " list of workbooks
          hWorkbook TYPE OLE2_OBJECT,   " workbook
          hSheet TYPE OLE2_OBJECT,      " worksheet object
          hRange TYPE OLE2_OBJECT,      " range object
          hRange2 TYPE OLE2_OBJECT,      " range object
          hBorders TYPE OLE2_OBJECT,    " Border object
          hInterior TYPE OLE2_OBJECT,   " interior object - for coloring
          hColumn TYPE OLE2_OBJECT,     "column
          hCell TYPE OLE2_OBJECT,       " cell
          hFont TYPE OLE2_OBJECT,       " font
          hSelected TYPE OLE2_OBJECT,   " range object
          hPicture TYPE OLE2_OBJECT,    "picture object
          hLogo TYPE OLE2_OBJECT.       "Logo object
    SELECTION-SCREEN BEGIN OF BLOCK b1.
      SELECTION-SCREEN skip 1.
      parameter: wraptext as checkbox.
    SELECTION-SCREEN END OF BLOCK b1.
      row_cnt = 1.
      Perform Build_Dummy_Vals.
      Perform Start_Excel.
      Perform Build_Header_Line using row_cnt.
      Perform Pass_Records using row_cnt.
      Perform Release_Excel.
    FORM Build_Dummy_Vals .
      data: matnum(5) type n.
      data: baseprice(3) type n.
      do 5 times.
        matnum = matnum + 50.
        clear r_Excel.
        concatenate 'Material ' matnum into r_Excel-material_info
          separated by space.
        r_excel-Sugg_Price = baseprice * matnum.
        r_excel-Cost = ( baseprice * matnum ) / 2.
        concatenate 'Comments for Material ' matnum into r_excel-Comments
          separated by space.
        append r_excel to i_Excel.
      enddo.
    ENDFORM.                    " Build_Dummy_Vals
    Form Start_Excel.
      CREATE OBJECT hExcel 'EXCEL.APPLICATION'.
      PERFORM ERR_HDL.
    get list of workbooks, initially empty
      CALL METHOD OF hExcel 'Workbooks' = hWorkbooks.
      PERFORM ERR_HDL.
      add a new workbook
      CALL METHOD OF hWorkbooks 'Add' = hWorkbook.
      PERFORM ERR_HDL.
    Get Worksheet object.
      get property of hWorkbook 'ActiveSheet' = hSheet.
    EndForm.
    FORM Build_Header_Line using p_row_cnt.
      data: l_range(30).
      data: row_start(10).
      PERFORM Fill_The_Cell USING p_row_cnt 1 1 'Material'.
      PERFORM Fill_The_Cell USING p_row_cnt 2 1 'Suggested Price'.
      PERFORM Fill_The_Cell USING p_row_cnt 3 1 'Cost'.
      PERFORM Fill_The_Cell USING p_row_cnt 4 1 'Comments'.
      Perform Format_Column using 1 15 xlCenter ' ' xlCenter 0.
      Perform Format_Column using 2 10 xlCenter ' ' xlCenter 1.
      Perform Format_Column using 3 35 xlCenter ' ' xlCenter 0.
      if WrapText = 'X'.
        Perform Format_Column using 4 35 xlLeft ' ' xlCenter 1.
      else.
        Perform Format_Column using 4 100 xlLeft ' ' xlCenter 0.
      endif.
    Build the range object.
      row_start = p_row_cnt.
      concatenate 'A' row_start ':D' row_start into l_range.
      condense l_range no-gaps.
    Set row color to yellow.
      CALL METHOD OF hExcel 'RANGE' = hRange EXPORTING #1 = l_range.
      call method of hRange 'Interior' = hInterior.
      set property of hInterior 'ColorIndex' = 6.  "yellow
      p_row_cnt = p_row_cnt + 1.
    ENDFORM.                    " Build_Header_Line
    FORM Format_Column  USING    p_ColNum
                                 p_ColWidth
                                 p_ColHAlign
                                 p_ColFormat
                                 p_ColVAlign
                                 p_WrapText.
      CALL METHOD OF hExcel 'COLUMNS' = hColumn
        EXPORTING #1 = p_ColNum .           "column number
      SET PROPERTY OF hColumn 'HorizontalAlignment' = p_ColHAlign.
      SET PROPERTY OF hColumn 'VerticalAlignment' = p_ColVAlign.
      SET PROPERTY OF hColumn 'ColumnWidth' = p_ColWidth.
      SET PROPERTY OF hColumn 'WrapText' = p_WrapText.
    ENDFORM.                    " Format_Column
    Form Pass_Records using p_row_cnt.
      data: col_cnt type i.
      data: l_range(30).
      data: row_start(10).
      col_cnt = 1.
    *Pass the internal table values to the spreadsheet.
      loop at i_Excel into r_Excel.
        do 4 times.
          assign component sy-index of STRUCTURE r_excel TO <Val>.
          PERFORM Fill_The_Cell USING p_row_cnt col_cnt 0 <Val>.
          col_cnt = col_cnt + 1.      "increment column
        enddo.
    Build the range object.
        row_start = p_row_cnt.
        concatenate 'A' row_start ':D' row_start into l_range.
        condense l_range no-gaps.
      Set row color to yellow.
        CALL METHOD OF hExcel 'RANGE' = hRange EXPORTING #1 = l_range.
        call method of hRange 'Interior' = hInterior.
        set property of hInterior 'ColorIndex' = 7.  "yellow
        p_row_cnt = p_row_cnt + 1.    "increment row
        col_cnt = 1.                  "reset column to A (ie. col 1)
      endloop.
    EndForm.
    FORM Release_Excel .
      SET PROPERTY OF hExcel  'Visible' = 1.
      FREE OBJECT hExcel.
      PERFORM ERR_HDL.
    ENDFORM.                    " Release_Excel
          FORM Fill_The_Cell                                            *
       Sets cell at coordinates i,j to value val boldtype bold          *
       BOLD --> 1 = true, set bold ON    0 = false, set bold OFF
    FORM Fill_The_Cell USING I J BOLD TheValue.
      CALL METHOD OF hExcel 'Cells' = hCell EXPORTING #1 = I #2 = J.
      PERFORM ERR_HDL.
      SET PROPERTY OF hCell 'Value' = TheValue.
      PERFORM ERR_HDL.
      GET PROPERTY OF hCell 'Font' = hFont.
      PERFORM ERR_HDL.
      SET PROPERTY OF hFont 'Bold' = BOLD.
      PERFORM ERR_HDL.
    ENDFORM.
    FORM ERR_HDL.
      IF SY-SUBRC <> 0.
        message i000(zz) with 'OLE Automation error: ' SY-SUBRC.
        exit.
      ENDIF.
    ENDFORM.                    " ERR_HDL

  • I cannot dowload all fields from ALV list to Excel - urgent, please help me

    I developed a report and displayed in ALV list using FM 'REUSE_ALV_GRID_DISPLAY'.The list contains 200 fields.But when i am trying to download in EXCEL file from ALV list, it is unable to download all the fields from ALV list into EXCEL.
    Thanks in advance,
    Katta.

    is your list having packed decimals or any fields which are of large length (around 128 char)?
    It can happen so.

  • ALV Export to Microsoft Excel Question

    Hi All,
    I know this would be a basic question and I tried searching the forums and did not find any luck. I have implemented the standard ALV and the output is displayed in the table. The standard Export-->Export to Microsoft Excel does not work for me when I click on it. Should I need to enable / trigger this event to make this work?
    Also, Is there anyway that I show the Export to Microsoft Excel option directly in the standard ALV instead of clicking on the Export and then Export to Microsoft Excel?
    Thanks,
    Nagarajan.

    Hi Nagarajan,
    That is a satandard functionality no coding required. it will work.
    Your excel file containes any images??
    Try this...
    l_value                         TYPE REF TO cl_salv_wd_config_table.
    lr_filter  ?= l_value.
    lr_filter->set_export_allowed( abap_true ).
    OR
    If you want to cal excel by using your custom button please check this...blog
    Using WD ABAP ALV export - the hacked way
    also check this...
    Re: How to call manually Export to Excel event of ALV standar component
    Cheers,
    Kris.

  • ALV in Microsoft Excel 2000

    Hi.
    I am trying to use ALV functionality in Web Dynpro ABAP. When downloading to excel I only see the xml data. Is it possible to use the ALV functionality with Microsoft Excel 2000? If not, is there anyway to use the framework by doing some modifications?
    Thanks!
    /Elvez

    Hi Thomas,
    thanks for the reply. OSS note 1064756 is already in the system. When I look at the code, via the debugger, it seems to follow the path for Excel 2000/97. In other words, SAP supports Excel 2000. Nevertheless, when I open the excelsheet it displays the xml data:
    MIME-Version: 1.0
    X-Document-Type: Worksheet
    Content-Type: multipart/related; boundary="----=_NextPart_123"
    ------=_NextPart_123
    Content-Location: file:///C:/xyzhtm
    Content-Transfer-Encoding: text/html
    Content-Type: text/html; charset="utf-8"
    <html xmlns="http://www.w3.org/TR/REC-html40" xmlns:alv="http://www.sap.com/ALV/2.5" ...>
    I tried to remove the part before the <html>-tag and then everything worked fine. Do you know if there is a way to remove the initial information before and after the <html>-tags?
    Thanks!
    /Elvez

  • Exportin Pick List to Microsoft Excel

    Hi,
    Have anyone experienced in generating program to export Pick List to CSV format then to format into a Template in Microsoft Excel ?

    Hi Abbas,
    I agreed with Lakshmanan's reply, and also as a workaround, you can import data from a SharePoint list to a PowerPoint slide using an Excel table on the slide.
    More information:
    http://community.office365.com/en-us/f/154/t/17854.aspx
    Thanks,
    Wendy
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Converting alv list  to excel and send to sapoffice or mail in batch mode

    Hi every one.
    I have the alv list and then I can send to sapoffice or mail in batch mode.
    If I open the list in Sapoffice I can save the list in XLS format or if I open the list by mail, I can select all the content (because is a html file), select the copy option and then open EXCEL and paste the content.
    Can I use an option to convert the alv list to an excel format and then send to mail or sapconnect in batch mode?

    if your requirement is to send a Excel sheet by Email then use this sample program.
    *& Report  ZEMAIL_ATTACH                                               *
    *& Example of sending external email via SAPCONNECT                    *
    REPORT  ZEMAIL_ATTACH                   .
    TABLES: ekko.
    PARAMETERS: p_email   TYPE somlreci1-receiver
                                      DEFAULT '[email protected]'.
    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.
    *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'
                                          'filename'
                                 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
                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
    - Guru

  • Export ALV List into Excel Sheet

    Hi Friends,
    We are displaying an ALV List in report Program and we are exporting that into excel sheet using the icon "Spreadsheet(ctrlshiftF7)"provided by ALV Grid.
    But when it is displayed in Excel sheet it changes the sequence of columns (fields).
    And we observed that it displays all the CHAR fields first then the CURRENCY fields and then the DATE fields that we specified in field catalog.
    So, what should be done so that the fields are exported into Excel in the same order as specified in the field catalog of ALV List.

    Give this a look.
    REPORT ZEXCEL .
    INCLUDE ole2incl.
    DATA: application TYPE ole2_object,
    workbook TYPE ole2_object,
    sheet TYPE ole2_object,
    cells TYPE ole2_object.
    CONSTANTS: row_max TYPE i VALUE 256.
    DATA index TYPE i.
    DATA: BEGIN OF itab1 OCCURS 0, first_name(10), END OF itab1.
    DATA: BEGIN OF itab2 OCCURS 0, last_name(10), END OF itab2.
    DATA: BEGIN OF itab3 OCCURS 0, formula(50), END OF itab3.
    *START-OF-SELECTION
    START-OF-SELECTION.
    APPEND: 'Peter' TO itab1, 'Ivanov' TO itab2,
    '=Sheet1!A1 & " " & Sheet2!A1' TO itab3,
    'John' TO itab1, 'Smith' TO itab2,
    '=Sheet1!A2 & " " & Sheet2!A2' TO itab3.
    CREATE OBJECT application 'excel.application'.
    SET PROPERTY OF application 'visible' = 1.
    CALL METHOD OF application 'Workbooks' = workbook.
    CALL METHOD OF workbook 'Add'.
    Create first Excel Sheet
    CALL METHOD OF application 'Worksheets' = sheet
    EXPORTING #1 = 1.
    CALL METHOD OF sheet 'Activate'.
    SET PROPERTY OF sheet 'Name' = 'Sheet1'.
    LOOP AT itab1.
    index = row_max * ( sy-tabix - 1 ) + 1. " 1 - column name
    CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.
    SET PROPERTY OF cells 'Value' = itab1-first_name.
    ENDLOOP.
    Create second Excel sheet
    CALL METHOD OF application 'Worksheets' = sheet
    EXPORTING #1 = 2.
    SET PROPERTY OF sheet 'Name' = 'Sheet2'.
    CALL METHOD OF sheet 'Activate'.
    LOOP AT itab2.
    index = row_max * ( sy-tabix - 1 ) + 1. " 1 - column name
    CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.
    SET PROPERTY OF cells 'Value' = itab2-last_name.
    ENDLOOP.
    Create third Excel sheet
    CALL METHOD OF application 'Worksheets' = sheet
    EXPORTING #1 = 3.
    SET PROPERTY OF sheet 'Name' = 'Sheet3'.
    CALL METHOD OF sheet 'Activate'.
    LOOP AT itab3.
    index = row_max * ( sy-tabix - 1 ) + 1. " 1 - column name
    CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.
    SET PROPERTY OF cells 'Formula' = itab3-formula.
    SET PROPERTY OF cells 'Value' = itab3-formula.
    ENDLOOP.
    Save excel speadsheet to particular filename
    CALL METHOD OF sheet 'SaveAs'
    EXPORTING #1 = 'c:\temp\exceldoc1.xls' "filename
    #2 = 1. "fileFormat
    Closes excel window, data is lost if not saved
    SET PROPERTY OF application 'visible' = 0.

  • Function module to save the data from ALV list to MS Excel file

    Hi,
    I am displaying an ALV list.
    I am assigning a pushbutton in the GUI status to save the list as a MS Excel file.
    Can you please let me know the function module to achieve this task.
    I tried 'SAP_CONVERT_TO_XLS_FORMAT'  FM but it is giving some type confict error.
    Thanks & Regards,
    Balaji.R

    ALV has this option built in, you may also find FM like [ALV_XXL_CALL|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=alv_xxl_call&adv=false&sortby=cm_rnd_rankvalue].
    Can you elaborate a little more on your need, why adding an option that already exits?
    Regards

Maybe you are looking for

  • How come I can see my div in design view but not in live view

    Hi, I have a div ID called "portfolio" that I can see in design view but not live view or on a browser. It's a little pink square and I want that square round also. I ran it through validator. It picked up some things in the style.css which I changed

  • HP Photosmart 1315 won't print through print server

    I had this working for the longest time though I forgot which settings I used I am pretty sure I got it right, IP printer, using gimp photosmart 1100 and what not and it worked. recently i had to change the ip address range so i deleted the printer a

  • Unusual IOPS MAPS Result in Logarithmic Notation

    The performance metrics report for disk utilization conducted for 72 consecutive hours on a Server 2008 R2 SP1 with a 64TB RAID-6 array being used for a video security camera deployment (110 video cameras) shows the following: Average Disk IOPS 7.320

  • GRUB doesn't load from SSD

    Hey, I wanted to replace my HDD with an SSD. This is what I did: 1. boot into live disk, create partitions on my SSD: #1: /, btrfs, boot flag, #2: /, btrfs on LUKS [edit: I used fdisk, bad idea?] 2. mounted both partitions with compress=lzo, copied b

  • Probleme mit Adobe 11.0.9.29 auf Terminalserver 2012 R2 mit Broker

    Hallo, ich habe einige Problem mit der oben genannten Acrobat Version. 1.) Der Reader stürzt immer wieder ohne ersichtlichen Grund im Terminal ab. 2.) Drucken ist manchmal bei manchen Usern nicht möglich: "Es ist kein Dokument zum drucken ausgewählt"