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

Long Text on screen

Former Member
0 Likes
5,227

Hello All,

I need to create a Long text field on a screen. The user should be able to enter multiple lines of text in this.

Can someone please tell me how to create such an element?

Thanks,

Rugmani

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,082

Hi,

I think you need a text edit control for entering long text.

You have to use a CONTAINER and EDITOR for that.

Please check the below code.

DATA : V_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,

V_OBJ_EDITOR TYPE REF TO CL_GUI_TEXTEDIT.

First you have to create the container

CREATE OBJECT v_custom_container

EXPORTING

container_name = c_text_control " TEXT_CONTROL

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5

OTHERS = 6.

Then you have to create the TEXT EDITOR

IF v_obj_editor IS INITIAL.

  • Create object for the TextEditor control for Long text

CREATE OBJECT v_obj_editor

EXPORTING

wordwrap_mode =

cl_gui_textedit=>wordwrap_at_fixed_position

wordwrap_position = c_72 " 72

wordwrap_to_linebreak_mode = cl_gui_textedit=>true

parent = v_custom_container

EXCEPTIONS

error_cntl_create = 1

error_cntl_init = 2

error_cntl_link = 3

error_dp_create = 4

gui_type_not_supported = 5

OTHERS = 6.

Then you have to set the EDITOR read only or write MODE

(Note : your case you can avoid this )

Then you have to retrive the text entered in the editor by you or the USER

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = c_ltxt " LTXT

language = c_e " E

name = v_name

object = c_qmel " QMEL

TABLES

lines = i_line

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

Hope this will help you.

Regards,

Smart Varghese

Hello All,

I need to create a Long text field on a screen. The user should be able to enter multiple lines of text in this.

Can someone please tell me how to create such an element?

Thanks,

Rugmani

5 REPLIES 5
Read only

Former Member
0 Likes
3,083

Hi,

I think you need a text edit control for entering long text.

You have to use a CONTAINER and EDITOR for that.

Please check the below code.

DATA : V_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,

V_OBJ_EDITOR TYPE REF TO CL_GUI_TEXTEDIT.

First you have to create the container

CREATE OBJECT v_custom_container

EXPORTING

container_name = c_text_control " TEXT_CONTROL

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5

OTHERS = 6.

Then you have to create the TEXT EDITOR

IF v_obj_editor IS INITIAL.

  • Create object for the TextEditor control for Long text

CREATE OBJECT v_obj_editor

EXPORTING

wordwrap_mode =

cl_gui_textedit=>wordwrap_at_fixed_position

wordwrap_position = c_72 " 72

wordwrap_to_linebreak_mode = cl_gui_textedit=>true

parent = v_custom_container

EXCEPTIONS

error_cntl_create = 1

error_cntl_init = 2

error_cntl_link = 3

error_dp_create = 4

gui_type_not_supported = 5

OTHERS = 6.

Then you have to set the EDITOR read only or write MODE

(Note : your case you can avoid this )

Then you have to retrive the text entered in the editor by you or the USER

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = c_ltxt " LTXT

language = c_e " E

name = v_name

object = c_qmel " QMEL

TABLES

lines = i_line

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

Hope this will help you.

Regards,

Smart Varghese

Read only

Former Member
0 Likes
3,082

Hi,

Use element CHAR4000.

Regards,

Ramesh.

Read only

Former Member
0 Likes
3,082

Hi,

Use container in module program..

Or

In report Use Fm:- TXW_TEXTNOTE_EDIT in at selection screen output.

Read only

0 Likes
3,082

Hello,

This FM TXW_TEXTNOTE_EDIT will open a text edito as a popup. However, I require the text editor to be present as a subscreen when the user executes the transaction.

How can this be achieved?

I was thinking of using INIT_TEXT, then EDIT_TEXT. But I do not know what type of screen element I need to create. Could someone please tell me if this is a good approach?

Thanks,

Rugmani

Read only

0 Likes
3,082

If you want to put it on a (sub)screen you should go for the TEXT_EDIT (enjoy SAP) control. This can be achieved with class CL_GUI_TEXTEDIT. So on your subscreen first define a container for this control, and next instantiate this class mentioned above to place a text edit field on this container (subscreen).

Demo program:

DEMO_CUSTOM_CONTROL

Edited by: Micky Oestreich on Jun 3, 2009 6:29 PM