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

Module Pool

Former Member
0 Likes
319

Hi,

How to create a text box in modulepool screen which

accepts multiple lines(text).

Thanks in Advance.

With Regards,

Sharmishta.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
299

you have to use the class

CL_GUI_TEXTEDIT

How to use the class please check this sample

REPORT Z_TEST.
*module create_container_pbo_2000 output.
DATA:
  obj_cust_cont  TYPE REF TO cl_gui_custom_container,
*  obj_cust_cont_character   TYPE REF TO cl_gui_custom_container,
*  obj_cust_cont_preempmnt   TYPE REF TO cl_gui_custom_container,
  obj_text_cred        TYPE REF TO cl_gui_textedit,
*  obj_text_char        TYPE REF TO cl_gui_textedit,
*  obj_text_pemp        TYPE REF TO cl_gui_textedit,
* Internal table to hold text for container reason1
  BEGIN OF i_table_text OCCURS 0,
    line(132) TYPE c,                  " Line text
  END OF i_table_text,
 
* Internal table to hold text for container reason2
  BEGIN OF i_table_text1 OCCURS 0,
    line(132) TYPE c,                  " Line text
  END OF i_table_text1,
 
* Internal table to hold text for container looking for another job
  beGIN OF i_table_text2 OCCURS 0,
    line(132) TYPE c,                  " Line text
  END OF i_table_text2.
 
* Subroutine to create text container for remarks on credentials
  PERFORM get_container_credential.
* Subroutine to create text container for remarks on character
*  PERFORM get_container_character.
* Subroutine to create text container for remarks on preemployeement
*  PERFORM get_container_preempmnt.
call screen 100.
*endmodule.                 " create_container_pbo_2000  OUTPUT
*&---------------------------------------------------------------------*
*&      Form  get_container_credential
*&---------------------------------------------------------------------*
*  Subroutine to create text container for remarks 
*----------------------------------------------------------------------*
* No interface parameters to this subroutine
*----------------------------------------------------------------------*
form get_container_credential .
  IF obj_cust_cont IS INITIAL.
* To create the object custom container and link to the container on
* screen
    CREATE OBJECT obj_cust_cont
        EXPORTING
            container_name = 'CONT'
        EXCEPTIONS
            cntl_error = 1
            cntl_system_error = 2
            create_error = 3
            lifetime_error = 4
            lifetime_dynpro_dynpro_link = 5.
 
*  To create the a TextEdit Control and link to the custom container
    CREATE OBJECT obj_text_CRED
      EXPORTING
         parent = obj_cust_cont
         wordwrap_mode = cl_gui_textedit=>WORDWRAP_AT_WINDOWBORDER
         wordwrap_to_linebreak_mode = cl_gui_textedit=>true
      EXCEPTIONS
          others = 1.
    IF sy-subrc EQ 0.
* To remove the toolbar
      CALL METHOD obj_text_CRED->set_toolbar_mode
        EXPORTING
          toolbar_mode           = 0
        EXCEPTIONS
          error_cntl_call_method = 1
          invalid_parameter      = 2
          OTHERS                 = 3.
 
* To remove the status bar
      CALL METHOD obj_text_CRED->set_statusbar_mode
        EXPORTING
          statusbar_mode         = 0
        EXCEPTIONS
          error_cntl_call_method = 1
          invalid_parameter      = 2
          OTHERS                 = 3
              .
    ENDIF.                             " IF sy-subrc EQ 0
  ENDIF.                               " IF obj_cust_cont_credential
 
endform.                               " get_container_credential
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module STATUS_0100 output.
  SET PF-STATUS 'ZTEST'.
  SET TITLEBAR 'xxx'.
 
endmodule.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module USER_COMMAND_0100 input.
if sy-ucomm EQ 'BACK'.
  leave to screen 0.
endif.
endmodule.                 " USER_COMMAND_0100  INPUT

1 REPLY 1
Read only

Former Member
0 Likes
300

you have to use the class

CL_GUI_TEXTEDIT

How to use the class please check this sample

REPORT Z_TEST.
*module create_container_pbo_2000 output.
DATA:
  obj_cust_cont  TYPE REF TO cl_gui_custom_container,
*  obj_cust_cont_character   TYPE REF TO cl_gui_custom_container,
*  obj_cust_cont_preempmnt   TYPE REF TO cl_gui_custom_container,
  obj_text_cred        TYPE REF TO cl_gui_textedit,
*  obj_text_char        TYPE REF TO cl_gui_textedit,
*  obj_text_pemp        TYPE REF TO cl_gui_textedit,
* Internal table to hold text for container reason1
  BEGIN OF i_table_text OCCURS 0,
    line(132) TYPE c,                  " Line text
  END OF i_table_text,
 
* Internal table to hold text for container reason2
  BEGIN OF i_table_text1 OCCURS 0,
    line(132) TYPE c,                  " Line text
  END OF i_table_text1,
 
* Internal table to hold text for container looking for another job
  beGIN OF i_table_text2 OCCURS 0,
    line(132) TYPE c,                  " Line text
  END OF i_table_text2.
 
* Subroutine to create text container for remarks on credentials
  PERFORM get_container_credential.
* Subroutine to create text container for remarks on character
*  PERFORM get_container_character.
* Subroutine to create text container for remarks on preemployeement
*  PERFORM get_container_preempmnt.
call screen 100.
*endmodule.                 " create_container_pbo_2000  OUTPUT
*&---------------------------------------------------------------------*
*&      Form  get_container_credential
*&---------------------------------------------------------------------*
*  Subroutine to create text container for remarks 
*----------------------------------------------------------------------*
* No interface parameters to this subroutine
*----------------------------------------------------------------------*
form get_container_credential .
  IF obj_cust_cont IS INITIAL.
* To create the object custom container and link to the container on
* screen
    CREATE OBJECT obj_cust_cont
        EXPORTING
            container_name = 'CONT'
        EXCEPTIONS
            cntl_error = 1
            cntl_system_error = 2
            create_error = 3
            lifetime_error = 4
            lifetime_dynpro_dynpro_link = 5.
 
*  To create the a TextEdit Control and link to the custom container
    CREATE OBJECT obj_text_CRED
      EXPORTING
         parent = obj_cust_cont
         wordwrap_mode = cl_gui_textedit=>WORDWRAP_AT_WINDOWBORDER
         wordwrap_to_linebreak_mode = cl_gui_textedit=>true
      EXCEPTIONS
          others = 1.
    IF sy-subrc EQ 0.
* To remove the toolbar
      CALL METHOD obj_text_CRED->set_toolbar_mode
        EXPORTING
          toolbar_mode           = 0
        EXCEPTIONS
          error_cntl_call_method = 1
          invalid_parameter      = 2
          OTHERS                 = 3.
 
* To remove the status bar
      CALL METHOD obj_text_CRED->set_statusbar_mode
        EXPORTING
          statusbar_mode         = 0
        EXCEPTIONS
          error_cntl_call_method = 1
          invalid_parameter      = 2
          OTHERS                 = 3
              .
    ENDIF.                             " IF sy-subrc EQ 0
  ENDIF.                               " IF obj_cust_cont_credential
 
endform.                               " get_container_credential
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module STATUS_0100 output.
  SET PF-STATUS 'ZTEST'.
  SET TITLEBAR 'xxx'.
 
endmodule.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module USER_COMMAND_0100 input.
if sy-ucomm EQ 'BACK'.
  leave to screen 0.
endif.
endmodule.                 " USER_COMMAND_0100  INPUT