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

Downloading internal table to excel

Hi, i have to download some data from an internal table to an excel file. all the fields in the internal table are strings, some of them look like a number (for example 32,45 or 123,01). Before downloading the internal table to excel i make a "conversion", as i want these fields to appear like "32.45" i replace ',' with '.', but when i download to excel, the fields appears with ','.... My problem is that I need to combine this excel with a Word document and the format with ',' is wrong........

I'm using function MS_EXCEL_OLE_STANDARD_DAT...

thanks in advance...

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 05:38 AM

    Hi,

    The following code will help u to splve the problem.

    have a look,

    TABLES: VBAK,VBAP.

    DATA: BEGIN OF I_VBAK OCCURS 0,

    VBELN LIKE VBAK-VBELN,

    ERDAT LIKE VBAK-ERDAT,

    ERNAM LIKE VBAK-ERNAM,

    AUDAT LIKE VBAK-AUDAT,

    VBTYP LIKE VBAK-VBTYP,

    END OF I_VBAK.

    DATA: BEGIN OF I_VBAP OCCURS 0,

    VBELN LIKE VBAP-VBELN,

    POSNR LIKE VBAP-POSNR,

    MATNR LIKE VBAP-MATNR,

    CHARG LIKE VBAP-CHARG,

    MATKL LIKE VBAP-MATKL,

    END OF I_VBAP.

    DATA: BEGIN OF IT_VBAK OCCURS 0,

    VBELN LIKE VBAK-VBELN,

    ERDAT LIKE VBAK-ERDAT,

    ERNAM LIKE VBAK-ERNAM,

    AUDAT LIKE VBAK-AUDAT,

    VBTYP LIKE VBAK-VBTYP,

    POSNR LIKE VBAP-POSNR,

    MATNR LIKE VBAP-MATNR,

    CHARG LIKE VBAP-CHARG,

    MATKL LIKE VBAP-MATKL,

    END OF IT_VBAK.

    SELECT VBELN ERDAT ERNAM AUDAT VBTYP FROM VBAK INTO TABLE I_VBAK.

    SELECT VBELN POSNR MATNR CHARG MATKL FROM VBAP INTO TABLE I_VBAP.

    SORT: I_VBAK BY VBELN,I_VBAP BY VBELN.

    LOOP AT I_VBAK.

    READ TABLE I_VBAP WITH KEY VBELN = I_VBAK-VBELN BINARY SEARCH.

    IF SY-SUBRC = 0.

    MOVE I_VBAK-VBELN TO IT_VBAK-VBELN.

    MOVE I_VBAK-ERDAT TO IT_VBAK-ERDAT.

    MOVE I_VBAK-ERNAM TO IT_VBAK-ERNAM.

    MOVE I_VBAK-AUDAT TO IT_VBAK-AUDAT.

    MOVE I_VBAK-VBTYP TO IT_VBAK-VBTYP.

    MOVE I_VBAP-POSNR TO IT_VBAK-POSNR.

    MOVE I_VBAP-MATNR TO IT_VBAK-MATNR.

    MOVE I_VBAP-CHARG TO IT_VBAK-CHARG.

    MOVE I_VBAP-MATKL TO IT_VBAK-MATKL.

    APPEND IT_VBAK.

    ENDIF.

    ENDLOOP.

    CALL FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

    • BIN_FILESIZE =

    FILENAME = 'D:\C5.DOC'

    FILETYPE = 'ASC' "Separate Columns by Tabs in Case of ASCII Download

    • APPEND = ' '

    WRITE_FIELD_SEPARATOR = 'X'

    • HEADER = '00'

    • TRUNC_TRAILING_BLANKS = ' '

    • WRITE_LF = 'X'

    • COL_SELECT = ' '

    • COL_SELECT_MASK = ' '

    • DAT_MODE = ' '

    CONFIRM_OVERWRITE = 'X' "Overwrite The File Only After

    Confirmation

    • 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 = ' '

    • WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE

    • IMPORTING

    • FILELENGTH =

    TABLES

    DATA_TAB = IT_VBAK

    • 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.

    Reward points,if it is helpful.

    Thanks,

    chandu.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 09:24 AM

    now i have '.' instead of ',' but the problem is that when i combine the excel file with de word file it doesnt' work because the excel file has different properties.... pfffffffff

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 09:39 AM

    Hi maria,

    you can try change your user setting.

    Go to System --> User profile --> Own data

    Click on Defaults Tab.

    Change decimal notation to 1,234,567.89

    Regards,

    Mohaiyuddin

    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.