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: 

Scroll Text in a Screen

Former Member
0 Kudos
562

I have a created a Sub Screen that Popups when the user Clicks on the Button in the report. And i need to display "Text" just as in Purchase Order "header text".

How to create Scrollable text Just like as in PO Screen?

2 REPLIES 2

Former Member
0 Kudos
207

Hi,

 you need to call this method 

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

Former Member
0 Kudos
207

Hi,

you define a custom control in the layout using screen painter with some name (eg: ABCD).

now you call the below Object in the program...

DATA : ob_editor TYPE REF TO cl_gui_textedit, " Text editor

ob_container_comments TYPE REF TO cl_gui_custom_container. " Custom Container

  • To show the text in a container at bottom

IF ob_container_comments IS INITIAL.

CREATE OBJECT ob_container_comments

EXPORTING

container_name = 'ABCD'.

IF sy-subrc EQ 0.

CREATE OBJECT ob_editor

EXPORTING

parent = ob_container_comments.

ENDIF.

ENDIF.

CALL METHOD ob_editor->set_enable

EXPORTING

enable = '1'.

CALL METHOD ob_editor->set_toolbar_mode

EXPORTING

toolbar_mode = cl_gui_textedit=>false.

CALL METHOD ob_editor->set_statusbar_mode

EXPORTING

statusbar_mode = cl_gui_textedit=>false.

CLEAR : ls_textname, lv_name, ls_txtlines.

REFRESH : lt_txtlines, it_text.

ls_textname-matid = z08ol_prod_at-matid.

ls_textname-locid = gv_locid.

lv_name = ls_textname.

REFRESH : lt_txtlines,

it_text.

  • Read or get the text what you want to display in the editor box*

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = 'LTXT'

language = 'E'

name = lv_name

object = 'MDTXT'

TABLES

lines = lt_txtlines

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

IF sy-subrc EQ 0.

IF NOT lt_txtlines[] IS INITIAL.

LOOP AT lt_txtlines INTO ls_txtlines.

is_text-text = ls_txtlines-tdline.

  • SHIFT is_text-text RIGHT.

APPEND is_text TO it_text.

ENDLOOP.

ENDIF.

ENDIF.

set the width of the editor box

CALL METHOD ob_editor->set_width

EXPORTING

width = 700

EXCEPTIONS

CNTL_ERROR = 1

others = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Pass the text what you want to display in the editor box

CALL METHOD ob_editor->set_text_as_stream

EXPORTING

text = it_text[]

EXCEPTIONS

error_dp = 1

error_dp_create = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Hope it helps!!

rEGARDS,

Pavan