REUSE_ALV_GRID_DISPLAY - Save as Excel - Default Extension Issue

Hi Team,
Greetings for the Day !!
I have an issue with saving ALV Grid Output file as XLS. As I click the "Save Local File" Icon and select the Radio button for "Spreadsheet", in the next pop up for file path and file name, the extension ".txt" comes as default in the file name field. Here the expectation is that the default file extension should be ".xls" rather than ".txt". Your inputs are awaited..
Thank you so much..
Best Regards,
Naga Chaitanya

Hello Chaitanya,
Try to download excel with OLE below is for reference
TYPES: ty_line(5000) TYPE c.
  DATA: date TYPE sy-datum.
***************&OLE objects for Excel Output&* 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_f     TYPE ole2_object,        " font
        column  TYPE ole2_object,        " Column
        sheet   TYPE ole2_object,
        row     TYPE ole2_object    .",
  CONSTANTS wl_c09(2) TYPE n VALUE 09.
  FIELD-SYMBOLS : <f1>,
                  <f2>.
  DATA :w_rc           TYPE i,
        w_hex          TYPE x,
        column2        TYPE ole2_object,
        column3        TYPE ole2_object,
        column4        TYPE ole2_object,
        w_deli(1)  TYPE c,
        var1 TYPE fieldname, "Delimiter
        lv_qty1(30)    TYPE c,
        lv_qty2(30)    TYPE c,
        lv_qty3(30)    TYPE c.
  DATA: it_tab1 TYPE TABLE OF ty_line, " Contains records for first sheet
        wa_tab TYPE ty_line.
* start Excel
  CREATE OBJECT h_excel 'EXCEL.APPLICATION'.
  PERFORM err_hdl.
  SET PROPERTY OF h_excel  'Visible' = 1.
  PERFORM err_hdl.
  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.
  CALL METHOD OF h_excel 'Worksheets' = sheet
    EXPORTING #1 = 1.
  CALL METHOD OF sheet 'Activate'.       "Activate the sheet.
  SET PROPERTY OF sheet 'Name' = 'Sheet1'.
  PERFORM err_hdl.
  ASSIGN w_deli TO <f1> TYPE 'X'.
  w_hex = wl_c09.
  <f1> = w_hex.
**************************&For Column Header&*************************
  CLEAR wa_tab.
*  CLEAR:   wa_field .
  LOOP AT it_fieldcatalog INTO  wa_fieldcatalog.
    IF sy-tabix = 1.
      wa_tab = wa_fieldcatalog-coltext.
    ELSE.
      CONCATENATE  wa_tab wa_fieldcatalog-coltext INTO wa_tab SEPARATED BY w_deli.
    ENDIF.
  ENDLOOP.
  APPEND wa_tab TO it_tab1.
  CLEAR: wa_tab.
   LOOP AT it_output INTO  GS_output.   "Loop through the Output Data.
*  Move Quantity fields to lv variable for Concatenate.
    CLEAR: lv_qty1, lv_qty2, lv_qty3.
    CLEAR: wa_field.
    LOOP AT it_fieldcatalog INTO wa_fieldcatalog.
      CONCATENATE 'gs_output-' wa_fieldcatalog-fieldname INTO var1.
      ASSIGN (var1) TO <f2>.
*      IF wa_field-fieldname = 'POSID' OR
      IF wa_fieldcatalog-fieldname = 'ANLN1' OR   " posid
        wa_fieldcatalog-fieldname  = 'TXT50' OR
        wa_fieldcatalog-fieldname  = 'ANBTR' OR
        wa_fieldcatalog-fieldname  = 'ANBTR1' OR
        wa_fieldcatalog-fieldname  = 'ANBTR2' OR
        wa_fieldcatalog-fieldname  = 'LOG'    OR
        wa_fieldcatalog-fieldname  = 'STATUS'.
        WRITE: <f2> TO lv_qty1.
        IF sy-tabix = 1.
          wa_tab = lv_qty1.
        ELSE.
          CONCATENATE wa_tab lv_qty1 INTO wa_tab SEPARATED BY w_deli.
        ENDIF.
      ELSE.
        IF sy-tabix = 1.
          wa_tab = <f2>.
        ELSE.
          CONCATENATE wa_tab <f2> INTO wa_tab SEPARATED BY w_deli.
        ENDIF.
      ENDIF.
    ENDLOOP.
    APPEND wa_tab TO it_tab1.
    CLEAR: wa_tab.
  ENDLOOP.
  CALL METHOD OF h_excel 'Columns' = column2     "Formatting for quantity
   EXPORTING
   #1 = 8.
  SET PROPERTY OF column2 'HorizontalAlignment' = '4'.
  CALL METHOD OF h_excel 'Columns' = column3    "Formatting for quantity
     EXPORTING
     #1 = 8.
  SET PROPERTY OF column3 'HorizontalAlignment' = '4'.
  CALL METHOD OF h_excel 'Columns' = column4      "Formatting for quantity
   EXPORTING
   #1 = 8.
  SET PROPERTY OF column4 'HorizontalAlignment' = '4'.
   CALL METHOD cl_gui_frontend_services=>clipboard_export
    IMPORTING
      data                 = it_tab1[]
    CHANGING
      rc                   = w_rc
    EXCEPTIONS
      cntl_error           = 1
      error_no_gui         = 2
      not_supported_by_gui = 3
      OTHERS               = 4.
