Application Development 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: 

Save the text from Text Editor

Former Member
0 Kudos

Hi all,

I am creating a editor using CREATE OBJECT text_editor.

there i am entering 2000 characters of text into the Editor.l

How to save the data from the editor into the field,

will anybody let me know it

regards,

Madhavi

6 REPLIES 6

Former Member
0 Kudos

Hi Madhavi,

The GET_TEXT_AS_R3TABLE method can be used for getting

the text entered into any standard internal table.

Check the below code for example.

 DATA : container   TYPE REF TO cl_gui_docking_container,
        text_editor TYPE REF TO cl_gui_textedit,
        lt_texttab  TYPE TABLE OF char80 WITH HEADER LINE.

 CALL SCREEN 100.

 LOOP AT lt_texttab.
   WRITE / lt_texttab.
 ENDLOOP.

*---------------------------------------------------------------------*
 MODULE pb0 OUTPUT.

   SET PF-STATUS 'BASIC'.  " Only a BACK button with Apllication type 'E'.

   CHECK container IS NOT BOUND.

   CREATE OBJECT container  EXPORTING side       = cl_gui_docking_container=>dock_at_top
                                      extension  = '99999'.

   CREATE OBJECT text_editor EXPORTING parent            = container
                                       wordwrap_mode     = 2
                                       wordwrap_position = 80.
 ENDMODULE.                 " pb0  OUTPUT
*&---------------------------------------------------------------------*
 MODULE pai INPUT.
   text_editor->get_text_as_r3table( IMPORTING table = lt_texttab[] ).
   SET SCREEN 0.LEAVE SCREEN.
 ENDMODULE.                 " pai  INPUT

Screen flow logic

 process before output.
   MODULE pb0.

 process after input.
   module pai at exit-command.

Here once we click back button the content of the text editor

is extracted into the internal table and written.

Cheers,

Jose.

0 Kudos

hi Jose,

Yes, till here iam able to get the data.

Now i need to update text from lt_texttab[] into my ztable .

How i have to update it .

CALL METHOD text_editor->get_text_as_r3table

IMPORTING

table = text_lines.

CALL METHOD popup->free( ).

LOOP AT text_lines INTO wa.

gv_text = wa-line .

CONCATENATE gv_text1 gv_text INTO gv_text1 SEPARATED BY space.

ENDLOOP.

gs_edi-len = 4000.

gs_edi-zstr = gv_text1.

  • gv_id = es_row_no-row_id.

MODIFY gt_edi FROM gs_edi INDEX gv_id

TRANSPORTING zstr len.

MODIFY zpf_text FROM TABLE gt_edi.

COMMIT WORK.

But this is allowing only 255 characters to update.

will anybody let me know how to update into table.

Regards,

Madhavi

Edited by: varisetty madhavi on Oct 6, 2008 12:51 PM

0 Kudos

Hi Madhavi,

If 255 characters are getting updated, the problem seems to

exist with the length of internal tab fields/variables/DB tab field used.Increasing their length might solve the

problem.

Btw, why r u using such a long field?? We can use the

wordwrap_position parameter of its constructor to break a line at a fixed position(Say 255).

Cheers,

Jose.

Former Member
0 Kudos

Hi Jose

One Clarification required from your end please

Its fine that we can break into lines with say 255 characters using wordwrap_position parameter of its constructor.

But can you say what will be the format in which it is saved in database table

I mean to say

Suppose

-


_>----


-


_>----


-


_>----


here there are 3 lines each breaking at say 255 characters

but my every line stops at _>

Now in what format will it be stored

and when i try to retrieve do i get in the same format

Thanks in Advance

Vikas C

0 Kudos

Hi Vikas,

Say,

Ur DB table has a char field of length 255 and ur int table also

has the same structure.

Then it ll be stored in the same format as u type in text-editor

-


_>----


-


_>----


-


_>----


Cheers,

Jose.

Former Member
0 Kudos

Solved Myself