Excel File Format Problem while downloading in ALV Grid

Hi All,
My program gives an ALV Grid Output which contains the file download button , when I choose spread sheet as the file format , the actual data starts only from 4th line and the lines above it contain date, heading etc and the rest are blank. Is it possible that I can download only the records in the grid output with the column names and not the unnecessary log?
Also the format is not proper excel format, this same file will be used for upload into another program using the Function Module 'TEXT_CONVERT_XLS_TO_SAP'. When I load the file saved in the above format, this Function Module always fails.
Please let me know any solution for this problem
Thanks in Advance.

Hi
try this code----
*&      Form  DOWNLOAD_EXCEL_TEMPLATE
      text
-->  p1        text
<--  p2        text
FORM download_excel_template .
  TYPES: BEGIN OF lt_data,
            field1(20),
            field2(30),
            field3(20),
            field4(20),
            field5(20),
            field6(30),
            field7(15),
            field8(10),
            field9(10),
            field10(20),
            field11(20),
            field12(10),
            field13(20),
            field14(20),
          END OF lt_data.
  DATA: lv_file TYPE rlgrap-filename,
        li_data TYPE STANDARD TABLE OF lt_data,
        wa_data TYPE lt_data,
        lv_pathcheck type c,
        lv_file1 type string.
  wa_data-field1 = ''.
  APPEND wa_data TO li_data.
  REFRESH gi_header.
  wa_header-name = 'Company Code'.
  APPEND wa_header TO gi_header.
  wa_header-name = 'Main Asset Number'.
  APPEND wa_header TO gi_header.
  wa_header-name = 'Asset Sub Number'.
  APPEND wa_header TO gi_header.
  wa_header-name = 'Document Date'.
  APPEND wa_header TO gi_header.
  wa_header-name = 'Posting Date'.
  APPEND wa_header TO gi_header.
  wa_header-name = 'Asset Value Date'.
  APPEND wa_header TO gi_header.
  wa_header-name = 'Item Text'.
  APPEND wa_header TO gi_header.
  wa_header-name = 'Reference'.
  APPEND wa_header TO gi_header.
  wa_header-name = 'Allocation'.
  APPEND wa_header TO gi_header.
  wa_header-name = 'Amount Posted'.
  APPEND wa_header TO gi_header.
  wa_header-name = 'Percentage Rate'.
  APPEND wa_header TO gi_header.
  wa_header-name = 'Quantity'.
  APPEND wa_header TO gi_header.
  wa_header-name = 'Prior-Yr Quantity'.
  APPEND wa_header TO gi_header.
  wa_header-name = 'Curr-Yr Quantity'.
  APPEND wa_header TO gi_header.
  lv_file = gv_file.
  lv_file1 = gv_file.
  CALL METHOD cl_gui_frontend_services=>directory_exist
    EXPORTING
      directory            = lv_file1
    RECEIVING
      result               = lv_pathcheck
    EXCEPTIONS
      cntl_error           = 1
      error_no_gui         = 2
      wrong_parameter      = 3
      not_supported_by_gui = 4
      OTHERS               = 5.
   FIND '.xls' IN lv_file IGNORING CASE.
  IF sy-subrc = 0.
    REPLACE '.XLS' IN lv_file WITH ' ' IGNORING CASE.
  ENDIF.
  FIND '.TXT' IN lv_file IGNORING CASE.
  IF sy-subrc = 0.
    REPLACE '.TXT' IN lv_file WITH ' ' IGNORING CASE.
  ENDIF.
  CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
    EXPORTING
      file_name                 = lv_file
      data_sheet_name           = 'DATA'
    TABLES
      data_tab                  = li_data
      fieldnames                = gi_header
    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 ID gv_msgid TYPE 'E' NUMBER 002.
  ENDIF.
ENDFORM.                    " DOWNLOAD_EXCEL_TEMPLATE
regards,
Prashant

