2007 Nov 20 2:45 AM
Hi all,
I have a texteditcontrol. Inside this texteditcontrol, i assign some default value when runtime. Let say i gt this sentence: Hello World
Assume a user enter some text in the texteditcontrol.
eg: Hello World. How are you.
After that, the user execute the program. The texteditcontrol detect some change in the text. How to know if it is change?
2007 Nov 20 3:52 AM
You can compare both the text tables.
Let's say, there is one default table which has initial text .. IT_DEF.
Now, after user input you can get the text table and you can compare it.
call method text_editor->get_text_as_r3table
importing
table = textlines
exceptions
others = 1.
loop at it_def.
read table textlines index sy-tabix.
if it_def <> textlines.
* text was changed
endif.
endloop.regards,
Naimesh Patel
Yes it because we are tryig to access tables which requires explicit work area to manupulate it.
Below is the corrected code
loop at text_tab in line.
read table text_tab1into line1 index sy-tabix.
if line <> line1.
* text was changed
exit.
endif.
clear: line, line1.
endloop.Regards,
Naimesh Patel
2007 Nov 20 3:52 AM
You can compare both the text tables.
Let's say, there is one default table which has initial text .. IT_DEF.
Now, after user input you can get the text table and you can compare it.
call method text_editor->get_text_as_r3table
importing
table = textlines
exceptions
others = 1.
loop at it_def.
read table textlines index sy-tabix.
if it_def <> textlines.
* text was changed
endif.
endloop.regards,
Naimesh Patel
2007 Nov 20 6:39 AM
i understand your code but i got declaration problem for the internal table.
Can help me resolve the problem? below is my code
For storing the default value:
DATA: line(256) TYPE c,
text_tab LIKE STANDARD TABLE OF line,
field LIKE line.
Hold the current value in texteditcontrol:
DATA: line1(256) TYPE c,
text_tab1 LIKE STANDARD TABLE OF line1,
field1 LIKE line1.
My default value:
line = 'First line in TextEditControl'.
APPEND line TO text_tab.
line = 'hello world'.
APPEND line TO text_tab.
line = 'How are you'.
APPEND line TO text_tab.
Perform the check of 2 internal table:
WHEN 'COMPARE'.
call method editor->get_text_as_r3table
importing
table = text_tab1
exceptions
others = 1.
<b> loop at text_tab.
read table text_tab1 index sy-tabix.
if text_tab <> text_tab1.
text was changed
endif.
endloop.</b>
My error message is:
The internal table "TEXT_TAB" has no Header line - explicit
specification of an output area with "INTO wa" or "ASSIGNING <fs>" is
required.
2007 Nov 20 2:13 PM
Yes it because we are tryig to access tables which requires explicit work area to manupulate it.
Below is the corrected code
loop at text_tab in line.
read table text_tab1into line1 index sy-tabix.
if line <> line1.
* text was changed
exit.
endif.
clear: line, line1.
endloop.Regards,
Naimesh Patel
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |