Skip to Content
0
Dec 16, 2010 at 12:30 AM

cl_bcs_convert=>txt_to_solix - Create Excel file

1705 Views

I used method txt_to_solix to convert table of text (less than 255 bytes record) to binary table and send email as excel attachment file.

But when I open excel file, the first column was blank.

If I use method string_to_solix it was OK. Can some one explains why?

Here is example:

data: wa type soli,

soli_tab type soli_tab,

solix_tab type solix_tab.

data:

gc_tab TYPE c VALUE cl_bcs_convert=>gc_tab,

gc_crlf TYPE c VALUE cl_bcs_convert=>gc_crlf.

Data: Begin of inrec,

f1 type char10 value 'val1',

f2 type char5 value 'val2'.

f3 type i value 15,

f4 type char20 value 'val4'

end of inrec.

concatenate 'Filed1' 'Field2' 'Field3' 'Field4' into wa separated by gc_tab. "Header record

concatenate wa gc_crlf into wa.

append wa to soli_tab.

clear wa.

concatenate inrec-f1 inrec-f2 inrec-f3 inrec-f4 into wa separated by gc_tab.

concatenate wa gc_crlf into wa.

append wa to soli_tab.

TRY.

CALL METHOD cl_bcs_convert=>txt_to_solix

EXPORTING

it_soli = soli_tab

iv_codepage = '4103'

iv_add_bom = 'X'

iv_size = size

IMPORTING

et_solix = solix_tab

ev_size = ev_size

.

CATCH cx_bcs .

MESSAGE e445(so).

ENDTRY.

Then I email the data in solix_tab as Excel attachment. I receive the email but when I open the excel it shows:

field1 field2 field3 field4

val2 15 val4

If I put a gc_tab infront of the record, it is OK but my excel data for field1 will be in colum2 of the excel.

But if I change to user string_to_solix method, it works fine.

Can someone explains why ? Thanks,