‎2009 Feb 11 11:58 AM
Hi,
I used a text edit control in my module pool program where i passed the data which was entered in the text edit control to a field in my ztable and this field is of type string.
My problem is when i passed the data to my ztable although the field is of type string
it is taking '##' WHEN I PRESS ENTER WHILE WRITING DATA IN THE TEXT EDIT CONTROL.
IF PROCD IS INITIAL.
CREATE OBJECT EDITOR_CONTAINER
EXPORTING
CONTAINER_NAME = 'PROCD'.
CREATE OBJECT PROCD
EXPORTING
PARENT = EDITOR_CONTAINER
WORDWRAP_MODE = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION
WORDWRAP_POSITION = LINE_LENGTH
WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>TRUE.
CALL METHOD PROCD->SET_TOOLBAR_MODE
EXPORTING
TOOLBAR_MODE = CL_GUI_TEXTEDIT=>FALSE.
CALL METHOD PROCD->SET_STATUSBAR_MODE
EXPORTING
STATUSBAR_MODE = CL_GUI_TEXTEDIT=>FALSE.
ENDIF.
CALL METHOD PROCD->GET_TEXTSTREAM
EXPORTING
ONLY_WHEN_MODIFIED = CL_GUI_TEXTEDIT=>TRUE
IMPORTING
TEXT = TEXT.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD CL_GUI_CFW=>FLUSH.
if i entered 1234
567
789
move text to ztable-text.
iam getting data in itab-text as 1234##567##789
THANKS IN ADVANCE.
Archana.
‎2009 Feb 11 12:06 PM
Methods like [GET_TEXT_AS_STREAM or GET_TEXTSTREAM|https://www.sdn.sap.com/irj/scn/advancedsearch?query=get_text_as_streamorGET_TEXTSTREAM&cat=sdn_all] wont give you a string but a stream of data (with information about line breaks) so the result you get is normal.
If you only want text use a method like [GET_TEXT_AS_R3TABLE|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=get_text_as_r3table&adv=false&sortby=cm_rnd_rankvalue] so you will be able to keep only the relevant texts.
Warning : If you programmatically remove the line break information, the text wont be later displayed as it was input.
Regards
‎2009 Feb 12 7:19 AM
thanks for ur reply,
here when i used the method 'SET_TEXT_AS_R3TABLE'
data : itab1 type standard table of zreport-procd.
where zreport is my ztable.
and procd is my field which is of type string where i'm passing the data.
CALL METHOD me->GET_TEXT_AS_R3TABLE
EXPORTING
ONLY_WHEN_MODIFIED = FALSE
IMPORTING
TABLE = itab1
IS_MODIFIED =
EXCEPTIONS
ERROR_DP = 1
ERROR_CNTL_CALL_METHOD = 2
ERROR_DP_CREATE = 3
POTENTIAL_DATA_LOSS = 4
others = 5
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WHEN I DO THIS I'M GETTING SY-SUBRC AS '2' ---
---> "WHICH SAYS unsupported table type: non char-like
Please help
Archana
‎2009 Feb 12 7:38 AM
The method GET_TEXT_AS_R3TABLE will fill a table of a CHAR type field, use a definition long enough for wordwrap_position of constructor method.
Then you will have to concatenate the CHAR fields into your string field.
Look at documentation like [SAP Textedit|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCITEXTEDIT/BCCITEXTEDIT.pdf]
I never store long text in string fields (for downwards compatibility), i used one of the three following solutions
- Create a secondary table with same keys as master table and an index to store lines of text
- Create a cluster table (INDX like) to store a whole internal table via EXPORTY/IMPORT database
- Create a custom text and use FM like READ_TEXT and SAVE_TEXT
Look at [some threads at sdn with keywords : store text|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=storelongtext&adv=false&sortby=cm_rnd_rankvalue]
If you want to store a string, keep the get as stream, but you will need the ## special characters to manage line feed/carriage return. You have to choice a solution depending on what you expect to do with those texts and how you will manage them later. (redisplay, edit, print, etc.)
Remember, if you don't keep the line breaks input by user, you will not redisplay or print the text as it was input by user.
Look also for stream/string management FM like CONVERT_STREAM_TO_ITF_TEXT
Regards
‎2009 Feb 11 12:08 PM
Hi,
Remove CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION
and try other method for the class.Also try with character type 'abc and then fgh and then ikj .
Let me know if this works ?
‎2010 May 18 10:59 AM