Skip to Content
author's profile photo Former Member
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 a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on 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 a 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

  • author's profile photo Former Member
    Former Member
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 19, 2008 at 06:49 AM

    Hi,

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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.