Skip to Content
0
Former Member
Aug 26, 2011 at 09:16 AM

Download to Excel with Header but one field data is repeating

13 Views

Hi All,

I'm downloading to Excel with Header. But One field is repeating and another is not. This is happening only when I use 'CONCATENATE ' . With Out this key usage data download to excel is correct. But CONCATENATE is required as constant need to add before the one field.

My coding is as below.

DATA: BEGIN OF IT_FINAL OCCURS 0,

P1(10) TYPE C,

SI(19) type c,

END OF IT_FINAL.

DATA : BEGIN OF IT_HEADER OCCURS 0,

TITLE(100) TYPE C,

END OF IT_HEADER,WA_HEADER LIKE IT_HEADER.

loop at it_final.

CONCATENATE '894412' it_final-SI INTO IT_FINAL.

modify it_final.

endloop.

CLEAR:WA_HEADER.

WA_HEADER-TITLE = 'Mat No'.

APPEND WA_HEADER TO IT_HEADER.

CLEAR:WA_HEADER.

WA_HEADER-TITLE = 'Serial'.

APPEND WA_HEADER TO IT_HEADER.

CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'

EXPORTING

FILE_NAME = P_FILE " path offile where u need to download

TABLES

DATA_TAB = IT_FINAL

FIELDNAMES = IT_HEADER.

CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'

EXPORTING

FILE_NAME = P_FILE " path offile where u need to download

TABLES

DATA_TAB = IT_FINAL

FIELDNAMES = IT_HEADER.

Excel OUT PUT:

Mat No Serial

11Z52321 8944126000

11Z52394 8944126000

11Z52395 8944126000

Thank You,

Pranitha