Corrupted / overwritten XLS file

Hi  Friends,
                I am looking for a solution where in i am using 'GUI_DOWNLOAD' to download data into xls format , its working but when i am looking at the xls output  i am getting corrupted data , in short if u go to Transaction SE37 and test with Function Module by  passing
1000194015000102 as input for TABLES  (data_tab) and u get (corrupted )output  1000194015000100 - check the downloaded xls file  only.
check the last digit its '0' not '2'
can any one please help me in getting it solved .

Dear Srikanth,
I'm providing you with the following piece of code ... Its working fine for me ... hopefully it suits your requirement ...
D A T A D E C L A R A T I O N *
TYPES: BEGIN OF TY_EXCEL,
CELL_01(80) TYPE C,
CELL_02(80) TYPE C,
CELL_03(80) TYPE C,
CELL_04(80) TYPE C,
CELL_05(80) TYPE C,
CELL_06(80) TYPE C,
CELL_07(80) TYPE C,
CELL_08(80) TYPE C,
CELL_09(80) TYPE C,
CELL_10(80) TYPE C,
END OF TY_EXCEL.
DATA: IT_EXCEL TYPE STANDARD TABLE OF TY_EXCEL,
WA_EXCEL TYPE TY_EXCEL..
E V E N T : S T A R T - O F - S E L E C T I O N *
START-OF-SELECTION.
Here you populate the Internal Table.
Display - Top of the Page.
PERFORM DISPLAY_TOP_OF_PAGE.
E V E N T : E N D - O F - S E L E C T I O N *
END-OF-SELECTION.
SET PF-STATUS 'GUI_STATUS'.
E V E N T : A T U S E R - C O M M AN D *
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'EXPORT'.
Exporting the report data to Excel.
PERFORM EXPORT_TO_EXCEL.
ENDCASE.
*& Form DISPLAY_TOP_OF_PAGE
text
--> p1 text
<-- p2 text
FORM DISPLAY_TOP_OF_PAGE .
SKIP.
WRITE: /05(128) SY-ULINE,
/05 SY-VLINE,
06(127) 'O R I C A'
CENTERED COLOR 1,
132 SY-VLINE.
WRITE: /05(128) SY-ULINE,
/05 SY-VLINE,
06(127) 'Shift Asset Depreciation - Period/Year-wise Report.'
CENTERED COLOR 4 INTENSIFIED OFF,
132 SY-VLINE.
WRITE: /05(128) SY-ULINE.
E X C E L O P E R A T I O N
CLEAR: IT_EXCEL[],
WA_EXCEL.
PERFORM APPEND_BLANK_LINE USING 1.
WA_EXCEL-cell_02 = ' XYZ Ltd. '.
APPEND WA_EXCEL TO IT_EXCEL.
CLEAR: WA_EXCEL.
WA_EXCEL-cell_02 = 'Shift Asset Depreciation - Period/Year-wise Report.'.
APPEND WA_EXCEL TO IT_EXCEL.
PERFORM APPEND_BLANK_LINE USING 1.
ENDFORM. " DISPLAY_TOP_OF_PAGE
*& Form APPEND_BLANK_LINE
text
-->P_1 text
FORM APPEND_BLANK_LINE USING P_LINE TYPE I.
DO P_LINE TIMES.
CLEAR: WA_EXCEL.
APPEND WA_EXCEL TO IT_EXCEL.
enddo.
ENDFORM.
*& Form EXPORT_TO_EXCEL
text
--> p1 text
<-- p2 text
FORM EXPORT_TO_EXCEL .
DATA: L_FILE_NAME(60) TYPE C.
Create a file name
CONCATENATE 'C:\' 'Shift_Depn_' SY-DATUM6(2) '.' SY-DATUM4(2)
'.' SY-DATUM+0(4) INTO L_FILE_NAME.
Pass the internal table (it_excel which is already populated )
to the function module for excel download.
CALL FUNCTION 'WS_EXCEL'
exporting
filename = L_FILE_NAME
tables
data = IT_EXCEL
exceptions
unknown_error = 1
others = 2.
if sy-subrc <> 0.
message e001(ymm) with 'Error in exporting to Excel.'.
endif.
ENDFORM. " EXPORT_TO_EXCEL
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When you click the button - Export to Excel ( GUI-Status) you'll be able to export the content of the Internal Table to an Excel file .......
Regards,
Abir
Please don't forget to award points *

