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

text area in screen painter

former_member239066
Participant
0 Likes
5,482

hi experts,

i would like to add a text area on a screen using screen painter. is this possible?

thanks,

vitz

1 ACCEPTED SOLUTION
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
2,114

HI,

Yes, you can add using TEXT AREA control. Insert a custom control area in the screen and create a object of the text editor.

Check this code for PBO and PAI.

TEDITOR is the custom contorl area name on screen:-


MODULE PBO OUTPUT.
  IF EDITOR IS INITIAL.
 
*   set status
SET pf-status '1111'.
 
*   create control container
    CREATE OBJECT TextEdit_Custom_Container
        EXPORTING
            CONTAINER_NAME = 'TEDITOR'
        EXCEPTIONS
            CNTL_ERROR = 1
            CNTL_SYSTEM_ERROR = 2
            CREATE_ERROR = 3
            LIFETIME_ERROR = 4
            LIFETIME_DYNPRO_DYNPRO_LINK = 5.
    if sy-subrc ne 0.
*      add your handling
    ENDif.
    mycontainer = 'TEDITOR'.
 
*   create calls constructor, which initializes, creats and links
*   TextEdit Control
    create object editor
          exporting
           parent = TextEdit_Custom_Container
           WORDWRAP_MODE =
*               cl_gui_textedit=>wordwrap_off
              cl_gui_textedit=>wordwrap_at_fixed_position
*              cl_gui_textedit=>WORDWRAP_AT_WINDOWBORDER
           WORDWRAP_POSITION = line_length
           wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
 
*   to handle different containers
    container_linked = 1.
 
    refresh mytable.
 
  ENDIF.
 
ENDMODULE.                 " PBO  OUTPUT
 
 
MODULE pai INPUT.
case ok_code.
 
WHEN 'SAVE'.
*   retrieve table from control
clear: txt.
      call method editor->get_text_as_r3table
              importing table = mytable.
 
      loop at mytable into wa.
 
         concatenate txt wa into txt
         separated by '|'.
      endloop.
 
      shift txt left.
      length = strlen( txt ).
 
      ztext-CLUSTR = length.
      ztext-text   = txt.
 
      modify ztext.
 
      clear: ztext.
      refresh: mytable.
        call method editor->set_text_as_r3table
              exporting table = mytable.
      Message s000(zwa).
 
when 'DISP'.
  
      select single * from
      ztext
      where fund = ztext-fund.
 
      SPLIT ztext-text AT '|' INTO TABLE mytable.
 
      call method editor->set_text_as_r3table
             exporting table = mytable.
 
endcase.
 
clear: ok_code.
 
ENDMODULE.                 " pai  INPUT

Also you can refer:-

Hope this helps you.

Regards,

Tarun

1 REPLY 1
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
2,115

HI,

Yes, you can add using TEXT AREA control. Insert a custom control area in the screen and create a object of the text editor.

Check this code for PBO and PAI.

TEDITOR is the custom contorl area name on screen:-


MODULE PBO OUTPUT.
  IF EDITOR IS INITIAL.
 
*   set status
SET pf-status '1111'.
 
*   create control container
    CREATE OBJECT TextEdit_Custom_Container
        EXPORTING
            CONTAINER_NAME = 'TEDITOR'
        EXCEPTIONS
            CNTL_ERROR = 1
            CNTL_SYSTEM_ERROR = 2
            CREATE_ERROR = 3
            LIFETIME_ERROR = 4
            LIFETIME_DYNPRO_DYNPRO_LINK = 5.
    if sy-subrc ne 0.
*      add your handling
    ENDif.
    mycontainer = 'TEDITOR'.
 
*   create calls constructor, which initializes, creats and links
*   TextEdit Control
    create object editor
          exporting
           parent = TextEdit_Custom_Container
           WORDWRAP_MODE =
*               cl_gui_textedit=>wordwrap_off
              cl_gui_textedit=>wordwrap_at_fixed_position
*              cl_gui_textedit=>WORDWRAP_AT_WINDOWBORDER
           WORDWRAP_POSITION = line_length
           wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
 
*   to handle different containers
    container_linked = 1.
 
    refresh mytable.
 
  ENDIF.
 
ENDMODULE.                 " PBO  OUTPUT
 
 
MODULE pai INPUT.
case ok_code.
 
WHEN 'SAVE'.
*   retrieve table from control
clear: txt.
      call method editor->get_text_as_r3table
              importing table = mytable.
 
      loop at mytable into wa.
 
         concatenate txt wa into txt
         separated by '|'.
      endloop.
 
      shift txt left.
      length = strlen( txt ).
 
      ztext-CLUSTR = length.
      ztext-text   = txt.
 
      modify ztext.
 
      clear: ztext.
      refresh: mytable.
        call method editor->set_text_as_r3table
              exporting table = mytable.
      Message s000(zwa).
 
when 'DISP'.
  
      select single * from
      ztext
      where fund = ztext-fund.
 
      SPLIT ztext-text AT '|' INTO TABLE mytable.
 
      call method editor->set_text_as_r3table
             exporting table = mytable.
 
endcase.
 
clear: ok_code.
 
ENDMODULE.                 " pai  INPUT

Also you can refer:-

Hope this helps you.

Regards,

Tarun