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

Multi-line edit component

darren_bambrick2
Active Participant
0 Likes
617

Hi All

I have a requirement to create a transaction that has an area that I can enter multiple lines of text, similar to note entry on materials and vendors.

Does anyone know of a class or code that will allow me to do this.

Thanks

Darren

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
527

in the Global Data area


CONSTANTS: line_length   TYPE i VALUE 100.
TYPES: BEGIN OF scr_text_line,
         line(line_length) TYPE c,
       END OF scr_text_line.

DATA:
      wa_pi_text  TYPE scr_text_line,
      it_pi_text  LIKE STANDARD TABLE OF wa_pi_text,

      g_editor4 TYPE REF TO cl_gui_textedit,
      g_custom_container4 TYPE REF TO cl_gui_custom_container,

in the PBO


  PERFORM initialize_text_editor_0101.
  PERFORM set_text_in_editor_0101.


*&---------------------------------------------------------------------*
*&      Form  initialize_text_editor_0101
*&---------------------------------------------------------------------*
FORM initialize_text_editor_0101.
  IF g_editor4 IS INITIAL.
    repid = sy-repid.
    CREATE OBJECT g_custom_container4
       EXPORTING
          container_name = '0101_SCR_CONTAINER'   "<== Custom Container on Screen
       EXCEPTIONS
          cntl_error = 1
          cntl_system_error = 2
          create_error = 3
          lifetime_error = 4
          lifetime_dynpro_dynpro_link = 5.

    CREATE OBJECT g_editor4
       EXPORTING
          parent = g_custom_container4
          wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
          wordwrap_position = line_length
          wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
    CALL METHOD g_editor4->set_statusbar_mode
      EXPORTING
        statusbar_mode = 0.
    CALL METHOD g_editor4->set_toolbar_mode
      EXPORTING
        toolbar_mode = 0.

  ENDIF.                "editor is initial
ENDFORM.                    " initialize_text_editor_0101
*&---------------------------------------------------------------------*
*&      Form  set_text_in_editor_0101
*&---------------------------------------------------------------------*
FORM set_text_in_editor_0101.
  CALL METHOD g_editor4->set_text_as_r3table
    EXPORTING table = it_pi_text
       EXCEPTIONS
           OTHERS = 1.

  IF sy-subrc NE 0.
    MESSAGE i015 WITH
     repid 'Error in set_text_as_r3table'.
  ENDIF.
  CALL METHOD cl_gui_cfw=>flush.
  IF sy-subrc NE 0.
    MESSAGE i015 WITH
     repid 'set_text_as_r3table: Error in FLUSH'.
  ENDIF.
ENDFORM.                    " set_text_in_editor_0101

In the PAI Routine


  MODULE text_editor_retrieve_0101.

that module


*&---------------------------------------------------------------------*
*&      Module  text_editor_retrieve_0101  INPUT
*&---------------------------------------------------------------------*
MODULE text_editor_retrieve_0101 INPUT.
  PERFORM text_editor_retrieve_0101.
ENDMODULE.                 " text_editor_retrieve_0101  INPUT
*---------------------------------------------------------------------*
*       FORM text_editor_retrieve_0101                                *
*---------------------------------------------------------------------*
FORM text_editor_retrieve_0101.
  CHECK NOT g_editor4 IS INITIAL.
  CALL METHOD g_editor4->get_text_as_r3table
    IMPORTING table = it_pi_text
       EXCEPTIONS
           OTHERS = 1.

  IF sy-subrc NE 0.
    MESSAGE i015 WITH
     repid 'Error in get_text_as_r3table'.
  ENDIF.

  CALL METHOD cl_gui_cfw=>flush.
  IF sy-subrc NE 0.
    MESSAGE i015 WITH
     repid 'get_text_as_r3table: Error in FLUSH'.
  ENDIF.
ENDFORM.

3 REPLIES 3
Read only

Former Member
0 Likes
527

U can try with a table control in a subscreen..

use the wizard in dynpro editor

Read only

Former Member
0 Likes
528

in the Global Data area


CONSTANTS: line_length   TYPE i VALUE 100.
TYPES: BEGIN OF scr_text_line,
         line(line_length) TYPE c,
       END OF scr_text_line.

DATA:
      wa_pi_text  TYPE scr_text_line,
      it_pi_text  LIKE STANDARD TABLE OF wa_pi_text,

      g_editor4 TYPE REF TO cl_gui_textedit,
      g_custom_container4 TYPE REF TO cl_gui_custom_container,

in the PBO


  PERFORM initialize_text_editor_0101.
  PERFORM set_text_in_editor_0101.


*&---------------------------------------------------------------------*
*&      Form  initialize_text_editor_0101
*&---------------------------------------------------------------------*
FORM initialize_text_editor_0101.
  IF g_editor4 IS INITIAL.
    repid = sy-repid.
    CREATE OBJECT g_custom_container4
       EXPORTING
          container_name = '0101_SCR_CONTAINER'   "<== Custom Container on Screen
       EXCEPTIONS
          cntl_error = 1
          cntl_system_error = 2
          create_error = 3
          lifetime_error = 4
          lifetime_dynpro_dynpro_link = 5.

    CREATE OBJECT g_editor4
       EXPORTING
          parent = g_custom_container4
          wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
          wordwrap_position = line_length
          wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
    CALL METHOD g_editor4->set_statusbar_mode
      EXPORTING
        statusbar_mode = 0.
    CALL METHOD g_editor4->set_toolbar_mode
      EXPORTING
        toolbar_mode = 0.

  ENDIF.                "editor is initial
ENDFORM.                    " initialize_text_editor_0101
*&---------------------------------------------------------------------*
*&      Form  set_text_in_editor_0101
*&---------------------------------------------------------------------*
FORM set_text_in_editor_0101.
  CALL METHOD g_editor4->set_text_as_r3table
    EXPORTING table = it_pi_text
       EXCEPTIONS
           OTHERS = 1.

  IF sy-subrc NE 0.
    MESSAGE i015 WITH
     repid 'Error in set_text_as_r3table'.
  ENDIF.
  CALL METHOD cl_gui_cfw=>flush.
  IF sy-subrc NE 0.
    MESSAGE i015 WITH
     repid 'set_text_as_r3table: Error in FLUSH'.
  ENDIF.
ENDFORM.                    " set_text_in_editor_0101

In the PAI Routine


  MODULE text_editor_retrieve_0101.

that module


*&---------------------------------------------------------------------*
*&      Module  text_editor_retrieve_0101  INPUT
*&---------------------------------------------------------------------*
MODULE text_editor_retrieve_0101 INPUT.
  PERFORM text_editor_retrieve_0101.
ENDMODULE.                 " text_editor_retrieve_0101  INPUT
*---------------------------------------------------------------------*
*       FORM text_editor_retrieve_0101                                *
*---------------------------------------------------------------------*
FORM text_editor_retrieve_0101.
  CHECK NOT g_editor4 IS INITIAL.
  CALL METHOD g_editor4->get_text_as_r3table
    IMPORTING table = it_pi_text
       EXCEPTIONS
           OTHERS = 1.

  IF sy-subrc NE 0.
    MESSAGE i015 WITH
     repid 'Error in get_text_as_r3table'.
  ENDIF.

  CALL METHOD cl_gui_cfw=>flush.
  IF sy-subrc NE 0.
    MESSAGE i015 WITH
     repid 'get_text_as_r3table: Error in FLUSH'.
  ENDIF.
ENDFORM.

Read only

darren_bambrick2
Active Participant
0 Likes
527

Thanks for the respones,

Pauls suggestion works perfectly for what I need, do I am awarding the points to him

Thanks again