Skip to Content
0
Former Member
Mar 13, 2007 at 05:35 PM

Task on exporting data

13 Views

Hi all,

How to use the 'EXCEL_OLE_STANDARD_DAT'

to export the data from itab to EXCEL file.

REPORT ZT11.

data : begin of itab occurs 0,

t1(3) type c value 'sag',

t2(3) type c value 'ntc',

end of itab.

append itab.

write : itab-t1,itab-t2.

CALL FUNCTION 'GET_FIELDTAB'

  • EXPORTING

  • LANGU = SY-LANGU

  • ONLY = ' '

  • TABNAME = ' '

  • WITHTEXT = 'X'

  • IMPORTING

  • HEADER =

  • RC =

TABLES

FIELDTAB =

  • EXCEPTIONS

  • INTERNAL_ERROR = 1

  • NO_TEXTS_FOUND = 2

  • TABLE_HAS_NO_FIELDS = 3

  • TABLE_NOT_ACTIV = 4

  • OTHERS = 5

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'

EXPORTING

FILE_NAME =

  • CREATE_PIVOT = 0

  • DATA_SHEET_NAME = ' '

  • PIVOT_SHEET_NAME = ' '

  • PASSWORD = ' '

  • PASSWORD_OPTION = 0

  • TABLES

  • PIVOT_FIELD_TAB =

  • DATA_TAB =

  • FIELDNAMES =

  • EXCEPTIONS

  • FILE_NOT_EXIST = 1

  • FILENAME_EXPECTED = 2

  • COMMUNICATION_ERROR = 3

  • OLE_OBJECT_METHOD_ERROR = 4

  • OLE_OBJECT_PROPERTY_ERROR = 5

  • INVALID_PIVOT_FIELDS = 6

  • DOWNLOAD_PROBLEM = 7

  • OTHERS = 8

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.