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

saving data from text edit control

naveenvishal
Contributor
0 Likes
1,475

how can i save to and get the data from a table (having a text field of 255 char in size) , from using a text edit control.

Text Edit Control --> Database Table

Text Edit Control <-- Database Table

Thanx

1 ACCEPTED SOLUTION
Read only

RemiKaimal
Active Contributor
0 Likes
673

Hi,

1) To start off ;

Place a Custom conatiner on screen set it's name to TEXTEDITOR

Created a reference to the custom Container & create it's object


DATA editor_container TYPE REF TO cl_gui_custom_container.

create object editor_container
exporting
      container_name = 'TEXTEDITOR'
exceptions
     cntl_error = 1
     cntl_system_error = 2
     create_error = 3
      lifetime_error = 4
      lifetime_dynpro_dynpro_link = 5.

2) Created a reference to your Text Edit Control and create it's object :


DATA text_editor TYPE REF TO cl_gui_textedit.
create object text_editor
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.

3)Hide toolbar and statusbar


call method text_editor ->set_toolbar_mode
exporting
     toolbar_mode = cl_gui_textedit=>false.
 call method text_editor->set_statusbar_mode
 exporting
        statusbar_mode = cl_gui_textedit=>false.

4) Answering your question Text Edit Control --> Database Table


call method text_editor->get_text_as_stream
exporting
    only_when_modified = cl_gui_textedit=>false
importing
     text               = wrk_text
exceptions
     others             = 1.

Save wrk_text to Table

5) Text Edit Control <-- Database Table

The reverse process of Step 4

With method :

CALL METHOD text_editor->set_text_as_stream
......

I hope this answers your Query.

Cheers,

Remi

1 REPLY 1
Read only

RemiKaimal
Active Contributor
0 Likes
674

Hi,

1) To start off ;

Place a Custom conatiner on screen set it's name to TEXTEDITOR

Created a reference to the custom Container & create it's object


DATA editor_container TYPE REF TO cl_gui_custom_container.

create object editor_container
exporting
      container_name = 'TEXTEDITOR'
exceptions
     cntl_error = 1
     cntl_system_error = 2
     create_error = 3
      lifetime_error = 4
      lifetime_dynpro_dynpro_link = 5.

2) Created a reference to your Text Edit Control and create it's object :


DATA text_editor TYPE REF TO cl_gui_textedit.
create object text_editor
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.

3)Hide toolbar and statusbar


call method text_editor ->set_toolbar_mode
exporting
     toolbar_mode = cl_gui_textedit=>false.
 call method text_editor->set_statusbar_mode
 exporting
        statusbar_mode = cl_gui_textedit=>false.

4) Answering your question Text Edit Control --> Database Table


call method text_editor->get_text_as_stream
exporting
    only_when_modified = cl_gui_textedit=>false
importing
     text               = wrk_text
exceptions
     others             = 1.

Save wrk_text to Table

5) Text Edit Control <-- Database Table

The reverse process of Step 4

With method :

CALL METHOD text_editor->set_text_as_stream
......

I hope this answers your Query.

Cheers,

Remi