Hi,
I would like to have an Text Area in Screen painter. I didn't find any control for Text Area so i used custom control and used the following code to bring up the Text Editor control.
DATA : editor_itxt TYPE REF TO cl_gui_textedit,
textedit_container_itxt TYPE REF TO cl_gui_custom_container,
NPATT_TXT_MESSAGE(1000).
IF editor_itxt IS INITIAL.
create control container for item long text
CREATE OBJECT textedit_container_itxt
EXPORTING
container_name = 'NPATT_TXT_MESSAGE'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
create calls constructor, which initializes, creates and links
a TextEdit Control
CREATE OBJECT editor_itxt
EXPORTING
parent = textedit_container_itxt
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_to_linebreak_mode = cl_gui_textedit=>true
EXCEPTIONS
OTHERS = 1.
CALL METHOD editor_itxt->set_toolbar_mode
EXPORTING
toolbar_mode = 0. "Do not show toolbar.
toolbar_mode = 1. "Show toolbar.
CALL METHOD editor_itxt->set_statusbar_mode
EXPORTING
statusbar_mode = 0. "Do not show statusbar.
ENDIF.
I couldn't get the data entered with NPATT_TXT_MESSAGE.
Can someone help me?
Thanks in advance
arun
Hi Arun
You should call the relevant method of "<b>cl_gui_textedit</b>" to get its content.
OR
You can simply use FMs wrapping that textedit control. These are "<b>RH_EDITOR_SET</b>" which you should use at PBO of your screen and "<b>RH_EDITOR_GET</b>" at PAI of your screen to get its content.
*--Serdar
Hi Serder,
Sorry for such a delay. Regarding this,
I don't unserstand how to use this,
You can simply use FMs wrapping that textedit control. These are "RH_EDITOR_SET" which you should use at PBO of your screen and "RH_EDITOR_GET" at PAI of your screen to get its content.
Can you post a code with sample custom control name to show an Textedit control.
Also, i want to know how can i wrap the text to next line, When i type it keeps on going to the right and it doesn't go to the new line.
How can i handle this?
Thank you
arun
Hi Arun
Here is code snippets for both functions:
<u>To set your editor, i.e calling at PBO</u>
CALL FUNCTION 'RH_EDITOR_SET' EXPORTING repid = sy-cprog dynnr = <screen_number> controlname = <custom_control_name> max_cols = <maximum_line_length> max_lines = <maximum_no_of_lines> "has no effect" show_tool = 'X' show_status = 'X' display_mode = space TABLES lines = gt_lines EXCEPTIONS create_error = 1 internal_error = 2 OTHERS = 3.
This will link a text editor to the custom control <i><custom_control_name></i> at the screen <i><screen_number></i> of your program with the data at the table <b>"gt_lines"</b> and it is editable since I pass space to the parameter <b>"display_mode"</b>.
<u>At PAI, to get the content;</u>
REFRESH gt_lines . CALL FUNCTION 'RH_EDITOR_GET' EXPORTING controlname = <custom_control_name> TABLES lines = gt_lines EXCEPTIONS internal_error = 1 OTHERS = 2 .
And this will get the content of the text editor linked to the same custom control into the table gt_lines.
If you want to store the data, then you must store all the editor content in a flat form. That is you need placeholder for line break. What I do is using "#" for line breaks. I use <b>"SPLIT"</b> statement to form the internal table with lines from the flat line where lines are separated by "#". And I use <b>"CONCATENATE"</b> statement to concatenate them to form the flat line from the internal table.
Hope this also helps...
*--Serdar
Add a comment