Skip to Content
0
Former Member
Dec 20, 2006 at 06:48 AM

download alv report output to excel format with out header

49 Views

hi all,

i am using the function module 'MS_EXCEL_OLE_STANDARD_DAT' to download the alv output into excel formatt.

the code is as shown below but it is still not downloading the data into excel sheet. could somebody help in this regard.

*field names

lt_fieldnames-value = 'Material Number'.

APPEND lt_fieldnames.

lt_fieldnames-value = 'Plant'.

APPEND lt_fieldnames.

lt_fieldnames-value = 'Material Group'.

APPEND lt_fieldnames.

lt_fieldnames-value = 'Material Description'.

APPEND lt_fieldnames.

lt_fieldnames-value = 'UOM'.

APPEND lt_fieldnames.

lt_fieldnames-value = 'Price Unit'.

APPEND lt_fieldnames.

lt_fieldnames-value = 'Material Type'.

APPEND lt_fieldnames.

lt_fieldnames-value = 'X-Plant Status'.

APPEND lt_fieldnames.

lt_fieldnames-value = 'Valuation Class'.

APPEND lt_fieldnames.

lt_fieldnames-value = lw_avmng.

APPEND lt_fieldnames.

lt_fieldnames-value = lw_avntp.

APPEND lt_fieldnames.

lt_fieldnames-value = 'Latest PO Qty'.

APPEND lt_fieldnames.

lt_fieldnames-value = 'Latest PO Cost'.

APPEND lt_fieldnames.

lt_fieldnames-value = 'PO Creation Date'.

APPEND lt_fieldnames.

lt_fieldnames-value = lw_fcaqt.

APPEND lt_fieldnames.

lt_fieldnames-value = 'Prev. Yr. Std. Cost'.

APPEND lt_fieldnames.

lt_fieldnames-value = lw_stcst.

APPEND lt_fieldnames.

CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'

EXPORTING

file_name = 'XLSHEET'

  • CREATE_PIVOT = 0

  • DATA_SHEET_NAME = ' '

  • PIVOT_SHEET_NAME = ' '

  • PASSWORD = ' '

  • PASSWORD_OPTION = 0

TABLES

  • PIVOT_FIELD_TAB =

data_tab = t_output1

fieldnames = lt_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 e001 WITH 'Data could not downloaded'.

ENDIF.

thanks

deepu