Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Help with string to xstring

Former Member
0 Likes
501

Hi, I'm pulling an excel file from the application server and then attaching the file to the method "attach_file_to_response". However, when I view the file in excel I have an unwanted column. Can anyone tell me how to fix this, or even if there is another way of doing this.

I have inserted my code below and thanks in advance.

***CODE***

open dataset lv_dataset for input in text mode encoding default.

do.

read dataset lv_dataset into wa.

if sy-subrc ne 0.

exit.

endif.

concatenate: lv_string_s

wa

cl_abap_char_utilities=>cr_lf into lv_string_s

separated by cl_abap_char_utilities=>horizontal_tab.

enddo.

close dataset lv_dataset.

cl_abap_conv_out_ce=>create( receiving conv = lr_conv ).

lr_conv->convert( exporting data = lv_string_s

importing buffer = lv_xfile ).

cl_wd_runtime_services=>attach_file_to_response(

exporting i_filename = i_filename

i_content = lv_xfile

i_mime_type = 'application/vnd.ms-excel' ).

2 REPLIES 2
Read only

Former Member
0 Likes
401

hi,

try this one

data: xl_content type xstring .

DATA: binary_content TYPE solix_tab.

CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

EXPORTING

buffer = xl_content

TABLES

binary_tab = binary_content.

regards

Read only

former_member784222
Active Participant
0 Likes
401

Hi,

Try function module 'HR_KR_STRING_TO_XSTRING'.

Thanks and regards,

S. Chandra Mouli.