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

TextEdit control

Former Member
0 Likes
940

I am trying to create a TextEdit control in a subscreen which is part of a selection screen. I have given below the selection-screen I have declared in my program.

I tried using the classes cl_gui_docking_container and cl_gui_textedit to do this but it doesn't work for the subscreen? Is it possible to dock a Text Editor in this subscreen? Is there any other way to do this?

selection-screen begin of screen 1120 as subscreen.

selection-screen begin of block tab2a with frame title text-s07.

selection-screen end of block tab2a.

selection-screen end of screen 1120.

Your help is highly appreciated.

Thanks

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
710

No need for a subscreen, implement in your docking container on the side of the selection screen. Implement the example.



report zrich_0001
       no standard page heading.

* Variable for "Text Container" Abap Object
data: editor type ref to cl_gui_textedit,
      docking type ref to cl_gui_docking_container.

data: wa_text like tline-tdline.

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

data: textlines like tline-tdline occurs 0.
data: syrepid type sy-repid.

parameters: p_check1 type c,
            p_check2 type c.

at selection-screen output.

  syrepid = sy-repid.

  check docking is initial.

  create object docking
              exporting repid     = syrepid
                        dynnr     = sy-dynnr
                        side      = docking->dock_at_left
                        extension = 500.

  create object editor
      exporting parent = docking.

  perform set_text.

start-of-selection.

  perform write_text.

************************************************************************
*       FORM write_text                                                *
************************************************************************
form write_text.

  data: modified type i.

* Retrieve text from container
  call method editor->get_text_as_r3table
     exporting
           only_when_modified = space
     importing
           table              = textlines
           is_modified        = modified
     exceptions
           others             = 1.

* Write out contents of text editor
  leave to list-processing.
  loop at textlines into wa_text.
    write:/ wa_text.
  endloop.

endform.

************************************************************************
*      FORM  SET_TEXT
************************************************************************
form set_text.

  lines-tdline = 'Here we are filling the text editor - Line 1'.
  append lines.

  lines-tdline = 'Here we are filling the text editor - Line 2'.
  append lines.

  loop at lines .
    shift lines left deleting leading space.
    append lines to textlines .
  endloop.

* Fill container with text lines
  call method editor->set_text_as_r3table
     exporting
           table              = textlines
           exceptions
           others             = 1.

endform.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
710

Hi Rich,

Thanks for your response. The requirement is that I have to create the Text Editor in a subscreen which is a tabbed screen. The bottom portion of my selection screen has multiple tabbed screens and in one of the tabbed screen (subscreen) I have to dock a text editor in a smaller size. Similar to the 'TEXTS' tab in ME22N t-code. I am wondering it is possible to do this within the selection screen.

Regards,

Bhuvana

Read only

Former Member
0 Likes
710

Hi Rich,

Thanks for your response. The requirement is that I have to create the Text Editor in a subscreen which is a tabbed screen. The bottom portion of my selection screen has multiple tabbed screens and in one of the tabbed screen (subscreen) I have to dock a text editor in a smaller size. Similar to the 'TEXTS' tab in ME22N t-code. I am wondering it is possible to do this within the selection screen.

Regards,

Bhuvana

Read only

0 Likes
710

I don't think that it is, because you need to use a custom control in a dynpro in order to embed the control, so you will need to create a dynpro to replace your selection screen code. You can use the selection screen subscreen coding when defining your selection screen fields, you can then embed these as subscreen in your dynpro.

Regards,

Rich Heilman