Skip to Content
author's profile photo Former Member
Former Member

ws_excel, ending .xls instead of .txt

Hello,

I am using function module ws_excel in order to show an excel file which is working well. When saving this excel sheets EXCEL always suggests the ending .txt and the user has to change manually to .xls.

Who can I change this suggestion to .xls?

regards

stefan

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 09:15 AM

    Hi Stefan,

    WS_EXCEL basically calls WS_DOWNLOAD to download the internal table as a file then calls the Excel application to open the data( using WS_EXECUTE). Normally the file is going to be of type DAT and its a Tab delimited file. As s result Excel application will try to save it as tab delimited file - resulting selection of .TXT extension of the same.

    You can

    - manually do a Save As on the Excel - something that u r already doing.

    - or you can go for FM - ALV_XXL_CALL.

    - Use OLE methods to take care of it.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 12:23 AM

    Hi

    It's better to handle programatically.

    In the file name itself add .XLS to your file name.

    call function 'WS_EXCEL'

    exporting

    filename = 'TEST.XLS'

    tables

    data = imara.

    If your requirement demands user to give file name, take it as parameter then concatenate .XLS to the parameter. Then use that parameter for FileName in the above call.

    Regards

    Surya.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 05:24 AM

    hi,

    please paste the below code so ur problem will be soled. i tested tbelow sample program while executing the report it is displaying the outptu in excel sheet only.

    plese see below code and change the code in your program.

    tables: mara.

    data: begin of it_mara occurs 0,

    matnr type mara-matnr,

    ersda type mara-ersda,

    end of it_mara.

    parameters: p_matnr type mara-matnr.

    select matnr

    ersda

    from mara

    into table it_mara

    where matnr = p_matnr.

    CALL FUNCTION 'WS_EXCEL'

    EXPORTING

    FILENAME = 'c:\tmp\test.xls'

    • SYNCHRON = ' '

    TABLES

    DATA = it_mara

    .

    thanks,

    maheedhar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 10:38 AM

    Hello SKC,

    thanks for the explanation.

    regards

    stefan

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.