Preceeding zeros disapprearing in the excel download.

I have programmed ALV report using function module REUSE_ALV_GRID_DISPLAY.
I have declared my final output internal table's  batch field as CHARG_D which is of 10 characters.
I have passed field_catelog-no_zero = 'X'. for batch field.
However when I download into excel sheet, preceeding zeros of batch disappearing in excel sheet.
Is there any way to retain the preceeding zeros for batch values and other similar fields values  in the excel sheet after download ?
THANKS IN ADVANCE.

There's a few variations on how to get the data from ALV into Excel and I don't have a system right now, so I can only give a general comment. If the direct export to Excel (OLE) doesn't work, I'd recommend to export the data as local file using format Spreadsheet and give it an extension like ".csv".
When saving the file this way, it really is just a tab separated file (text file, you can view it via Notepad and check for the leading zeros), which you can open in Excel. However, you have to be careful, because when you double-click on the file, Excel will usually open the file directly and format your batch (CHARG_D) field with type General. As a result anything that looks like a number, will be stripped off the leading zeros. Therefore instead you should open the data via the import wizard (e.g. in Excel 2007 it's on the Data ribbon under Get external data and then choosing From text) and reformat the field CHARG_D from General to Text. This will ensure that you'll keep the leading zeros.
There's lots of other ways to do it and my version is probably not the most efficient. However, it works in general, as long as you see the leading zeros in the ALV and is easy to remember (at least for me)...
Good luck, harald

Similar Messages

  • Removing zeros on the excel download

    I wanted to know how we can remove zeros from the kebtr at the excel download through ALV without converting it to a type c. for now I am converting it to type c and then validating it this way :
    if tb_main-kebet = 0.
        tb_main1-kebtr = space.
      endif.
    But because of this the formats are not ok and user insists that it should be a numberic field for him.
    Thank you very much.

    Hello Kris,
    I am able to see the data properly in XLS File.
    Use fieldcatlog no_zero = 'X'.
    Now run the transaction -> click on XL Icon ( if you do not get the data properly using navigation),now see the results here.
    you can save same xls file into local machine too.
    Thanks
    Seshu

  • Problem with the Excel Download with GUI_DOWNLOAD

    Hi Sdn,
    I am reading the long text from FM READ_TEXT and downloding that text to Excel file  in one cell with the GUI_DOWNLOAD FM (I got 16 lines of text and by using CONCATENATE i got 16 lines of text into a string variable).
    The problem here I am facing is.
    The text contains a # symbol in one line (Which is not a last line).
    After downloading the file the text after the # symbol is coming in the next line.
    I tried to REPLACE that # symbol with space but failed.
    System not at all reading that symbol also.
    The text came as LEE, ANDREW" Completed On: 2010/09/04#
    Can any one help me to solve this issue.
    Edited by: Naresh Nelapatla on Apr 20, 2011 8:27 PM

    Hi Naresh,
    My thoughts on a possible solution, convert the last character value to a HEX value and check if it falls within the ASCII/Unicode CP range, Obviously this becomes easier if you are just looking at a single language character set.
    The below FM and code helps you check if the character falls within the ASCII char set.
    DATA: l_in_char TYPE string,
          l_out     TYPE xstring.
    CALL FUNCTION 'NLS_STRING_CONVERT_FROM_SYS'
      EXPORTING
        lang_used                   = sy-langu
        SOURCE                      = l_in_char
      TO_FE                       = 'MS '
    IMPORTING
       RESULT                      = l_out
      SUBSTED                     =
    EXCEPTIONS
       illegal_syst_codepage       = 1
       no_fe_codepage_found        = 2
       could_not_convert           = 3
       OTHERS                      = 4.
    IF l_out LT '0' OR l_out GT '7F'.
      WRITE: 'error'.
    ENDIF.
    Links: http://www.asciitable.com/
              http://www.utf8-chartable.de/unicode-utf8-table.pl
    Regards,
    Chen
    Edited by: Chen K V on Apr 21, 2011 11:25 AM

  • How to hide the coloumns in the excel download Using I_OI_SPREADSHEET

    Hi,
    How to hide or delete the coloumns which are not containing any values ,I am using interface  I_OI_SPREADSHEET.
    There is a method in this interface HIDE_COLUMNS please let me know if any body knows how to use this method to hid the coloumns in the spread sheet download.
    Thanks in advance,
    Regards,
    Venu

    Hi,
    You just define first column and last column you want to hide from method:
    CALL METHOD go_excel->go_spreadsheet->hide_columns
      EXPORTING
        name     = 'test'
    *    no_flush = ' '
        first    = 2 "you want to hide row 2nd and 3rd
        last     = 3
      IMPORTING
        error    = go_excel->go_error
        retcode  = go_excel->gc_retcode.
    Regards,

  • Excel Download of a Web SAP BW Report asks userid and password.please help

    Dear BW folks,
    Issue: When I run a specific SAP BW Report from Web and download the same into excel & csv.
    When I open the excel file downloaded, it asks me user name and password to enter. csv file downloaded doesn't ask.
    The report has 0cust_sales hierarchy and SBU hierarchy.
    Is there any thing to do with these hierarchies that the excel download is asking user name and password?
    Please help me out!!!!! This report needs to be downloaded into excel sent to my manager.....
    Regards
    Pavan

    Hi Pavan
    It is possible,please refer the below link
    Report execution without prompting user id
    Providing un-secured access to a web report.
    Also, for the time being, you can run the query and save a workbook and sent across
    These will resolve the issue
    Thanks
    Pavan Agarwal

  • Excel download from ALV not working inproduction

    Hi all,
    I am using "set_table_for_first_display" for alv display. the excel download from alv is woking fine in development and quality stystem but in production only first 3-4 rows are getting downloaded. Other rows donot appear in excel.
    Any Idea !!!
    Thanks
    Madhu

    Hi Experts,
    I have noticed that same problem is occuring in development system also with same set of data . The ascii file created has some missing rows. I guess its due to some special characters though i am not able to see any special character . Any solution for this.
    Regs
    madhu

  • Repetition of header in ALV output once excel download is selected

    Hi Experts,
    I have alv report where I use FM as below
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program     = w_repid
          i_callback_top_of_page = 'TOP-OF-PAGE'  "see FORM
          is_layout              = l_layout
          it_fieldcat            = lt_fieldcat
          it_sort                = l_sort
          i_save                 = 'X'
        TABLES
          t_outtab               = itab
        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.
    and top of page as below
    FORM top-of-page.
    * Title
      w_header-typ  = 'H'.
      w_header-info = text-033.
      APPEND w_header TO t_header.
      CLEAR w_header.
    * Report Name
      w_header-typ  = 'S'.
      w_header-key = text-034.
      w_header-info =  sy-repid.
      APPEND w_header TO t_header.
      CLEAR w_header.
    * Date
      w_header-typ  = 'S'.
      w_header-key = text-035.
      CONCATENATE  sy-datum6(2) '.'+
                   sy-datum4(2) '.'+
                   sy-datum(4) INTO w_header-info.
      APPEND w_header TO t_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = t_header.
    ENDFORM.                    "top-of-page
    Its displaying well in output, but when I select excel download, the header is getting printed 4 times in the alv output and in the excel download it is printing twice. Please advise how to keep the header once. Note : I am not using any paging concept, simple header at the top.
    Please advise.
    Regards,
    Kiran.

    Hi kiran,
    While creating top-of-page,
    You have to refresh your header internal table before populating it with data i.e,
    FORM TOP.
    Refresh IT_HEADER                   -->with this the header text will not get repeatedly printed
    WA_HEADER-TYP = 'S'.
    WA_HEADER-KEY = TEXT-001.
    WA_HEADER-INFO = SY-REPID.
    APPEND WA_HEADER TO IT_HEADER.
    CLEAR WA_HEADER.
    WA_HEADER-TYP = 'S'.
    WA_HEADER-KEY = TEXT-002.
    WA_HEADER-INFO = SY-UNAME.
    APPEND WA_HEADER TO IT_HEADER.
    CLEAR WA_HEADER.
    WA_HEADER-TYP = 'S'.
    WA_HEADER-KEY = TEXT-003.
    WA_HEADER-INFO = SY-DATUM.
    APPEND WA_HEADER TO IT_HEADER.
    CLEAR WA_HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        it_list_commentary       = IT_HEADER
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.
    Hope it helps you
    Regards
    Mansi

  • How to add excel download button to ALV grid toolbar?

    Hi,
        Im generating ALV output through the method "SET_TABLE_FOR_FIRST_DISPLAY".But in the output,I cant see a direct excel download button,just like how it used to come when we use FM "REUSE_ALV_GRID_DISPLAY". Here, the excel download option comes as part of a drop down on top.But is there any way that I can have a separate excel download button which will be more user friendly for the customer?
    Thanks,
    Mahesh

    Create your own GUI status and add a push button there. In PAI write code for Excel download for that button.
    Regards,
    Amit

  • Excel Download in WAD

    Dear Guys,
    I have one issue in WAD.
    I have one report having Revinue and Expenditure. These are the two reports.
    In WAD, i am showing these two tables in one template.
    Everything is coming fine. When i am trying to download to excel, only first report is downloading. The second is not downloading.
    I want to download both reports in a single shot.
    I am using text element in WAD for downloading to Excel. My WAD code is,
    <td class="SAPBEXNavLine">
    <A  href="<SAP_BW_URL CMD='EXPORT' FORMAT='XLS' DATA_PROVIDER='DP'>">
    <IMG alt="<SAP_BW_TEXT program="SAPLRRSV" key="T77">
    <SAP_BW_TEXT program="SAPLRRSV" key="T72">" src="Mime/BEx/Icons/S_X_XLS.gif" border=0 >
    </A>
    </td>
    Please provide some inputs.
    Regards,
    Vivek.V

    Vivek,
    The Excel download is dataprovider specific and not template specific .. you would not be able to download both of them usung WAD..
    Options :
    1. Web Enabled workbooks
    2. Use BSP to render the query ad use the excel download functionality - extremely complex and cumbersome
    Hope it helps..
    Arun
    Assign points if helpful

  • Optimize Excel Download

    i have this program to optimize.
    months before, it was just a simple program that displays report through a couploe of WRITE statements.
    later, somebody was given a task to download the output into an excel file.
    it was done BUT, it runs toooooooooooo slow now.
    for 20 employees, the program runs for more than 22 minutes.
    i was now assigned to optimize the program.
    now it runs 5 minutes for 20 employees processed.
    i am not satisfied.
    not at all.
    coz in production, thousands of employees may sometimes be processed.
    what advise can you guys give me on these kind of matters: excel downloads.
    the only thing i did right now is not rewrite the program but i just added "NO FLUSH" in some of the OLE calls.  then i called the function "FLUSH" at the end. 22 minutes down to 5 minutes (on 20 pernrs) is a big improvement but that is just not acceptable, still.
    any advise would be appreciated. tnx.

    hi subas bose,
    i didn't quite get what you mean.
    could you rephrase your words?
    if i don't use ole, how do i do the excel download?
    tnx,
    laure

  • Preceeding zeroes while excel upload and download

    Hi,
    I am uploading some data from excel into an internal table,processing it and then downloading it again in excel.
    For Excel Upload I am using CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    For Excel Download I am using GUI_DOWNLOAD.
    But the problems is when the data is like 01 it is downloading it as 1 in the excel.The user don't want to do any changes after downloading it to the excel and want the data 01 to be dowloaded as 01 itself and not as 1.
    We can format it in excel but the user is not willing for that.Any possibility that we can handle it in the program.
    Thanks,
    K.Kiran.

    You have to use OLE technique for the same....that will solve your case.
    supposae i want to make the 5th , 6th and 7th coloumn , as character format.
    The below scenario will help.
    collect the contents of the excel in  it[] ,
      DESCRIBE TABLE it[] LINES wf_it_line.
      wf_it_line = wf_it_line + 8.
      CLEAR : wf_cellx, wf_celly, wf_cellr.
      CALL METHOD OF wf_excel 'Cells' = wf_cellx
      EXPORTING
       #1 = 8
       #2 = 5.
      CALL METHOD OF wf_excel 'Cells' = wf_celly
      EXPORTING
       #1 = wf_it_line
       #2 = 7.
      CALL METHOD OF wf_excel 'Range' = wf_cellr
       EXPORTING
    #1 = wf_cellx
    #2 = wf_celly.
      SET PROPERTY OF wf_cellr 'NumberFormat' = '@' .
    this will change the format of the excel.
    then call the below method
      CALL METHOD cl_gui_frontend_services=>clipboard_export
          IMPORTING
            data                 = it[]
          CHANGING
            rc                   = l_rc
          EXCEPTIONS
            cntl_error           = 1
            error_no_gui         = 2
         not_supported_by_gui = 3
            OTHERS               = 4.
      CALL METHOD OF wf_excel 'Cells' = wf_cell1
        EXPORTING
         #1 = 1
         #2 = 1.
      CALL METHOD OF wf_excel 'Cells' = wf_cell2
        EXPORTING
         #1 = 1
         #2 = 1.
      CALL METHOD OF wf_excel 'Range' = wf_range
        EXPORTING
         #1 = wf_cell1
         #2 = wf_cell2.
      CALL METHOD OF wf_range 'Select'.
      CALL METHOD OF wf_worksheet 'Paste'.
    then call the method 'SAVEAS' to save the excel.
    Edited by: Rudra Prasanna Mohapatra on Jan 22, 2009 5:47 AM

  • Need leading Zeros in the excel sheet which is sent from ABAP

    Hi ,
    I am downloading data from SAP to excel sheet using the WS_DOWNLOAD Function Module. The numeric data in not having leading zeros.  if it is 0010 it is displaying 10 in the excel sheet . i need the leading zeros in the excel sheet. without manulally changing it to Text in the excel sheet .
       Is there any way to do it .
    Thanks,
    Chetan

    Hi Chetan,
      CALL FUNCTION 'WS_DOWNLOAD'
        EXPORTING
          filename                = w_file_path
          filetype                = 'DBF'                       "declare the File type as DBF then leading zeros will appear
          write_field_separator   = 'X'
          confirm_overwrite       = 'X'
        TABLES
          data_tab                = Itab.
    Regards,
    Prabhudas

  • Leading zeros are not displaying in the excel

    Hi Experts,
    Leading zeros are not displaying in the excel
    Here is the situation:
    I have developed one report, which will create the file in Application server with TAB deleimeted. After that I am sending that file via email in the excel format using Email functionality FM.
    Normally our material numbers will start with zeros.
    But when I check the email excel file , leading zeros are not displaying.
    Even I checked the application server (AL11) file, zeros are there.
    I thought program FM was wrong and I tried it manually by downloading the file into excel. Eventhough it is suppressing zeros.
    Could you please advise, how to display leading zeros to the material number in excel file.
    Thanks in advance
    Raghu

    Application server file showing  zeros infront of the material number.
    1200#  0012401387# XXXXXXXX
    Once file created in app server, I am using one custom FM to send that output in excel format / txt format via email.
    when I send txt file via email, I am getting leading zeros. But when I send xls file via email, I am not getting zeros.
    I checked custom FUNCTION MODULE . No mistakes in that.
    ===
    Sudhir,
    As you said, I passed ( ' ) single quote infront of the material number. When I check the excel file, single quote also displaying like this '0000100.
    Application server file showing like below
    1200#  '0012401387# XXXXXXXX
    ===
    Could you please advise anyone how can we acheive this.
    Thanks

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

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

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

  • ORA-06502: PL/SQL: at the end of an Excel Download report

    Hi,
    Within my apex application I have the possibility to download a file from ie. page 7 (which is linked to a query in page 8). When I open the downloaded file, I find an error at the end of the sheet:
    <pre>report error:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error</pre>
    The thing is, the query that retrieves this report works perfectly, and when put in sql developer, it retrieves the same number of rows.
    So it must be that after the query has finished with all the rows, in encounters some kind of character ie. a space , that can´t convert to number and thus gives the error.
    Something worth noting is that, when I actually execute the page directly (page 8), that executes de query, it doesn´t give me the error on the excel.
    Any recommendations on a possible reason are welcome.
    Thank you,
    Javier

    I am also hitting this problem. Any pointer plz..

Maybe you are looking for