Skip to Content
0
Former Member
Mar 15, 2007 at 07:40 AM

getting zeros in heading

15 Views

Hi all,

This is my code to download the content of report to Excel,Problem i am getting when trying to put heading for numerical fields .Its getting '0' in the heading .For remaining Fields which are non-numberic its displaying nicely.Could any one solve this for me.

report zt11.

data : itab type mard occurs 0 .

select * from mard into table itab .

data: it_t001 type t001 occurs 0,

it_fields type dfies occurs 0 with header line,

begin of it_fnames occurs 0,

reptext like dfies-reptext,

end of it_fnames.

CALL FUNCTION 'GET_FIELDTAB'

EXPORTING

  • LANGU = SY-LANGU

  • ONLY = ' '

TABNAME = 'MARD'

  • WITHTEXT = 'X'

  • IMPORTING

  • HEADER =

  • RC =

TABLES

FIELDTAB = it_fields

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.

loop at it_fields.

it_fnames-reptext = it_fields-reptext.

append it_fnames.

endloop.

CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'

EXPORTING

FILE_NAME = 'C:\T001'

  • CREATE_PIVOT = 0

DATA_SHEET_NAME = 'Companies'

  • PIVOT_SHEET_NAME = ' '

  • PASSWORD = ' '

  • PASSWORD_OPTION = 0

TABLES

  • PIVOT_FIELD_TAB =

DATA_TAB = itab

  • FIELDNAMES = it_fnames

EXCEPTIONS

FILE_NOT_EXIST = 1

FILENAME_EXPECTED = 2

COMMUNICATION_ERROR = 3

OLE_OBJECT_METHOD_ERROR = 4

OLE_OBJECT_PROPERTY_ERROR = 5

INVALID_FILENAME = 6

INVALID_PIVOT_FIELDS = 7

DOWNLOAD_PROBLEM = 8

OTHERS = 9

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

short dump : unable to interpret the "..... " as number.