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

Invoking Text Editor

Former Member
0 Likes
468

How to invoke a text editor in a screen

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
434

Basically you need to create a container and create an instance of the editor in that container, in this example, I am just creating a docking container on the selection screen, but this could easily be changed to implement in a custom container on a dynpro. Basically it is the same steps, but the AT SELECTION-SCREEN OUTPUT coding would be the PBO of your screen.



report zrich_0001 .

data:
      dockingleft  type ref to cl_gui_docking_container,
      text_editor    type ref to cl_gui_textedit,
      repid type syrepid.

data: begin of header.
        include structure thead.
data: end of header.

data: begin of lines occurs 0.
        include structure tline.
data: end of lines.

data: textlines type table of tline-tdline,
      wa_text type tline-tdline.

parameters: p_check.

at selection-screen output.

  repid = sy-repid.

  create object dockingleft
              exporting repid     = repid
                        dynnr     = sy-dynnr
                        side      = dockingleft->dock_at_left
                        extension = 1070.

  create object text_editor
              exporting
                   parent     = dockingleft.

start-of-selection.

  call method text_editor->get_text_as_r3table
     importing
           table              = textlines
     exceptions
           others             = 1.

Loop at textlines into wa_text.
Write:/ wa_text.
endloop.


Regards,

Rich Heilman

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
435

Basically you need to create a container and create an instance of the editor in that container, in this example, I am just creating a docking container on the selection screen, but this could easily be changed to implement in a custom container on a dynpro. Basically it is the same steps, but the AT SELECTION-SCREEN OUTPUT coding would be the PBO of your screen.



report zrich_0001 .

data:
      dockingleft  type ref to cl_gui_docking_container,
      text_editor    type ref to cl_gui_textedit,
      repid type syrepid.

data: begin of header.
        include structure thead.
data: end of header.

data: begin of lines occurs 0.
        include structure tline.
data: end of lines.

data: textlines type table of tline-tdline,
      wa_text type tline-tdline.

parameters: p_check.

at selection-screen output.

  repid = sy-repid.

  create object dockingleft
              exporting repid     = repid
                        dynnr     = sy-dynnr
                        side      = dockingleft->dock_at_left
                        extension = 1070.

  create object text_editor
              exporting
                   parent     = dockingleft.

start-of-selection.

  call method text_editor->get_text_as_r3table
     importing
           table              = textlines
     exceptions
           others             = 1.

Loop at textlines into wa_text.
Write:/ wa_text.
endloop.


Regards,

Rich Heilman

Read only

0 Likes
434

Hello sir,

Very helpful answer. Can you help me out with this.

The solution you provided is great but can you tell that

if i am writting any comment on that and when i will press

save it shoul ask to create a directory to save the

document. Its needed help me wih this. If possible provede

some code.

Read only

0 Likes
434

Hi Rich,

thanks for your good coding example. It's very helpful.

I have just one question:

How can I set a text to display in the text editor?

I already created the editor and it works fine. I already defined a text with SO10 which I want to display. In my ABAP I read this text using the function module

call function 'READ_STDTEXT'
     exporting
          id               = 'ST'
          language         = 'D'
          name             = 'ZPERDIEMS_HELP'
*         USE_AUX_LANGUAGE = ' '
*         USE_THRUCLIENT   = ' '
    importing
         header           = header
     tables
          lines            = lines.
*    EXCEPTIONS
*         ID               = 1
*         LANGUAGE         = 2
*         NAME             = 3
*         NOT_FOUND        = 4
*         REFERENCE_CHECK  = 5
*         OTHERS           = 6
          .
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

How can I "send" this text to the editor?

Thanks in advance and regards,

Martin

UPDATE: I already found the solution!

Edited by: fischerman on Feb 28, 2008 5:25 PM