Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

download alv report output to excel format with out header

Former Member
0 Kudos

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

3 REPLIES 3

Former Member
0 Kudos

HI Deepu

The parameter FILE_NAME of the FM should be the path of the file where you need to download..

CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
 EXPORTING
  FILE_NAME = 'C:XLSHEET.XLS'  "'XLSHEET'  <--- Change here
*   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.

Please make the highlighted change and check...

Kind Regards

Eswar

0 Kudos

hi eswar,

its working..... thanks for your response........

thanks&regards,

deepu

Former Member
0 Kudos

hi

according to eswar's suggestion i changed the path and it is working fine.

thanks

deepu