Similar Messages

  • How do I copy my old xl files from my XP machine to operate on xl for Mac on my new iMac.  When I copy them onto a stick and transfer them it automatically makes them xls files which are then corrupted when I try to open them in xl for mac

    How do I copy my old xl files from my XP machine to operate on xl for Mac on my new iMac.  When I copy them onto a stick and transfer them it automatically makes them xls files which are then corrupted when I try to open them in xl for mac

    Sorry, yes this is Microsoft Excel.  The Microsoft XP has Excel files denoted as xl, the later versions of Microsoft Excel are denoted as xls files.  The later verions of Microsoft Excel open the xl files OK, does Excel for Mac not able to do this?

  • How to repair corrupt MS Excel 2003 (XLS) File?

    I have important MS Excel file data and unfortunately got corrupt due to virus attacks, so my crucial Excel sheet got lost, how to repair corrupt MS Excel 2003 (XLS) File? If have any solution please assist me.

    A corrupt excel spreadsheet can be repaired by using Open and Repair technique. It is a built-in repair function that opens a corrupt excel file forcefully. 
    *Open MS Excel > press Ctrl+O > locate corrupt excel spreadsheet and select it. 
    *Click on the arrow shown beside Open button > select Open and Repair. 
    It will take just a few seconds to be completed and selected file will be opened, if possible. 
    Or if this doesn't work, one may take help of a third-party Excel Recovery software. I would recommend
    Excel Repair Kit software to recover data from corrupt excel spreadsheet. The software is available with free demo version. To read more about this software and to download its free demo version, visit: http://www.excel.repair/

  • APEX 4.0: error while opening a XLS file downloaded from interactive report

    Hi,
    I'm getting below error while opening a XLS file downloaded from an interactive report (APEX 4.0).
    "The file you trying to open, 'customer_2.xls', is in a different format than specified by the file extension.
    Verify that the is not corrupted and is from a trusted source before opening file. Do you want to open file."
    Yes No Help
    May be this one Apex 4.0 issue.
    please help me.
    Thanks
    Mukesh

    Hi,
    is the next part of the code correct.
    What i mean is packing of the attachment, finding out the size of pdf file and doc type as PDF.
    You can also try below link..
    Link: [http://wiki.sdn.sap.com/wiki/display/Snippets/SENDALVGRIDASPDFATTACHMENTTOSAPINBOXUSINGCLASSES]
    Hope this helps.
    Regards,
    -Sandeep

  • Can't open .xls files created by Numbers

    All of a sudden, using Numbers '09 I can no longer open certain .xls files that I created in the first place by saving .numbers files as Excel files (using the "Save copy as Excel Document" checkbox in the Save As... dialog box). Some will open, but the vast majority attempt to open, and then I get an "Import Error - An unknown error occurred." message. Backed up copies of the same files produce the same result. New .numbers files I save as Excel documents can't open either.
    Background: Earlier tonight while saving a .numbers file as an Excel Document, the blue "progress" bar got about halfway and then just hung there. Having not rebooted the computer for a couple of weeks, and lots of apps open, I proceeded to shut down other processes and eventually the blue progress bar finished and an Excel file was saved. However, after rebooting the computer, the above inability to open Excel files started to occur. Something in the "save as" process must have corrupted?
    I quit Numbers, deleted the com.apple.iwork.numbers.plist file from Library/preferences, emptied trash, and restarted Numbers -- but that didn't solve the problem.
    What would you all suggest now at this point? Would reinstalling Numbers solve this? (hmmn, where is that disc?) I'm personally fine with the .numbers format, but my clients are not, hence the need to save as Excel documents. Any help would be appreciated!

    ack, this whole thing is frustrating. I can create new .numbers documents, save them as Excel documents, and those resulting .xls documents will open fine. HOWEVER, if I grab an old .xls document from a time machine backup (over a month ago), I cannot open it. Nor can I open an newly saved .xls document saved from the same original .numbers file.
    It would seem that the only thing I can do now is take those old .numbers files and copy/paste the content into a brand new .numbers file. After saving as, the resulting .xls files open fine (with the usual "import warnings", but I'm used to those )

  • Problem opening a "xls" file

    Good day
    I'm having a difficulty opening a .xls file using a Ms Exel 2003.
    It prompt a box saying:
    The file you are trying to open, 'AA.xls' is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source
    before opening the file. Do you wan to open the file now?
    If i click Yes. Another pop up will show:
    The information you were working on might be lost. Ms. Office excel can try to recover it for you and i checked on the " recover my work and restart Ms.office excel"
    A blank Ms.Excel will be shown.
    The size of the file shown on the icon are still there but nothing contain in it.
    Pls. help.

    Hi,
    According to this error, this .xls file may be damaged. The following steps might help recover your file:
    1. Click the File menu
    2. Click Open
    3. Locate the file, but do not click the Open button.  Instead, click the drop-down arrow next to the Open button.
    4. Click "Open and Repair"
    5. In the dialog that pops up, choose "Repair".  If that does not work, try the "Extract Data".
    6. Let us know if this works.  If not, we will see what else we can come up with for you.
    Regards,
    Greta Ge
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Eror downloading a XLS file on the portal hosted struts/j2EE application

    guys,
    1st of all please bare with for writing such a huge mail but to explain the scenario i had to do this.
    i am trying to download a XLS file from the web application (struts/J2EE) hosted on the portlet.
    on my portlet i have few text boxes and a button.
    onlcik of the buton there are few validation javascripts and if the valdatin is thrugh then the form is submitted.
    there are 2 ways i can submit the form to the struts action class.
    both approaches have some problem or the other.
    Apporach 1
    var postUrl = document.getElementById('getReportURL_$$PORTLET_ID$$').innerHTML;
    var post = new PTHTTPPOSTRequest(postUrl, form, handleInlinePostResponse_$$PORTLET_ID$$);
    post.invoke();
    this is like a AJAX request post where the response comes back in the function handleInlinePostResponse_$$PORTLET_ID$$ which can be then handled.
    Problems
    1. as from action class i am trying to send a XLS file, i am writing the byte stream of the XLS file on the output stream of the response. when the response reaches the function handleInlinePostResponse_$$PORTLET_ID$$ on portlet jsp it gives me an javascript exception 'End of file reached in invalid state for current encoding' but while sending the response i am encoding the byte stream.
    the code snippet from the action class is as below
    response.reset();
    response.resetBuffer();     
    response.setHeader("Content-disposition", "attachment; filename=" + reportData.getFilename());
    response.setCharacterEncoding("UTF-8");
    response.setContentType("application/vnd.ms-excel");
    response.getOutputStream().write(reportData.getContent()); //byte[] form of the XLS file
    return null; //as we write on the response out stream the response is already commited hence the return null has no significance.
    2. in case of the any exception on server side this approach is helpful as the error content jsp is rendered in to the portlet from where the action was fired.
    Approach 2
    form.action = "<pt:url xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/' pt:href='downloadCommercialXLSReport.do'/>" ;
    form.submit();
    This approach is normal for submitting any struts from bean to the struts action class (i know this is not a aprropriate way to submit d form through portlet as it submits whole page inclusding all the portlet data)
    Problems
    1. here in case of the sucess the XLS file is returned to the browser which openes a browser specific dialogue box having 'Save' 'Open' and 'Cancel' buttons to save/open the XLS file. (please note no javascript exception occurs here as approach one as the byte streeam content is returned to the browser directly and not to any post response handler function as handleInlinePostResponse_$$PORTLET_ID$$)
    2. But here the problem is in case of any sever side exception the error jsp is rendered on whole browser page and not in portlet which is kinda goofy.
    so now i am in a catch 22 scenario each approach has 1 problem either in success or in failure flow.
    can sombody suggest me a way out from this as i desperately need to download a XLS file.
    lemme kno if anybody has done a similar download stuf through portal server.
    regards,
    Sush

    i have done this before although it was in .net. try the first approach but first pop to a new window....the xls response has to be the only response to the browser or else the browser will take the other bytes returned as garbage and call the stream corrupt. let me know how this goes for you.
    if you still have problems i can post the code that worked for me. it is in c# but looks very similar.

  • How to repair xls file? Microsoft Excel report me what file is not Excel format.

    I need help again(( i have .xls file that cannot be opened by Excel. It reports that this file is not excel format. Can i recover it?

    When an Excel file is corrupted, then you can try several methods to recover it:
    1. First of all, you can try to repair the file manually in Excel, as follows:
    (1) On the File menu, click Open.
    (2) In the Open dialog box, select the file you want to open, and click the arrow next to the Open button.
    (3) Click Open and Repair, and then choose which method you want to use to recover your workbook.
    You may find more information about this at:
    http://office.microsoft.com/en-us/excel-help/repairing-corrupted-files-in-excel-HA001034656.aspx (for Excel 2003)
    http://office.microsoft.com/en-us/excel-help/repairing-a-corrupted-workbook-HA010097017.aspx?CTT=1 (for Excel 2007)
    http://office.microsoft.com/en-us/excel-help/repairing-a-corrupted-workbook-HA010342840.aspx?CTT=1 (for Excel 2010)
    http://office.microsoft.com/en-us/excel-help/repair-a-corrupted-workbook-HA102749554.aspx?CTT=1 (for Excel 2013)
    2. Second, since Excel 2003, it provides a "Document Recovery" mechanism so that when Excel is shutdown abnormally, the Excel file being edited will be recovered when Excel is launched next time, which makes the file recovery possible.
    See below:
    http://office.microsoft.com/en-us/excel-help/recover-your-office-files-HP010354299.aspx?CTT=1
    for more detailed information.
    3. If 1 and 2 does not work, then you may try third-party tools such as DataNumen Excel Repair at
    http://www.datanumen.com/excel-repair/
    It provides a free demo version so that you can try to see if the data you want can be recovered or not.
    Good luck!

  • How to repair xls file?

    How to repair xls file? Microsoft Excel report me what file is not Excel format.

    When an Excel file is corrupted, then you can try several methods to recover it:
    1. First of all, you can try to repair the file manually in Excel, as follows:
    (1) On the File menu, click Open.
    (2) In the Open dialog box, select the file you want to open, and click the arrow next to the Open button.
    (3) Click Open and Repair, and then choose which method you want to use to recover your workbook.
    You may find more information about this at:
    http://office.microsoft.com/en-us/excel-help/repairing-corrupted-files-in-excel-HA001034656.aspx (for Excel 2003)
    http://office.microsoft.com/en-us/excel-help/repairing-a-corrupted-workbook-HA010097017.aspx?CTT=1 (for Excel 2007)
    http://office.microsoft.com/en-us/excel-help/repairing-a-corrupted-workbook-HA010342840.aspx?CTT=1 (for Excel 2010)
    http://office.microsoft.com/en-us/excel-help/repair-a-corrupted-workbook-HA102749554.aspx?CTT=1 (for Excel 2013)
    2. Second, since Excel 2003, it provides a "Document Recovery" mechanism so that when Excel is shutdown abnormally, the Excel file being edited will be recovered when Excel is launched next time, which makes the file recovery possible.
    See below:
    http://office.microsoft.com/en-us/excel-help/recover-your-office-files-HP010354299.aspx?CTT=1
    for more detailed information.
    3. If 1 and 2 does not work, then you may try third-party tools such as DataNumen Excel Repair at
    http://www.datanumen.com/excel-repair/
    It provides a free demo version so that you can try to see if the data you want can be recovered or not.
    Good luck!

  • Message  during opening a generated xls-file.

    Hello together,
    do you have experience with the bursting off XLS Files with BI Publisher?
    We produce such files. But when we open the files we feceive the following messsage:
    The file you are trying to open, 'Filename.xls' is in a different format then specified by the file extension. Verify that the file is not corrupted and is from trusted source befort opening the file. Do you want to open the file now?
    The File works fine. But the customer of this file is worried about this message.
    Is it psossible to hide this message?
    Regards
    Stefan

    plz see
    The File You are Trying to Open, 'FNDWRR.exe' is in a Different Format Than Specified By The File Extension [ID 467256.1]
    E-BI/XMLP: Opening A BI/XML Publisher Output File Throws Error: "The file you are trying to open, is in a different format than specified by the file extension." [ID 1267445.1]

  • IPhone won't open old (pre 97) .xls files

    my iPhone works fine opening .xls files as long as they are not pre 1997 format. (get the password protected or corrupt file error). Any way I can fix this?

    Convert your old .xls files to ones that are supported by the phone.?!.
    Over ten years old, there has to be a cut off point.

  • I'm one of the few idiots in the world who use the "Pages" App. Whenever I open an XLS file. "Numbers" quits - siting use of SFCompatability plugin. Reports to Mac. Problem remains constant?

    I'm one of the few idiots in the world who use the "Pages" App. Whenever I open an XLS file. "Numbers" quits - siting use of SFCompatability plugin. Reports to Mac. Problem remains constant?

    When you get the SF Compatibility plug in message something in the installed iWork part is corrupt. You ned to uninstall and install iWork again
    You cannot completely delete iWork by moving the iWork '09 folder to the Trash. Instead, use Yvan Koenig's script:
              •          Go to http://www.box.com/s/00qnssoyeq2xvc22ra4k
              •          Choose public_YK > for_iWork'09 > other_iWork'09 items
              •          Click on uninstall iWork '09.zip, decompress it, open it in AppleScript Editor and click the Run button
    Restart the computer and install from the iWork disc. Do the Software updates too.

  • "Cannot interpret data in file" error while using GUI_UPLOAD for .xls file

    Hi,
         I have made a program using FM GUI_UPLOAD to upload an .xls file to an internal table. But upon executing ,it gives error "Cannot Interpret data in file". I have seen in other posts people talking about GUI_UPLOAD FM to upload data from excel directly into internal table. Kindly help.
    Here is my code. I had tried using different combination for HAS_FIELD_SEPARATOR but still its not working.
    In my emp1.xls file , the data in each column is present in the same order as in the internal table. Although the first column in my internal table is NUMC. I dont know if that is causing the problem.
    REPORT  ZUPLOAD_1.
    data: itab TYPE TABLE OF zempl_master WITH HEADER LINE.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = 'C:\empl1.xls'
        FILETYPE                      = 'ASC'
        HAS_FIELD_SEPARATOR           = 'X'
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   CHECK_BOM                     = ' '
    *   VIRUS_SCAN_PROFILE            =
    *   NO_AUTH_CHECK                 = ' '
    * IMPORTING
    *   FILELENGTH                    =
    *   HEADER                        =
      TABLES
        DATA_TAB                      = itab.
    * EXCEPTIONS
    *   FILE_OPEN_ERROR               = 1
    *   FILE_READ_ERROR               = 2
    *   NO_BATCH                      = 3
    *   GUI_REFUSE_FILETRANSFER       = 4
    *   INVALID_TYPE                  = 5
    *   NO_AUTHORITY                  = 6
    *   UNKNOWN_ERROR                 = 7
    *   BAD_DATA_FORMAT               = 8
    *   HEADER_NOT_ALLOWED            = 9
    *   SEPARATOR_NOT_ALLOWED         = 10
    *   HEADER_TOO_LONG               = 11
    *   UNKNOWN_DP_ERROR              = 12
    *   ACCESS_DENIED                 = 13
    *   DP_OUT_OF_MEMORY              = 14
    *   DISK_FULL                     = 15
    *   DP_TIMEOUT                    = 16
    *   OTHERS                        = 17
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP at itab.
      write:/ itab-emp_no,itab-name.
    endloop.

    hi amber22 you need to use the below fm to upload an xls file
    FORM EXCEL_UPLOAD .
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          FILENAME    = FILENAM
          I_BEGIN_COL = 1
          I_BEGIN_ROW = 1
          I_END_COL   = 6
          I_END_ROW   = 100
        TABLES
          INTERN      = xl_itab.
    * EXCEPTIONS
    * INCONSISTENT_PARAMETERS = 1
    * UPLOAD_OLE = 2
    * OTHERS = 3 .
      IF SY-SUBRC = 0.
    MESSAGE 'DATA UPLOADED SUCCESSFULLY' TYPE 'I'.
      ENDIF.
    ENDFORM.                    " EXCEL_UPLOAD

  • Payroll.xls file for Mid Year Go Live

    Hi All,
    I want to use the program the program HINUULK0 for uploading data into
    tables t558b and t558c. The SAP help documentation says that it provides a
    template payroll.xls for entering the data. I've not been able to spot this
    file yet.
    From where I can get the PAYROLL.XLS file?
    Please help.
    Thanks
    Atin

    Dear Atin,
    For table T558B use format :-
    Client
    Personnel Number
    Sequential number for payroll period
    Payroll type
    Payroll Identifier
    Pay date for payroll result
    Period Parameters
    Payroll Year
    Payroll Period
    Start date of payroll period (FOR period)
    End of payroll period (for-period)
    Reason for Off-Cycle Payroll
    Sequence Number
    For Table T558C use format :
    Client
    Personnel Number
    Sequence Number
    Country grouping
    Wage type
    Key date
    Rate
    Number
    Amount
    Hope this helps.
    Kindly reward if useful.
    Regards & Thanks,
    Darshan Mulmule

  • How to read .xls file from FTP server t oInternal table

    Hi
    am using the FTP_SERVER_TO_R3 to read xls file from FTP server to internal table
    but the data i get in LT_TEXT is special characters.
    CALL FUNCTION 'FTP_SERVER_TO_R3'
    EXPORTING
    handle = hdl
    fname = f_name "ProdDataFromCRM.xls.
    * CHARACTER_MODE = 'X'
    * IMPORTING
    * BLOB_LENGTH =
    TABLES
    BLOB = lt_text
    * TEXT = lt_text
    EXCEPTIONS
    TCPIP_ERROR = 1
    COMMAND_ERROR = 2
    DATA_ERROR = 3
    OTHERS = 4
    can any one help me out to get the exact data..
    Really appreciate your quick response..
    Thank You

    Hi, if you really retrieve an excel file, you can not see the data in ABAP. You may see them in Excel. For this you may use
    CALL METHOD document->open_document_from_table
    of the interface i_oi_document_proxy for OLE objects. You can access the data with reference to the interface i_oi_spreadsheet.
    Please check [Desktop Office Integration (BC-CI)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIOFFI/BCCIOFFI.pdf] for details.
    But, who knows, perhaps you want "And Now For Something Completely Different".
    Regards
    Clemens

Maybe you are looking for