Hi, you have not separated each row by carriage return character.
Check this code.
FORM BUILD_XLS_DATA_TABLE.
"If you have Unicode check active in program attributes then
"you will need to declare constants as follows.
CLASS CL_ABAP_CHAR_UTILITIES DEFINITIONLOAD.
CONSTANTS:
CON_TAB TYPECVALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
CON_CRET TYPECVALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.
CONCATENATE'EBELN''EBELP''GJAHR''MATNR''DMBTR'
INTO W_ATTACHMENT
SEPARATEDBY CON_TAB.
CONCATENATE CON_CRET
W_ATTACHMENT
INTO W_ATTACHMENT.
APPEND W_ATTACHMENT TO I_ATTACHMENT.
CLEAR W_ATTACHMENT.
LOOPAT I_EKBE INTO W_EKBE.
CONCATENATE W_EKBE-ebeln
W_EKBE-ebelp
W_EKBE-gjahr
W_EKBE-matnr
W_EKBE-dmbtr
INTO W_ATTACHMENT
SEPARATEDBY CON_TAB.
CONCATENATE CON_CRET W_ATTACHMENT
INTO W_ATTACHMENT.
APPEND W_ATTACHMENT TO I_ATTACHMENT.
CLEAR W_ATTACHMENT.
ENDLOOP.
ENDFORM. "build_xls_data_table
Check this thread for complete code.