Similar Messages

  • Problem while downloading the alv output to excel file.

    Hii,
    While downloading the alv output to an excel file i am facing a problem. Either the output comes as 1.23456E+11 or the values get cut .
    Cant put in txt file  as the users require to calculate directy and i have even tried to increase the output length .But both doesnt help.
    So what are the other ways to do so.
    Edited by: mansi_v27 on Mar 24, 2010 12:35 PM

    Hi,
    Welcome to SCN!!!.
    Please go through the forum rules. This has been discussed many times. You can search in the forum for this.
    Infact there is no problem. Just expand that excel cell. You can see the full value. This is standard excel property.
    Thanks,
    Vinod.

  • Problem while downloading a ALV report to excel

    Hi experts,
    I have an ALV report which took long time to extract records from various table. So while there is some restriction the report can be executed well in foreground. And the report can be extracted well to excel sheet. But while there is hudge records, i have to execute the report in backgroung. And then from spool i generally prefers to download the report to excel.
    There is a field UOM where it contains value ' " ' for some records. And also there may be possiblity that other fields can also contain the same.
    Now my problem is: while download to excel... When ever there is a value ' " ' from this point to the next value ' " '. It is treating as one record. and keep that in a same position in the excel sheet.
    But i want to keep all the values in there respective fields. Can you please how can i do that? Please give me some solution...
    regards,
    charles.

    If anybody have any solution please send me....

  • Problem while downloading ALV GRID Output to Local Spreadsheet(Excel) File.

    Hi,
    I am displaying output in ALV GRID. While downloading the output to Excel file using "Local File" option provided by ALV.
    But while downloading the columns and their respective values are coming in single column vertially of excel file instead of horizontal.
    e.g. Grid output is as follows.
    F1 F2
    V1 V2
    (F represents Field Title, and V represent Value)
    Downloaded Excel File content:-
    F1
    F2
    V1
    V2
    Please help.

    Hi ,
    Please use below FM :
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filename = 'C:\Documents and Settings\akshayr2403\Desktop\docs\rep.xls'
    FILETYPE = 'WK1'
    WRITE_FIELD_SEPARATOR = 'X'
    tables
    data_tab = it_vbak
    EXCEPTIONS
    FILE_WRITE_ERROR = 1
    NO_BATCH = 2
    GUI_REFUSE_FILETRANSFER = 3
    INVALID_TYPE = 4
    NO_AUTHORITY = 5
    UNKNOWN_ERROR = 6
    HEADER_NOT_ALLOWED = 7
    SEPARATOR_NOT_ALLOWED = 8
    FILESIZE_NOT_ALLOWED = 9
    HEADER_TOO_LONG = 10
    DP_ERROR_CREATE = 11
    DP_ERROR_SEND = 12
    DP_ERROR_WRITE = 13
    UNKNOWN_DP_ERROR = 14
    ACCESS_DENIED = 15
    DP_OUT_OF_MEMORY = 16
    DISK_FULL = 17
    DP_TIMEOUT = 18
    FILE_NOT_FOUND = 19
    DATAPROVIDER_EXCEPTION = 20
    CONTROL_FLUSH_ERROR = 21
    OTHERS = 22
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Also, if your problem still persist, please refer SAP's demo code on ALV "BCALV_FULLSCREEN_DEMO".
    There are many sample codes available, what you need to do is just go to SE38 and put BCALV* and do F4.
    I hope this will help you.
    Regards,
    Rahul Mahajan

  • How to download alv grid output(with field catalog) into excel file format

    Hi all,
    How to download alv grid output(with field catalogs) into excel file format and same file has to download to application server.
    Please help.
    Regards,
    Satya.

    Hi,
    On list where alv is displayed, select export icon( green color -> ),select spread sheet.
    This will display records in Excel sheet.

  • Facing a Problem while downloading the data from ALV Grid to Excel Sheet

    Hi Friends,
    Iam facing a problem while downloading the data from ALV Grid to excel sheet. This is working fine in Development server , when comes to Quality and Production servers I have this trouble.
       I have nearly 11 fields in ALV Grid and out of which one is PO number of length 10 , all the ten numbers are visible in the excel sheet if we download it from development server but when we download it from Quality or Production it is showing only 9 numbers.
    Can any one help me out in this case.

    hi...
    if this problems happens dont display the same internal as u finally got.
    just create new internal table without calling any standard data elements and domains... but the new internal table s similar like ur final internal table and move all the values to new int table.
    for eg.
    ur final internal int table for disp,
         data : begin of itab occur 0,
                        matnr like mara-matnr,
                   end of itab.
    create new like this,
               data : begin of itab occur 0,
                        matnr(12) type N,
                   end of itab.

  • Facing problem while downloading ALV grid Output into Excel

    Hi Guys,
    I am facing problem while downloading ALV grid Output into Excel.
    It is downloading into excel, but all character columns first and next all quantity columns it is displaying. But I need columns order as it is in the grid.
    If I take all columns as characters it works fine. But it will be problem for calculating total, subtotals of quantity columns
    Can someone help me regarding this
    thanks for your help

    Hi,
    Open up Excel on your desktop. Goto Tools > Macro > Security.
    Make sure that your security is set to Medium (or less). SAP uses OLE automation to run the Excel instance and in Office 2003 (for example), Microsoft has increased their default security setting to High. With the High setting, the output to Excel fails.
    Was this your problem? Don't forget those points, either.
    check with this wetther it is solved or not.
    Regards,
    sana.

  • Japanese character problem while downloading file to application server

    Hello All,
    We are facing a strange problem while downloading a file to application server when file contains japanese text.
    We are downloading vendor and customer information in a flat file format on application server. When the login language is EN program show ouput in a properly formatted manner.
    When the login language is JA (japanese) program does download file with customer vendor data. I can see the description is japanese language but the formatting is gone for a toss.
    We are facing similar issue with other programs downloading files on the application server.
    I am using OPEN DATASET........ENCODING DEFAULT. and working on unicode enabaled ECC 6.0 system
    Quick help appriciated.
    Thanks!

    Hi
    Sometimes this also happens because of your desktop setting.Make sure that your OS also supports the JAPANESSE language.
    Ask your technical support team to enable them in your desktop.
    Thanks & Regards
    Jyo

  • The data type DEC while downloading from ALV to EXCEL

    The data type DEC while downloading from ALV to EXCEL is giving some invalid data .
    Ex : In ALV field is the time difference in  hours:minutes
      if the value is  :23 in Excel it will be 22:59 .
    Please Suggest immediately

    Hi ....
    I have the similar problem. My coumns are not in any sequence when I download it to excel sheet.
    How do I fix it.
    Neha

  • 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

  • Conversion of internal table into excel file format &put it on app server

    Hi,
    My requirement is to convert the internal table into excel file format and I have to store it on application server so that administrator can send the file thr e-mail attachment.
    So, please let me know how to convert the records of internal table and store it on application server in Excel file format.
    TIA,
    Nitin

    Hi,
      Use FM GUI_DOWNLOAD to download the data from inernal table to excel sheet.
    Then Using tcode CG3Z u can transfer file to application server.
    *&      Form  sub_download
          text
    -->  p1        text
    <--  p2        text
    FORM sub_download.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
        BIN_FILESIZE                    =
          filename                        = p_path
         filetype                        = 'ASC'
        APPEND                          = ' '
         write_field_separator           = 'X'
        HEADER                          = '00'
        TRUNC_TRAILING_BLANKS           = ' '
        WRITE_LF                        = 'X'
        COL_SELECT                      = ' '
        COL_SELECT_MASK                 = ' '
        DAT_MODE                        = ' '
        CONFIRM_OVERWRITE               = ' '
        NO_AUTH_CHECK                   = ' '
        CODEPAGE                        = ' '
        IGNORE_CERR                     = ABAP_TRUE
        REPLACEMENT                     = '#'
        WRITE_BOM                       = ' '
        TRUNC_TRAILING_BLANKS_EOL       = 'X'
        WK1_N_FORMAT                    = ' '
        WK1_N_SIZE                      = ' '
        WK1_T_FORMAT                    = ' '
        WK1_T_SIZE                      = ' '
      IMPORTING
        FILELENGTH                      =
        TABLES
          data_tab                        = it_final
        FIELDNAMES                      =
      EXCEPTIONS
        FILE_WRITE_ERROR                = 1
        NO_BATCH                        = 2
        GUI_REFUSE_FILETRANSFER         = 3
        INVALID_TYPE                    = 4
        NO_AUTHORITY                    = 5
        UNKNOWN_ERROR                   = 6
        HEADER_NOT_ALLOWED              = 7
        SEPARATOR_NOT_ALLOWED           = 8
        FILESIZE_NOT_ALLOWED            = 9
        HEADER_TOO_LONG                 = 10
        DP_ERROR_CREATE                 = 11
        DP_ERROR_SEND                   = 12
        DP_ERROR_WRITE                  = 13
        UNKNOWN_DP_ERROR                = 14
        ACCESS_DENIED                   = 15
        DP_OUT_OF_MEMORY                = 16
        DISK_FULL                       = 17
        DP_TIMEOUT                      = 18
        FILE_NOT_FOUND                  = 19
        DATAPROVIDER_EXCEPTION          = 20
        CONTROL_FLUSH_ERROR             = 21
        OTHERS                          = 22
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " sub_download
    Otherwise use OPEN DATASET and TRANSFER statement to download data from internal table to direct application server
    Regards,
    Prashant

  • Tranfer table content in to excel file format

    HI
    I have Created one table .and I want to download this table in to excel file format.how can i do this.

    Hi Vijay
    1) Type the t-code SE16
    2) Type the table name, for example USR02
    3) Press F7 to view the table contents
    4) If you need filter the data in the next screen you could do it.
    5) Press F8 or press the execute bottom.
    In the next screen you will find the result.
    In the menu, follow the options:
    System->List->Save->Local File->Spreadsheet
    Type the excel name, and click generate
    Hope it helps, and please reward points if helpful
    Regards

  • Download from ALV grid to PDF format

    hai Friends!
       plz tell me how can i download from ALV grid to PDF format..
    send me some sample codes

    check this thread
    ALV Grid to PDF
    and do use the search functionality from next time and post the question only wheb u dont find the answer
    кu03B1ятu03B9к

  • File formats for uploading/download

    Hi Experts,
    Loading of data(master/transaction) involved two steps.
    1. Loading file to Data files folder .
    2. From Data file folder to BPC application.
    For step1, what are BPC allowed file formats? Is it only .txt & .csv?
    For step2 , what are BPC allowed file formats?
    For downloading data from BPC to flat files, what are allowed file formats?
    thanx,

    Hi,
    You should be able to check the DEFAULT_EXTENSIONS parameter in the application set parameters to see what is allowed and control allowed file types. You can see the documentation on this topic here: [http://help.sap.com/saphelp_bpc75_nw/helpdata/en/f7/d21edd2f4c4f78b0a5be2b16e19ca1/frameset.htm]
    As far as file types for export, this is determined by the data manager package exporting the data. I believe the delivered data manager packages usually export in a CSV format with a file extension of your choosing, but a custom package could export data in any format required.
    Ethan

  • Output report data to excel file format or csv format

    Is there any way to save softcopy of report output to excel file format or csv format.

    Hi,
    Regarding csv file format, i have no issues. The file is generating without any issues in using oracle reports without using any PL/SQL code.
    My requirement is to design oracle reports to generate excel (.xls) file with multiple worksheets. Each sheets are having many data and graphs(chart).
    Using oracle reports alone, how to achieve this.
    In oracle reports 10g 1.2.0 version, I tried by creating .rdf file but, it is generating single worksheet only.
    In oracle reports 10g 1.2.0 ver, I tried by creating .jsp file. For this first i am creating excel template about how my ouput column headings all that going to be with one sample hard coded data and save the excel file as web page.
    Eg employee.html.
    Next open the html file in oracle reports builder and double click the websource now, you will see the jsp tags, html and xml tags. Now include the contentType="application/vnd.ms-excel " and charset also.
    Next, include the <rw:foreach id="G_EMPNO_1" src="G_EMPNO">
    here insert the fieldl for each column by removing the hard coded values.
    close the tag
    </rw:foreach>
    Save the file as .jsp and deploy it in oc4 enabled folder (say, devsuite_home/reports/j2ee/reports_ids/web
    Start the oc4J server
    Run it in the browser http://server:port/reports/emp.jsp?useride=uid/pwd@db
    It is invoking the Microsoft excel with 3 sheets default and my emp table output in the first page.
    We can save this output file as .xls file by clicking file -> save as.
    1) The question is, it is working fine with Microsoft excel 97-2003 version. But for excel 2007, i am not able to create single html file like how 2003 save web page option.
    2) I found this in oracle getting started demo
    http://www.oracle.com/technology/products/reports/htdocs/getstart/demonstrations/index.html
    Which is more useful. This is what i am looking for.
    I done that in excel 2003 as per demo. But excel 2007 with reports 10g issues.
    Is there any demo for 10g with excel 2007
    3) For most of excel issues working fine with excel 2003 and 10g. But excel 2007 with 10g reports are issues.
    I want the excel output from oracle reports with multiple worksheet similar to the above demo.
    Thank you.

Maybe you are looking for

  • All Music and Video gone from Ipod classic - help please.

    I unplugged my ipod from my work pc yesterday and found that all the music and video have apparently been erased. I've plugged it back in this morning in the hope that an xml file needs rebuilding somewhere and itunes is showing my ipod as empty, eve

  • Unable to share files between two macs

    I'm trying to setup my iMac and my wife's iMac to share files through an Airport Extreme base station. I turned file sharing on on both computers and I can now see my wife's computer in the sidebar of the finder window. It says "Not connected' in the

  • How do I load data into my palm??

    Hi I was wondering how I can get new data for my database into my palm. I've got a text-database and I want to try to get it in the Palm and make a program for it. So my problem is: How can I get data into the mobile device without typing it myself.

  • HT201272 My movies tab is not in the options of the downloaded page. Why?

    Unable to re-download movies onto my iPad after purchasing them on the pc

  • Oracle 12c workspace creation

    Hi all! How can I create APEX workspace referencing to local user (Oracle 12c)? APEX_040200, ANONYMOUS, XDB, APEX_PUBLIC_USER is comon users by default, but HR and so on are local. What should i do?