Reg: ALV report download to excel currency columns

Hi All,
While downloading the alv report to excel, currency fields with negative sign(less than 0) is downloading without negative sign.
And field catalog wad declared as 'CURR' field for that particular column, if I declared as 'CHAR', i am getting shortdump.
Can any one tell me how to get the negative sign.
Thanks in advance.

Hi,
Do you use ALV to excel standard functionality or your own code to excel?
Please provide more information.
Thanks,

Similar Messages

  • Reg: ALV output download using excel option

    Hi Team,
    I  created  a report using ALV Function modules, I want to download in  Excel sheet the  output list. i am trying to download but i am not getting proper values. I am populating around 50 fileds.
    is there any settings for these download.
    <<removed by moderator>>
    Thanks & Regards,
    Mahendar patha.

    hi mahendra;
    use this step-by-step procedure it will help u a lot:
    Firstly export  the data to memory using the FM LIST_FROM_MEMORY.
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = t_listobject
    EXCEPTIONS
    not_found = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE e000(su) WITH text-001.
    ENDIF.
    then i converted it into ASCII using LIST_TO_ASCI,
    CALL FUNCTION 'LIST_TO_ASCI'
    TABLES
    listasci = t_xlstab
    listobject = t_listobject
    EXCEPTIONS
    empty_list = 1
    list_index_invalid = 2
    OTHERS = 3.
    IF sy-subrc NE 0.
    MESSAGE e003(yuksdbfzs).
    ENDIF.
    This gives the data in ASCII format separated by '|' and the header has '-', dashes. If you use this internal table directly without any proccesing in SO_NEW_DOCUMENT_ATT_SEND_API1, then you will not get a good excel sheet attachment. To overcome this limitation, i used cl_abap_char_utilities=>newline and cl_abap_char_utilities=>horizontal_tab to add horizontal and vertical tabs to the internal table, replacing all occurences of '|' with
    cl_abap_char_utilities=>horizontal_tab.
    Set the doc_type as 'XLS', create the body and header using the packing_list and pass the data to be downloaded to SO_NEW_DOCUMENT_ATT_SEND_API1 as contents_bin.
    This will create an excel attachment.
    Sample code for formatting the data for the attachment in excel format.
    u2022     Format the data for excel file download
    LOOP AT t_xlstab INTO wa_xlstab .
    DESCRIBE TABLE t_xlstab LINES lw_cnt.
    CLEAR lw_sytabix.
    lw_sytabix = sy-tabix.
    u2022     If not new line then replace '|' by tabs
    IF NOT wa_xlstab EQ cl_abap_char_utilities=>newline.
    REPLACE ALL OCCURRENCES OF '|' IN wa_xlstab
    WITH cl_abap_char_utilities=>horizontal_tab.
    MODIFY t_xlstab FROM wa_xlstab .
    CLEAR wa_xlstab.
    wa_xlstab = cl_abap_char_utilities=>newline.
    IF lw_cnt NE 0 .
    lw_sytabix = lw_sytabix + 1.
    u2022     Insert new line for the excel data
    INSERT wa_xlstab INTO t_xlstab INDEX lw_sytabix.
    lw_cnt = lw_cnt - 1.
    ENDIF.
    CLEAR wa_xlstab.
    ENDIF.
    ENDLOOP.
    Sample code for creating attachment and sending mail:
    FORM send_mail .
    u2022     Define the attachment format
    lw_doc_type = 'XLS'.
    u2022     Create the document which is to be sent
    lwa_doc_chng-obj_name = 'List'.
    lwa_doc_chng-obj_descr = w_subject. "Subject
    lwa_doc_chng-obj_langu = sy-langu.
    u2022     Fill the document data and get size of message
    LOOP AT t_message.
    lt_objtxt = t_message-line.
    APPEND lt_objtxt.
    ENDLOOP.
    DESCRIBE TABLE lt_objtxt LINES lw_tab_lines.
    IF lw_tab_lines GT 0.
    READ TABLE lt_objtxt INDEX lw_tab_lines.
    lwa_doc_chng-doc_size = ( lw_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
    lwa_doc_chng-obj_langu = sy-langu.
    lwa_doc_chng-sensitivty = 'F'.
    ELSE.
    lwa_doc_chng-doc_size = 0.
    ENDIF.
    u2022     Fill Packing List For the body of e-mail
    lt_packing_list-head_start = 1.
    lt_packing_list-head_num = 0.
    lt_packing_list-body_start = 1.
    lt_packing_list-body_num = lw_tab_lines.
    lt_packing_list-doc_type = 'RAW'.
    APPEND lt_packing_list.
    u2022     Create the attachment (the list itself)
    DESCRIBE TABLE t_xlstab LINES lw_tab_lines.
    u2022     Fill the fields of the packing_list for creating the attachment:
    lt_packing_list-transf_bin = 'X'.
    lt_packing_list-head_start = 1.
    lt_packing_list-head_num = 0.
    lt_packing_list-body_start = 1.
    lt_packing_list-body_num = lw_tab_lines.
    lt_packing_list-doc_type = lw_doc_type.
    lt_packing_list-obj_name = 'Attach'.
    lt_packing_list-obj_descr = w_docdesc.
    lt_packing_list-doc_size = lw_tab_lines * 255.
    APPEND lt_packing_list.
    u2022     Fill the mail recipient list
    lt_reclist-rec_type = 'U'.
    LOOP AT t_recipient_list.
    lt_reclist-receiver = t_recipient_list-address.
    APPEND lt_reclist.
    ENDLOOP.
    u2022     Finally send E-Mail
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = lwa_doc_chng
    put_in_outbox = 'X'
    commit_work = 'X'
    IMPORTING
    sent_to_all = lw_sent_to_all
    TABLES
    packing_list = lt_packing_list
    object_header = lt_objhead
    contents_bin = t_xlstab
    contents_txt = lt_objtxt
    receivers = lt_reclist
    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.
    Hope it will help you
    Regards
    Rahul sharma
    Edited by: RAHUL SHARMA on Nov 4, 2008 1:22 PM

  • Doubt on ALV report download to EXCEL

    Hi All,
    i have written a report with ALV_GRID FM, by default we get the option to download the output to excel. But when we click on the download to excel, it displays the output
    in the frist page, but it also opens so many pages like
    format, header, pivot,sub1,sub1....etc.
    Pls. check the SAP standard report BCALV_TEST_FULLSCREEN, does the same thing when we do download to excel.
    How can i avoid opening so many pages in excel?
    Thanks for the help.
    Sekar

    Hi ,
    prabhu here , i think check the FM wheather u r passing all these to FM. for Excel keep export.param: --> i_save only and check.
    regards
    prabhu

  • ALV report Download to excel from portal

    Hi,
    We have a standard SAP ALV reprot (CATS_DA) which we have brouht onto the portal. We are not abel to download this report in excel foramt. This is not giving any errors. The option is just not working at all. HAs anybody come across thsi issue?
    regards
    Raj

    Hi Raj,
    are you using DOWNLOAD function?
    I am also having the same problem. It is working fine in LAPTOP and not working in Desktop.
    There may be some system settings or javascript issues.
    I will try that in desktop.
    Thanks and regards,
    gopal

  • Reg. Reports download into excel

    Hello Everyone,
    I have installed oracle Application server 10g (10.1.2.0.2) with webutill.
    But while downloading data into Excel sheet it's through an error WUO-712 randomly due to which some of the data is missed out.
    We have installed webutil 10.5 with forms and reports 10g.
    Please suggest some solution for the same.
    Please revert for the same ASAP.
    Thanks in advance
    Regards,
    Ajinkya

    in report we are using local currency and parallel currency. one colum local currency and another colum parallel currency shwoing in report, but i transfer to excel shwoig following format.
    account no     local currency     account no     paraelll currency
    we need following format in excel
    account no    local currency       parellel currency
    regards
    JK Rao

  • Download the ALV Report output into excel sheet or notepad

    Hi,
    how to downlaod the alv report out into excel sheet or notepad in a proper manner. program contain large number records....
    Thanks in advance!!!!
    Regards,
    kranthi.

    Hi
    Download a report to excel with format (border, color cell, etc) 
    Try this program...it may help you to change the font ..etc.
    Code:
    REPORT ZSIRI 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
    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 UP TO 10 ROWS.
    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 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - start
    CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP  EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    tell user what is going on
      SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
      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 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - end
    disconnect from Excel
         CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING  #1 = 'C:\SKV.XLS'.
      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 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.
    ENDFORM.
    *&      Form  ERR_HDL
          outputs OLE error if any                                       *
    -->  p1        text
    <--  p2        text
    FORM ERR_HDL.
    IF SY-SUBRC <> 0.
      WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
      STOP.
    ENDIF.
    ENDFORM.                    " ERR_HDL
    Please note that this example maybe slow at filling the excel table
    (perhaps four fields per second on a 900 MHz machine - almost 30 seconds
    for a short example).
    To get the data on properties and methods - there is a bit of smoke and mirrors
    going on here; they are EXCEL properties and methods, not sap ones - so you need
    to look at excel help to determine how a particular function is structured. then
    build the block in sap, as shown in the example.
    If you only want to transfer the data to Excel like when you transfer the data from
    ALV to Excel simply use the Function Modules:
    XXL_SIMPLE_API
    If you want more modifications when you transfer it to Excel use:
    XXL_FULL_API

  • Download alv report output to excel format with out header line

    Hi experts,
    i want to download a alv report output into excel formatt with out the header line but it has to download including field description. as this output will fed into another transaction, the downloaded excel file should be with out header line.
    fro eg:
    Report   : Zabc                      ABAP Development          Page  :     1
    Run Date : 12/14/06                                                     System: UD400 
    Run Time : 08:45:37
    this header details should not be downloaded into the excel file.
    could somebody help me please.
    thanks
    deepu

    hi jayanti,
    thanks for your response.
    i have delclared all the field types as character but still it is not downloading and it 's sy-subrc is 4... the code is as below.
    *field names
      lt_fieldnames-value = 'Material Number'.
      APPEND lt_fieldnames.
      lt_fieldnames-value = 'Plant'.
      APPEND lt_fieldnames.
      lt_fieldnames-value = 'Material Group'.
      APPEND lt_fieldnames.
      lt_fieldnames-value = 'Material Description'.
      APPEND lt_fieldnames.
      lt_fieldnames-value = 'UOM'.
      APPEND lt_fieldnames.
      lt_fieldnames-value = 'Price Unit'.
      APPEND lt_fieldnames.
      lt_fieldnames-value = 'Material Type'.
      APPEND lt_fieldnames.
      lt_fieldnames-value = 'X-Plant Status'.
      APPEND lt_fieldnames.
      lt_fieldnames-value = 'Valuation Class'.
      APPEND lt_fieldnames.
      lt_fieldnames-value = lw_avmng.
      APPEND lt_fieldnames.
      lt_fieldnames-value = lw_avntp.
      APPEND lt_fieldnames.
      lt_fieldnames-value = 'Latest PO Qty'.
      APPEND lt_fieldnames.
      lt_fieldnames-value = 'Latest PO Cost'.
      APPEND lt_fieldnames.
      lt_fieldnames-value = 'PO Creation Date'.
      APPEND lt_fieldnames.
      lt_fieldnames-value = lw_fcaqt.
      APPEND lt_fieldnames.
      lt_fieldnames-value = 'Prev. Yr. Std. Cost'.
      APPEND lt_fieldnames.
      lt_fieldnames-value = lw_stcst.
      APPEND lt_fieldnames.
      CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
        EXPORTING
          file_name                       = 'XLSHEET'
        CREATE_PIVOT                    = 0
        DATA_SHEET_NAME                 = ' '
        PIVOT_SHEET_NAME                = ' '
        PASSWORD                        = ' '
        PASSWORD_OPTION                 = 0
        TABLES
        PIVOT_FIELD_TAB                 =
          data_tab                        = t_output1
          fieldnames                      = lt_fieldnames
        EXCEPTIONS
          file_not_exist                  = 1
          filename_expected               = 2
          communication_error             = 3
          ole_object_method_error         = 4
          ole_object_property_error       = 5
          invalid_pivot_fields            = 6
          download_problem                = 7
          OTHERS                          = 8
      IF sy-subrc <> 0.
        MESSAGE e001 WITH 'Data could not be downloaded'.
      ENDIF.
    ENDFORM.                               " z_dwn_xl
    thanks
    deepu

  • Problem when dowloading the ALV report output to Excel Sheet.

    Hi ,
    I am dowloading the ALV report output to Excel Sheet.
    There is field Condition Unit(KOMP-KMEIN) in the output of the ALV, this has values PC and CSE , but when I download to Excel Sheet, CSE is appearing as CSE ,but PC is appearing as ******.
    Can you please help me in knowing the reson for this.
    Regards,
    Madhu.

    hi
    refer to following link
    http://www.****************/Tutorials/ALV/ColorSALV/Demo.htm
    http://www.sap-img.com/abap/download-to-excel-with-format-border-color-cell-etc.htm
    Cheers
    Snehi
    Edited by: snehi chouhan on Jul 11, 2008 12:42 PM

  • Using download button in ALV to download to excel

    Hi,
    Please provide me the solution on using download button in Hierarchial List ALV to download to excel.I need to download the Header and Item details in a single line (in one line)in the Excel sheet.
    Please suggest the solution and sample code ASAP.
    Thanks and Regards,
    Latha.

    Hi Rames,
    my mail id : [email protected]
    Thanks and Regards,
    Vidyullatha.

  • Need to send ALV Report as an Excel sheet via Email

    Well , I need to Email an ALV Report as an Excel Sheet using my program. What do I need to do and how?
    Answers will be rewarded with points.
    Thanks

    Hi Manu,
    You can copy and paste the following codes and try to execute..
    Hope this will help you..
    note: dont forget to change 'SAPUSER' to your SAP user id.
    REPORT  yhn_test8                               .
    TYPE-POOLS: slis, slist, truxs.
    DATA t5         LIKE t005t OCCURS 0 WITH HEADER LINE.
    DATA fcat       TYPE slis_t_fieldcat_alv.
    DATA listobject LIKE abaplist OCCURS 0 WITH HEADER LINE.
    DATA stack      TYPE slist_listlevel_stack WITH HEADER LINE.
    DATA ttxt       LIKE solisti1 OCCURS 0 WITH HEADER LINE.
    PARAMETER p_alv   RADIOBUTTON GROUP a.
    PARAMETER p_excel RADIOBUTTON GROUP a.
    START-OF-SELECTION.
      SELECT * INTO TABLE t5
               FROM t005t
              WHERE spras = sy-langu.
      CLEAR : fcat, fcat[].
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'T005T'
        CHANGING
          ct_fieldcat            = fcat
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF p_alv = 'X'.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            it_fieldcat   = fcat
          TABLES
            t_outtab      = t5
          EXCEPTIONS
            program_error = 1
            OTHERS        = 2.
        IF sy-subrc <> 0.
        ENDIF.
      ELSEIF p_excel = 'X'.
        CALL FUNCTION 'LIST_FREE_MEMORY'.
        SUBMIT yhn_test8 EXPORTING LIST TO MEMORY AND RETURN.
        CALL FUNCTION 'LIST_FROM_MEMORY'
          TABLES
            listobject = listobject
          EXCEPTIONS
            not_found  = 1
            OTHERS     = 2.
        IF sy-subrc = 0.
        Generate LIST for excel file
          CALL FUNCTION 'LIST_TO_TXT'
            TABLES
              listtxt            = ttxt
              listobject         = listobject
            EXCEPTIONS
              empty_list         = 1
              list_index_invalid = 2
              OTHERS             = 3.
          IF sy-subrc = 0.
            LOOP AT ttxt.
              REPLACE ALL OCCURRENCES OF '|' IN ttxt-line
                      WITH cl_abap_char_utilities=>horizontal_tab.
              MODIFY ttxt.
            ENDLOOP.
            PERFORM send_email.
          ENDIF.
        ENDIF.
      ENDIF.
    *&      Form  send_email
    FORM send_email .
      DATA docs LIKE docs OCCURS 0 WITH HEADER LINE.
      DATA excelsize TYPE i.
      DATA excel LIKE solisti1   OCCURS 0 WITH HEADER LINE.
      DATA doc LIKE sodocchgi1.
      DATA excelln TYPE i.
      DATA int_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
      DATA int_objhead LIKE solisti1   OCCURS 2 WITH HEADER LINE.
      DATA int_objtext LIKE solisti1   OCCURS 0 WITH HEADER LINE.
      DATA int_reclist LIKE somlreci1  OCCURS 1 WITH HEADER LINE.
      DATA bodyln LIKE sy-tabix.
      DATA output_data TYPE ssfcrescl.
      excel[] = ttxt[].
    excel table sizes
      DESCRIBE TABLE excel LINES excelln.
    Body Email
      int_objtext-line = 'Test Body'.
      APPEND int_objtext.
      DESCRIBE TABLE int_objtext LINES bodyln.
      READ     TABLE int_objtext INDEX bodyln.
      CLEAR doc.
      doc-doc_size   = ( bodyln - 1 ) * 255 + STRLEN( int_objtext ).
      doc-obj_name   = ' '.
      doc-sensitivty = 'P'.
      doc-proc_syst  = sy-sysid.
      doc-proc_clint = sy-mandt.
      CLEAR: int_objpack, int_objpack[].
      int_objpack-transf_bin = ' '.
      int_objpack-head_start = 1.
      int_objpack-head_num   = 0.
      int_objpack-body_start = 1.
      int_objpack-body_num   = bodyln.
      int_objpack-doc_type   = 'RAW'.
      int_objpack-obj_descr  = 'Test'.
      APPEND int_objpack.
      CLEAR: int_objhead, int_objhead[].
      int_objhead            = 'Attachment'.
      APPEND int_objhead.
      int_objpack-transf_bin = 'X'.
      int_objpack-head_start = 1.
      int_objpack-head_num   = 0.
      int_objpack-body_start = 1.
      int_objpack-body_num   = excelln.
      int_objpack-doc_size   = excelsize.
      int_objpack-doc_type   = 'XLS'.
      int_objpack-obj_name   = 'excel'.
      int_objpack-obj_descr  = 'test.xls'. "File name
      APPEND int_objpack.
      Set Receiver
      int_reclist-receiver   = 'SAPUSER'.
      int_reclist-rec_type   = 'B'.
      int_reclist-notif_del  = 'X'.
      int_reclist-notif_read = 'X'.
      int_reclist-notif_ndel = 'X'.
      int_reclist-express    = 'X'.
      APPEND int_reclist.
      doc-obj_descr = 'Report in Excel'.
      Sending Email
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = doc
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = int_objpack
          object_header              = int_objhead
          contents_bin               = excel
          contents_txt               = int_objtext   "Body
          receivers                  = int_reclist
        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.
    ENDFORM.                    " send_email

  • How to download ALV report having more than 200 columns to Excel

    Dear Experts,
    I am facing the issue of line break during downloading ALV report into excel. I referred the lot of forums but i didn't get the proper solution to solve this issue..Please guide me to solve this issue....
    My output in ALV
    header1 header2..........header200
    but when i download that to spreadsheet i am getting like this
    header1 header2.....
    header65 header66....
    header199...
    Regards,
    Rathish
    Edited by: joerathish on Jun 3, 2011 9:53 AM

    joerathish wrote:
    not working well.
    Do you get a excel with empty sheet with excel in place ?
    Then you need to enable macro in trust center of excel sheet settings. The way you do this depends on the version of excel you are using.
    I am able to get 200+ columns perfectly this way.
    Regards

  • Export option in ALV report downloades first two columns blank

    Hi ,
    Before posting this query I searched the solution in SDN but I did't find the solution.
    My problem is  After displaying report in ALV format ,if I press Export --> Local file --->spreadsheet ;  file will downloaded to excel sheet but first two columns(only heading no data ) will be blank  and next two columns with proper data.
    I checked field catalog defination it seems to be ok,  any other mistake ?
    Please suggest.
    Narayan

    Hi
    It's the option you have in the path System->List->Save->Local file
    I means it's the standard option to export an abap list into a local file, so you should try this path too and check if the resul it's the same
    I think you should choose  Export --->spreadsheet: here before saving the file an excel document will be open
    Max

  • ALV  download to EXCEL  with column headings etc.

    Getting data from a grid to EXCEL can be done in "List" mode vis system==>save etc but it's not particularly user friendly and in any case if you are displaying a nice ALV why should the user have to switch into LIST mode anyway.
    Anyway here's a decent way to do it and it gives great formatted column headings etc etc.
    1) in the ON_TOOLBAR method add this code
    method ON_TOOLBAR.
    type-pools icon.
    CLEAR ls_toolbar.
    MOVE  0 TO ls_toolbar-butn_type.
        MOVE 'EXCEL' TO ls_toolbar-function.
        MOVE  space TO ls_toolbar-disabled.
        MOVE  icon_xxl TO ls_toolbar-icon.
        MOVE 'Excel' TO ls_toolbar-quickinfo.
        MOVE  'EXCEL' TO ls_toolbar-text.
        APPEND ls_toolbar TO e_object->mt_toolbar.
    2) In the ON_USER_COMMAND method add the following
    (if you have a class defined with SE24 you don't need the commented code).
    method ON_USER_COMMAND.
           FOR EVENT before_user_command OF cl_gui_alv_grid
           IMPORTING
             e_ucomm
             sender.
    CASE e_ucomm.
         .......   other toolbar funcs if you have any
          WHEN 'EXCEL'.
            CALL METHOD me->download_to_excel.
        ENDCASE.
    endmethod.
    3) code this method to download to EXCEL
    method DOWNLOAD_TO_EXCEL.
    FIELD-SYMBOLS:
           <fs0> TYPE STANDARD TABLE,
           <fs1> TYPE STANDARD TABLE.
        ASSIGN g_outtab1->* TO <fs0>.
        ASSIGN g_fldcat1->* TO <fs1>.
           CALL FUNCTION  'LVC_TRANSFER_TO_KKBLO'
          EXPORTING
            it_fieldcat_lvc   = <fs1>
        is_layout_lvc     = m_cl_variant->ms_layout
             is_tech_complete  = ' '
          IMPORTING
            es_layout_kkblo   = ls_layout
            et_fieldcat_kkblo = lt_fieldcat.
        LOOP AT lt_fieldcat INTO lt_fieldcat_wa.
          CLEAR lt_fieldcat_wa-tech_complete.
          IF lt_fieldcat_wa-tabname IS INITIAL.
            lt_fieldcat_wa-tabname = '1'.
            MODIFY lt_fieldcat FROM lt_fieldcat_wa.
          ENDIF.
          l_tabname = lt_fieldcat_wa-tabname.
        ENDLOOP.
        CALL FUNCTION 'ALV_XXL_CALL'
             EXPORTING
                  i_tabname           = l_tabname
                  is_layout           = ls_layout
                  it_fieldcat         = lt_fieldcat
                  i_title             = sy-title
             TABLES
                  it_outtab           = <fs0>
             EXCEPTIONS
                  fatal_error         = 1
                  no_display_possible = 2
                  OTHERS              = 3.
        IF  sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    endmethod.
    You get nice column headings etc and decently formatted EXCEL spreadsheet.
    For Office 2007 I think you need to apply a SAP note but it certainly works with OFFICE 2003 which is what we are still using.
    Cheers
    jimbo

    Getting data from a grid to EXCEL can be done in "List" mode vis system==>save etc but it's not particularly user friendly and in any case if you are displaying a nice ALV why should the user have to switch into LIST mode anyway.
    Anyway here's a decent way to do it and it gives great formatted column headings etc etc.
    1) in the ON_TOOLBAR method add this code
    method ON_TOOLBAR.
    type-pools icon.
    CLEAR ls_toolbar.
    MOVE  0 TO ls_toolbar-butn_type.
        MOVE 'EXCEL' TO ls_toolbar-function.
        MOVE  space TO ls_toolbar-disabled.
        MOVE  icon_xxl TO ls_toolbar-icon.
        MOVE 'Excel' TO ls_toolbar-quickinfo.
        MOVE  'EXCEL' TO ls_toolbar-text.
        APPEND ls_toolbar TO e_object->mt_toolbar.
    2) In the ON_USER_COMMAND method add the following
    (if you have a class defined with SE24 you don't need the commented code).
    method ON_USER_COMMAND.
           FOR EVENT before_user_command OF cl_gui_alv_grid
           IMPORTING
             e_ucomm
             sender.
    CASE e_ucomm.
         .......   other toolbar funcs if you have any
          WHEN 'EXCEL'.
            CALL METHOD me->download_to_excel.
        ENDCASE.
    endmethod.
    3) code this method to download to EXCEL
    method DOWNLOAD_TO_EXCEL.
    FIELD-SYMBOLS:
           <fs0> TYPE STANDARD TABLE,
           <fs1> TYPE STANDARD TABLE.
        ASSIGN g_outtab1->* TO <fs0>.
        ASSIGN g_fldcat1->* TO <fs1>.
           CALL FUNCTION  'LVC_TRANSFER_TO_KKBLO'
          EXPORTING
            it_fieldcat_lvc   = <fs1>
        is_layout_lvc     = m_cl_variant->ms_layout
             is_tech_complete  = ' '
          IMPORTING
            es_layout_kkblo   = ls_layout
            et_fieldcat_kkblo = lt_fieldcat.
        LOOP AT lt_fieldcat INTO lt_fieldcat_wa.
          CLEAR lt_fieldcat_wa-tech_complete.
          IF lt_fieldcat_wa-tabname IS INITIAL.
            lt_fieldcat_wa-tabname = '1'.
            MODIFY lt_fieldcat FROM lt_fieldcat_wa.
          ENDIF.
          l_tabname = lt_fieldcat_wa-tabname.
        ENDLOOP.
        CALL FUNCTION 'ALV_XXL_CALL'
             EXPORTING
                  i_tabname           = l_tabname
                  is_layout           = ls_layout
                  it_fieldcat         = lt_fieldcat
                  i_title             = sy-title
             TABLES
                  it_outtab           = <fs0>
             EXCEPTIONS
                  fatal_error         = 1
                  no_display_possible = 2
                  OTHERS              = 3.
        IF  sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    endmethod.
    You get nice column headings etc and decently formatted EXCEL spreadsheet.
    For Office 2007 I think you need to apply a SAP note but it certainly works with OFFICE 2003 which is what we are still using.
    Cheers
    jimbo

  • Problem in ALV grid download to excel

    Hello Gurus,
    I have a ALV report which has 40 columns but at a time it will only display 100 records(max). when I am trying to download it into excel (by using standard funcationality) only headings are getting downloaded. I checked out standard table download like MARA,VBAK but they are downloading properly.
    what could be the reason..?
    Thanks in advance.
    Thanks and Regards,
    Saurabh Chhatre

    Hi,
    i am implementing alv by grid method using function module. By my previous experience u do not need to do anything to get the alv in excel format(std. funcationality is provided by SAP itself). But this is not working right now .. apart from headings nothing is coming in file download.
    thanks and regards,
    saurabh chhatre

  • ALV Tree download to Excel (CL_GUI_LIST_TREE )

    Hi All,
         I have created a report for displaying the ALV tree. The flow of the code is sth like this:
    Report -> Calls Screen 9000 -> Initialize container type CL_GUI_CUSTOM_CONTAINER -> Tree Class CL_GUI_LIST_TREE displays the ALV tree.
    Now what I want is a way to download the ALV Tree to Excel format. Can you please help me on this.
    Thanks,
    Anuj

    Anuj,
    check these threads
    ALV tree control report to excel
    reg:alv tree Excel Download
    http://www.sapfans.com/forums/viewtopic.php?f=12&t=138177
    Thanks
    Bala Duvvuri

Maybe you are looking for