cancel
Showing results for 
Search instead for 
Did you mean: 

Messy code problem while translating XString to String in OfficeControl

Former Member
0 Kudos

Hi Expert,

I have messy code problem while translating XString to String in XML-Format Word Doc in OfficeControl.

I upload an XML-Format template Word Doc to server as a MIME Object.

When OfficeControl is started in Web Dynpro, OfficeControl automatically open the XML-Format template.

For the first time, I get the XString-type Context attribute bind to the content of the Word Doc,

then translate it to string, I got the XML-format content, it's great!

However, after the first time, when I input any new contents in MS Word in Web Dynpro,

no matter I execute "Ctrl + S" or click the "savedocument" button,

when I translate the XString Context attribute to String, I got messy code. (but the first time, it is good plain text)

I use the function module: ECATT_CONV_XSTRING_TO_STRING (good for first time, dump after first time),

SCMS_XSTRING_TO_BINARY, SCMS_BINARY_TO_STRING (good for first time, messy code after first time).

My Demo source code is in: (system) SMV --> (local object) zhaode --> (Dynpro Component) ztest_office_control

core source code is as:

clear itab.

CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

EXPORTING

BUFFER = lv_datas

IMPORTING

OUTPUT_LENGTH = lv_length

TABLES

binary_tab = itab.

CALL FUNCTION 'SCMS_BINARY_TO_STRING'

EXPORTING

input_length = lv_length

mimetype = 'text/plain; charset=utf-8'

IMPORTING

text_buffer = lv_datas_string

output_length = lv_data_len

TABLES

binary_tab = itab.

Can you give me some advice?

Many thanks in advance.

Best Regards,

Accepted Solutions (0)

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You have already posted this same question several times (and some very similiar questions) within the forum. Please do NOT multiple post your questions. This is against the forum rules of engagement. SAP employee or not, you will find yourself banned from the forums if you don't follow the rules.