Application Development 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: 

How to make text box as multiline?

Former Member
0 Kudos

Hi All,

HOw can we make a text box multi line so that it looks like a text area.

thanks

Tripti

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Add this code and try

  • Custom Container declaration

DATA GR_CCONTAINER1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

  • Text Editor Declaration

DATA G_EDITOR1 TYPE REF TO CL_GUI_TEXTEDIT.

1. Craete container with one name like 'CC_NAME'

CREATE OBJECT gr_ccontainer1

EXPORTING

container_name = 'CC_NAME'

lifetime = cntl_lifetime_default

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 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.

2. Create Editor control

  • Text Editor Control

CREATE OBJECT g_editor1

EXPORTING

style = 0

wordwrap_mode = '2' "CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION "WORDWRAP_AT_WINDOWBORDER

wordwrap_position = 78

wordwrap_to_linebreak_mode = cl_gui_textedit=>true

parent = gr_ccontainer1

EXCEPTIONS

error_cntl_create = 1

error_cntl_init = 2

error_cntl_link = 3

error_dp_create = 4

gui_type_not_supported = 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.

3. Set Status bar

  • To set Status bar

CALL METHOD g_editor1->set_statusbar_mode

EXPORTING

statusbar_mode = 0

EXCEPTIONS

error_cntl_call_method = 1

invalid_parameter = 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.

4.Set Tool Bar

  • To set Toolbar

CALL METHOD g_editor1->set_toolbar_mode

EXPORTING

toolbar_mode = 0

EXCEPTIONS

error_cntl_call_method = 1

invalid_parameter = 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.

ENDIF.

Try this code in ur program

Regards,

Kalp.

11 REPLIES 11

Former Member
0 Kudos

Hi,

You can create a custom control and assign your field to that.It will act as text area.

Regards,

Kalp..

0 Kudos

Hi kalp,

I have to pick the field from a dictionary table so when i am assigning that name to the custom control and executing the screen that area is not visible.

can you please explain.

thanks

0 Kudos

Hi,

Make use of Text editor control. There are methods to set and get text from this control.

Read the value from table and then use SETTEXT method of this control to display the value in the editor. You can not directly map the field to screen field.

Refer to the below link:

[http://help.sap.com/saphelp_47x200/helpdata/en/eb/549e36cf0ecb7de10000009b38f889/frameset.htm]

Check sample programs from development class - SAPTEXTEDIT

Thanks,

Lakshmi

Edited by: Santhanalakshmi V on Nov 19, 2008 12:29 PM

Former Member
0 Kudos

Hi,

U have to use text edit control.....

Former Member
0 Kudos

We cannot make text box multiline.

But a workaround is available for it: Make a custom control on ur screen and make it a text editor control using classes.

Former Member
0 Kudos

Hi,

Add this code and try

  • Custom Container declaration

DATA GR_CCONTAINER1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

  • Text Editor Declaration

DATA G_EDITOR1 TYPE REF TO CL_GUI_TEXTEDIT.

1. Craete container with one name like 'CC_NAME'

CREATE OBJECT gr_ccontainer1

EXPORTING

container_name = 'CC_NAME'

lifetime = cntl_lifetime_default

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 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.

2. Create Editor control

  • Text Editor Control

CREATE OBJECT g_editor1

EXPORTING

style = 0

wordwrap_mode = '2' "CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION "WORDWRAP_AT_WINDOWBORDER

wordwrap_position = 78

wordwrap_to_linebreak_mode = cl_gui_textedit=>true

parent = gr_ccontainer1

EXCEPTIONS

error_cntl_create = 1

error_cntl_init = 2

error_cntl_link = 3

error_dp_create = 4

gui_type_not_supported = 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.

3. Set Status bar

  • To set Status bar

CALL METHOD g_editor1->set_statusbar_mode

EXPORTING

statusbar_mode = 0

EXCEPTIONS

error_cntl_call_method = 1

invalid_parameter = 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.

4.Set Tool Bar

  • To set Toolbar

CALL METHOD g_editor1->set_toolbar_mode

EXPORTING

toolbar_mode = 0

EXCEPTIONS

error_cntl_call_method = 1

invalid_parameter = 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.

ENDIF.

Try this code in ur program

Regards,

Kalp.

0 Kudos

Hi Kalp,

thanks for your reply.

problem resolved.

0 Kudos

Hello,

Can you let me know how did you solve your problem wiht the multi-line text box?

I have a same issue where in the decription field is 200 and the user wants to see them in multi lines rather than a single line of text.

Your help is highly appreciated.

Thanks,

Suresh Ganti

0 Kudos

HI Suresh,

you can make the text box multi line through custom control.

Refer to the below link:

http://help.sap.com/saphelp_47x200/helpdata/en/eb/549e36cf0ecb7de10000009b38f889/frameset.htm

Check sample programs from development class - SAPTEXTEDIT

Thanks

Tripti

0 Kudos

Hi,

Thanks for the information. I'm using the custom control, but the container is comes up with a default toolbar and I don't want the toolbar. Is there a way to supress this.

All I need is the text area with an height of 3.

All your help will be highly appreciated.

Thanks,

Suresh Ganti

Former Member
0 Kudos

Hi Varalakshmi Sanjeevi,

I have the same problem. how can i create an object multiline textbox. I tried your sample code the problem is i don't know where to insert the statement that you gave. there are sap sample program but their sample requires to call a new screen. my problem is i need to insert multiline textbox on the same window without creating a new screen.

Thanks!