* Paste the contents in the clipboard to the worksheet
  CALL METHOD OF sheet 'Paste'.
  CALL METHOD OF sheet 'Activate'.
* Autofit the columns according to the contents
  CALL METHOD OF h_excel 'Columns' = column.
  CALL METHOD OF column 'AutoFit'.
  GET PROPERTY OF column 'FONT'    = h_f .
*   GET PROPERTY OF column 'FONT'    = h_f .
  SET PROPERTY OF h_f    'Name'    = 'Calibri'.    "'Courier New'."Calibrig
  SET PROPERTY OF h_f    'Size'    = 11.
*   SET PROPERTY OF h_f   'Alignment'  = '2'.
* disconnect from Excel
  FREE OBJECT : h_excel, column, sheet.
endform.                    " DISPLAY_EXCEL
*&      Form  ERR_HDL
*       text
*  -->  p1        text
*  <--  p2        text
form ERR_HDL .
*  *  *  FORM err_hdl .
  IF sy-subrc <> 0.
    WRITE: / 'Error using OLE Automation:', sy-subrc.
    STOP.
  ENDIF.
endform.                    " ERR_HDL
Thanks
Sam

Similar Messages

  • Uploading files Mime Type not correct for Office 2007 default extensions.

    hi all,
    My company has recently moved over to MS Office 2007 and the default extensions for word, excel etc are now .docx, xlsx etc (ie xml based).
    Unfortunately now when we upload files through APEX to the database the MIME TYPE value for these files isn't being recognised and not loadeding correctly into the APEX_APPLICATION_FILES table and subsequently any future retrieval of these files fails.
    I could put some logic inthe up load procedure to look at the filename in APEX_APPLICATION_FILES and hard code in the releavnt mime types but this still causes problems when retrieving the content.
    Has anyone come across this and got a workround? Is it a bug in AE?
    regards
    James
    FYI - using APEX 3.0.2 over 11G.

    I have not any response to my question and not sure if it is in Apex I need to look or the tomcat server that I need to look. I have a useful application to try to show others what Apex can do for our customers to collaborate. However, most of our customers are using office 2007 so, hoping this is possible.
    I am using apex 3.2.0.00.27 if that helps someone to point me where to find more info on being able to have Word 2007 or excel 2007 fire up to open a .docx or .xlss file stored in a table blob column. Word or Excel does fire up to open .doc and .xls files.
    The following is the query for a report selecting the filenames uploaded into a blob column in my table:
    { SELECT s.ID, SUBSTR(s.NAME,INSTR(s.NAME, '/',1,1)+1,length(s.NAME)) SHORT_FNAME, s.SUBJECT
    FROM spp_attachments s
    WHERE s.PROGRAM_ID = :P2_PROGRAMID }
    Below is the stored procedure called from the link on the short_fname column in report query above.
    { create or replace PROCEDURE  download_file(p_file IN number) AS
    v_mime VARCHAR2(48);
    v_length NUMBER;
    v_file_name VARCHAR2(2000);
    Lob_loc BLOB;
    BEGIN
    APEX_APPLICATION.G_FLOW_ID :=245;
    IF NOT (wwv_flow_custom_auth_std.is_session_valid) then
    owa_util.status_line(404, 'Page Not Found',true);
    return;
    else
    SELECT MIME_TYPE, BLOB_CONTENT, name,DBMS_LOB.GETLENGTH(blob_content)
    INTO v_mime,lob_loc,v_file_name,v_length
    FROM spp_attachments
    WHERE id = p_file;
    -- set up HTTP header
    -- use an NVL around the mime type and
    -- if it is a null set it to application/octect
    -- application/octect may launch a download window from windows
    owa_util.mime_header( nvl(v_mime,'application/octet'),
    FALSE );
    -- set the size so the browser knows how much to download
    htp.p('Content-length: ' || v_length);
    -- the filename will be used by the browser if the users does a save as
    htp.p('Content-Disposition: attachment;
    filename="'||replace(REPLACE(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),NULL),chr(13),NULL)|| '"');
    -- close the headers
    owa_util.http_header_close;
    -- download the BLOB
    wpg_docload.download_file( Lob_loc );
    end if;
    end download_file; }
    Thank you,
    Mark

  • Why does Apple say that Numbers can open and save Excel files, when in actuality, it can only open .XLSX files and only Export to Excel (not save-as excel)?

    When attempting to open .XLS files in Numbers, the format is not recognized. When the format is .XLSX, the format is recognized. Why is it this way? It's still much more common for folks to have the .XLS file format on their excel files. Why would Numbers not be backwards-compatible?
    Additionally, to state in the benefits of this program that one can save to 'Excel' is a little misleading. You can't save to anything except .numbers. Sure, you can export to Excel (with file extension .XLS, I might add), but you can't save or save-as.
    Does anyone else see the irony in being able to export to .XLS but not be able to open an .XLS?
    There is something to be said for clarity.
    You can't expect folks to have Numbers and Excel on their systems, so how else are they supposed to open .XLS files in Numbers?
    And I don't need to see another advertisement for NeoOffice or OpenOffice here, thanks. I'd actually like Numbers to be a little more sensible.
    That is all.

    When the advertisements were written, there was no Lion so we were able to Save As Excel.
    At thiqs time there is no longer Save As command under Lion but the feature is always available.
    When your editing task is ended, you are free to use this scheme:
    File > Duplicate
    File > Save and in the dialog you will have the option save as Excel.
    Numbers isn't and I hope that it will not become an Excel editor.
    Its resources contain a flag defining it this way.
    I posted several times a script editing this resource.
    This morning I'm not in a mood allowing me to do your duty.
    Search by yourself in existing threads with a keystring like
    viewer AND editor
    Yvan KOENIG (VALLAURIS, France) jeudi 27 octobre 2011 09:40:23
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • How to Load the data from excel file(Extension is .CSV) into the temp.table

    Hi
    How to Load the data from excel file(Extension is .CSV) into the temporary table of oracle in Forms11g.
    My Forms Version is - Forms [64 Bit] Version 11.1.2.0.0 (Production)
    Kindly Suggest the Solution.
    Regards,
    Sachin

    Hello Sachin,
    You can use the following metalink note:How to Read Data from an EXCEL Spreadsheet into a Form Using Webutil Client_OLE2 (Doc ID 813535.1) and modify it a little bit.
    Instead of copy values into forms you can save them in your temporary table.
    Kind regards,
    Alex
    If someone's helpful or correct please mark it accordingly.

  • Add a "save as excel" button in CDZ viewer

    I am currently using BOE XI R2.  By default, under "Document", there is a function that allows me to Save the opened webi report into excel and pdf and other formats. 
    I am just wondering if it's possible to move that save-as-excel functionality out and put that as a one click button on the cdz viewer panel. 
    http://web9.twitpic.com/img/40877829-22a0760e65d8a7323a5ac918518515a0.4af27af7-scaled.jpg
    the save-as function as circled in red. and I would like to add that function into the main menu bar, as outlined with the orange box.
    thank you very much in advance!
    Lawrence

    The provided link displays a blank page. See if you can provide a new link. Also, see if you get an answer in the [Business Objects Enterprise Administration|BI Platform; forum.
    Ludek

  • How to save an excel file as CSV with semi-colon as data separator?

    We are creating a flat data file to load the flat file data to our BW system with Excel.  When we save the file, there are three kinds of CSV types for selecting from the "Save as type" list box:
    CSV (Comma delimited)
    CSV (Macintosh)
    CSV (MS-DOS)
    There is no CSV (semi colon delimited) type.  If we pick CSV (Comma delimted) as the type, then when clicking the "Preview ..." picture icon under the "DataSource/Trans. Structure" tab of the InfoSource for this flat file (with the CSV radio button checked the Data separator default is ";"), the File Upload Preview window shows the data is messed up that some columns of the excel flat file are combined into one column.
    Since the save type we picked is "CSV (Comma delimited)", then we try to change the default Data separator from ";" to "," in the preview selection screen, but still not helpful!
    How to resolve the above problem?
    Thanks

    Hi Kevin,
    This "," is defined in your windows setting. If you want to have ";" as separator then go to control Panel, select Regional Options, go to Numbers Tab and define the List separator as ";". After that when you will save your excel file as CSV(MS-DOS) it will have ";" as separator. This will make sure that the amounts are not broken in to two different fields while loading.
    Else if you keep "," as separator then you can also go into the Excel and define all number fields as Number without thousand separator.
    Let me know if you have any doubts in this.
    Regards,
    Rohit

  • Excel Rendering Extension: Unknown Image Format Imag/GIF - SSRS Excel Export

    We are using the SSRS 2012 [ExportOpenXML].
    When a report is export to excel, getting the message Unknow Image Format IMage/GIF.
    Please suggest a fix the above issue.
    As per article Excel Rendering extension: Unknow Image Format image/x-png suggestion verified in Visual studio selected the gif file in the Solution Explorer panel, checked the Properties
    the MIME Type which is already set as image/gif.
    Note: Dev environment its working as expected and but issue is observed in QA environment. I wonder some setting is missing on QA enviornment which I'm unable to get the difference exactly.
    Quick help would be higly appreciated.

    Hi Niranjan,
    Based on the current description, I understand that there should be no issue when exporting the report containing image which is Image/Gif type in Dev environment because you have changed the MIME type to Image/Gif.
    To narrow down the scope to find the cause, I want to confirm some information below:
    1. Check Reporting Services edition in QA environment, if the Reporting Services edition is same between QA and Dev environment, you can back up the .rdl file and copy the .rdl file to QA environment and then export the report in Excel format to check
    whether the issue persists.
    2. If you export the report to other format such as PDF rather than Excel format in QA environment, please confirm whether the issue persists.
    3. If you change the MIME type to Image/Png and then export the report to Excel in Dev and QA environment, please confirm whether the issue persists.
    Supposing there is error message, please post the details to the forum for further analysis.
    Reference:
    How do you check what version of SQL Server for a database using TSQL?
    Regards,
    Heidi Duan
    Heidi Duan
    TechNet Community Support

  • Default extension in FileReference.download

    As part of my Flex application users can save their work to a text file on their local machine.  They can then later load these files.
    Both loading and saving use a FileReference object, and bounce the files off the server as needed.
    It all works pretty well, but the problem is that if the user decides to overwrite the filename there is the very real possibility that they will forget to add the extension.
    For example, the default name comes up as "untitled 1.txt", and they just type "myfile".
    The result is that when they then go to load the file it does not appear - because I am filtering for just ".txt" files.
    It's pretty normal in a Windows application to automatically append a default extension, but I can see no equivalent in Flex.
    Is this something that can be done?
    If not are there any good workarounds?
    Thanks

    It's disappointing that it doesn't have the option to add an extension.  I can possibly understand if it disallowed ".exe" as a default, but apart from that I can see no good reason for this omission.
    In the end I just added a SELECT listener, where I check the saved name, and if the extension is missing I warn the user that they should go and rename the file.
    It's a bit clumsy in my opinion, but because the SELECT event comes AFTER the file has been saved, there's no way to cancel the download, so a warning seems like the best that can be done.

  • No column heading in second page in alv report when save in excel file

    Hi Expert,
    How can i remove the column header from Alv report when program execute in background and save in excel file right now
    its comming column header in each page. Client dont want header column in excel from second page. is this possible?
    with regards
    chandan_viji

    Hi Ravi,
    thanks for reply i have solved this problm throug line count and NEW-PAGE LINE COUNT 10000 bcoz client want output in excel file only one page header.
    with regards
    chandan_viji

  • Cannot save the excel report in my application

    Hi I wrote a program which can save the data to an Excel report. It runs perfectly on my own computer. After I built the application (exe file), and run it in another computer, which can not save the excel report. On my own computer, it has LabVIEW 2011 and report generation toolkit for Microsoftoffice; and on the other computer, I installed the LabVIEW runtime engine. Did I miss installing some other support software? Can anyone tell me why this is not working?
    Thanks a lot,
    Jane

    Do you have Excel installed on the other computer?
    I also suggest that you read this page : Including Report Generation VIs in Stand-Alone Applications (Report Generation Toolkit)
    Hope this helps
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"

  • Save for Web default folder in PSE 11

    On my Windows 7 system, in PSE 8 when I select Save for Web, it defaults to saving the image in a folder I chose that is separate from the one I used in Open.
    (Save and Save As default to the folder I opened the image from, and PSE 11 works the same way even though "Save As to Original Folder" is not checked in Edit | Preferences).
    But "Save for Web" also always defaults to the folder the image was opened from, even though I have started it in Admiinistrator mode and changed the destination.
    That worked to change the default file type from GIF to JPEG, but had no effect on the save-for-web default destination.
    Is there a way to set/change the save-for-web default folder in PSE 11?

    That makes sense, but it doesn't work for me in PSE11 (though PSE 8 is OK). I get the same result as yesterday, even after rebooting, which I hoped might clear any cached settings. With or without checking Save As to Original Folder, what happens is this:
    - Save to Web defaults to saving the image file in the source folder;
    - if I change the destination to my Web-images folder, that lasts until I close PSE 11, and not beyond;
    - when I start it up again, Save For Web defaults to the source folder (with or without Save As to Original Folder, and regardless of Run As Administrator.
    Looking at the folder   C:\Program Files (x86)\Adobe\Photoshop Elements 11
    I see that no files show a change in the last several days, so the setting must be elsewhere, in the registry or in C:\Users\... somewhere.  Hmmm..

  • Save as Excel - Chart become picture in BO4

    in BO XI 3.1, if we save  as excel,
    the chart is still a Excel Chart in Excel file
    But in BO 4, if we save as excel
    the chart in Webi will become Picture in Excel file
    if is a bugs or SAP removed this feature in BO4?
    Thanks.
    John Kong

    Hi,
    If you wish to change this functionality, you could log your request at http://www.ideas.sap.com. It is an open forum where other users can see your request and can vote for it.
    Regards,
    Nakul Mehta

  • Why can't I save camera raw defaults?

    I am currently unable to reset my camera raw defaults in CS5 (Camera raw 6.5).  When I click on "Save Camera Raw Defaults", the changes do not show up when I open up a new image using Adobe Bridge. I seem to be stuck with the changes I made some time ago. What could be happening?

    Camera Raw uses the same settings you used last time to open a file.  That's just the way it works.  The defaults you set will be used on any image you haven't opened before.
    In order to revert an image that's been opened before to the new defaults, you need to do one of the following:
    1.  Choose Camera Raw Defaults from the menu:
    2.  Depending on how you have configured Camera Raw to remember your past settings, either delete the sidecar XMP files or go into Edit - Preferences - Camera Raw... and purge your Camera Raw cache if you'd like to throw away all previous settings and have future opens use your new defaults.
    -Noel

  • Unable to save in excel format

    Hi Experts,
    My client is using  Windows 7 Enterprise (32 bit) and MS Office 2010 (32 bit) and SAP ECC 6. The problem is when we click on expert mode we were not able to save in excel format. The report is coming blank. Is there any settings to be changed in excel.
    Thanks in advance
    Narayanan

    Hi.
    1. Before install 10 office, uninstall previous version.
    2. Reinstall SAP(uninstall it befor)
    3.'enable all macros in Excel
    4. Trust access to Visual Basic Project
    Save, Close Excel and run SAP...
    SAP will support 2010 office from 7.20 version

  • Save an excel file by OLE2 object

    Hi everybody,
    I wanna save an excel file generated bye ole2 objects just same as the SaveAs dialog prompt. But SaveAs prompt is not working....

    Hi,
    Before calling 'SaveAs', free all the reserved OLE objects.
    Now Save excel spreadsheet to particular filename and quit the excel application. 
    CALL METHOD OF sheet 'SaveAs'              
       EXPORTING
           #1 = 'c:\your_excel.xls'     "name of excel                                 
           #2 = 1.                                   "file format              
    Regards,
    Rajesh

Maybe you are looking for