Skip to Content
0
Former Member
Mar 01, 2014 at 11:33 AM

Internal Table to xls Attachment cl bcs?

230 Views

Hy folks i'm facing an issue while converting an internal table to excel using cl_bcs (to send as attachment.

After the first row, the first column wouldn't be fill again.

i can't figure out why.

this is my piece of code.

LOOP AT lt_kdmat INTO ls_kdmat.

DO.

ASSIGN COMPONENT sy-index OF STRUCTURE ls_kdmat TO <lv_field>.

IF sy-subrc EQ 0.

IF lv_string IS INITIAL.

WRITE <lv_field> TO lv_string_field.

lv_string = lv_string_field.

ELSE.

WRITE <lv_field> TO lv_string_field.

CONCATENATE lv_string gc_tab lv_string_field INTO lv_string.

ENDIF.

ELSE.

CONCATENATE lv_string gc_crlf INTO lv_string.

EXIT.

ENDIF.

ENDDO.

ENDLOOP.

TRY.

CALL METHOD cl_bcs_convert=>string_to_solix

EXPORTING

iv_string = lv_string

* iv_codepage = '4103'

* iv_add_bom =

IMPORTING

et_solix = gt_binary_data

ev_size = gw_doc_len.

CATCH cx_bcs .

MESSAGE 'Error when transfering document contents' TYPE 'E'.

ENDTRY.

What do i miss?