on 11-05-2008 4:47 PM
Hi
I am having an issue with text pasted from Word into tthe TexEdit control later causing a dump when trying to use the function ECATT_CONV_XSTRING_TO_STRING.
I am guessing that the pasting also inserts formatting as well as text and hence the function cannot cope with this.
Any ideas how to remove the formatting?
Cheers
Ian
Anything input into the TextEdit gets safe encoded before returned to the context, so there shouldn't be anything harmful in it. The textEdit binds to a STRING data type - how exactly are you using the ECATT_CONV_XSTRING_TO_STRING function module against the contents? this function module takes an XSTRING and converts it to a STRING. Perhaps some further details on your processing would be helpful. In a XSTRING to STRING conversion like this, you could just have a character outside the current code page if you are deailing with a non Unicode system.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas
This is the code below. Basically I am trying to build a table of text strings if the user enters the text with carriage returns. BTW the standard cr_lf method for removing the line feeds didn't seem to work.
* Ensures the carriage returns are dealt with correctly when converting a string into a table
* The standard method deals with a carriage return and line feed. This is just a line feed.
CLEAR lv_xstring.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = input_string
IMPORTING
buffer = lv_xstring
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Message not required
RETURN.
ENDIF.
* Split at the line feed hex character
CLEAR lt_xstring.
SPLIT lv_xstring AT lv_0a INTO TABLE lt_xstring
IN BYTE MODE.
LOOP AT lt_xstring ASSIGNING <lv_xstring>.
IF <lv_xstring> IS INITIAL.
ls_lines-tdformat = '*'.
ls_lines-tdline = space.
APPEND ls_lines TO lines.
ELSE.
TRY.
CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
EXPORTING
im_xstring = <lv_xstring>
IMPORTING
ex_string = lv_string.
CLEAR lt_lines.
CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'
EXPORTING
i_string = lv_string
i_tabline_length = 90
TABLES
et_table = lt_lines.
LOOP AT lt_lines ASSIGNING <ls_lines>.
ls_lines-tdformat = '*'.
ls_lines-tdline = <ls_lines>.
APPEND ls_lines TO lines.
ENDLOOP.
CATCH cx_root.
error = abap_true.
ENDTRY.
ENDIF.
ENDLOOP.
First all if you just want to break the return into separate lines, data bind to an attribute of type string_table instead of string. This is from the online help:
The attribute to be bound can be of type STRING or STRING_TABLE. With STRING_TABLE rows from TextEdit are stored as table rows. A line break is always stored as a line feed in a STRING (CL_ABAP_CHAR_UTILITIES=>NEWLINE, ASCII decimal 10). The Web Dynpro framework carries out the conversion for the client platform.
As stated you also would want to do the split on CL_ABAP_CHAR_UTILITIES=>NEWLINE not CR_LF - assuming you wanted to string with STRING instead of STRING_TABLE.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.