Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

checking change to texteditcontrol

Former Member
0 Likes
487

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?

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
456

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

3 REPLIES 3
Read only

naimesh_patel
Active Contributor
0 Likes
457

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

Read only

0 Likes
456

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.

Read only

0 Likes
456

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