Skip to Content
avatar image
Former Member

How to make text box as multiline?

Hi All,

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

thanks

Tripti

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Nov 19, 2008 at 06:59 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

  • avatar image
    Former Member
    Nov 19, 2008 at 06:45 AM

    Hi,

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

    Regards,

    Kalp..

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 19, 2008 at 06:49 AM

    Hi,

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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 19, 2008 at 06:56 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 29, 2013 at 09:40 AM

    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!

    Add comment
    10|10000 characters needed characters exceeded