03-01-2014 11:33 AM
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?
03-01-2014 4:18 PM
Is it possible that first column has data but it is not visible because of too many leading spaces?
It would be helpful to see 2 lines of internal table and 2 lines of output file when opened in Notepad.
03-01-2014 4:18 PM
Is it possible that first column has data but it is not visible because of too many leading spaces?
It would be helpful to see 2 lines of internal table and 2 lines of output file when opened in Notepad.
03-01-2014 5:31 PM
no it's not possible, because the first column has the mandt, please found in attachment the txt file
03-01-2014 5:51 PM
Every line except first one is starting with tab character. This needs to be taken care of.
Basically, for first field of every line, you need to ensure that only value is concatenated, not the tab character.
Try changing the IF block after ASSIGN statement to this.
/.
03-01-2014 6:31 PM