Long Text in Module Pool programming



************************************************************************
* Program Name      :  SAPMZRK_MPP10              Object ID:   pa01    *
* Description       :  Long Text in Module pool                        *
* Create Date       :  26.12.2018                                      *
* FO Owner          :  Rohini kuamr                                    *
* Tech Owner        :  Rohini Kumar                                    *
* Project Module    :  SD                                              *
************************************************************************
*                        Change Log                                    *
************************************************************************
*  REQ#         DATE         WHO            CHANGE_ID        DESCR     *
*-----------------------------------------------------------------------
*  001                                                      Initial    *
************************************************************************


INCLUDE mzrk_mpp10top                           .    " global Data

INCLUDE mzrk_mpp10o01                           .  " PBO-Modules
INCLUDE mzrk_mpp10i01                           .  " PAI-Modules
INCLUDE mzrk_mpp10f01                           .  " FORM-Routines

r

PROGRAM  sapmzrk_mpp10.

DATAok_code TYPE sy-ucomm.

DATAline_length       TYPE VALUE 254,
      line              TYPE VALUE 35,
      editor_container  TYPE REF TO cl_gui_custom_container,
      editor_container1 TYPE REF TO cl_gui_custom_container,
      editor_container2 TYPE REF TO cl_gui_custom_container,
      editor_container3 TYPE REF TO cl_gui_custom_container,
      editor_container4 TYPE REF TO cl_gui_custom_container,
      editor_container5 TYPE REF TO cl_gui_custom_container,
      text_editor       TYPE REF TO cl_gui_textedit,
      text_editor1      TYPE REF TO cl_gui_textedit,
      text_editor2      TYPE REF TO cl_gui_textedit,
      text_editor3      TYPE REF TO cl_gui_textedit,
      text_editor4      TYPE REF TO cl_gui_textedit,
      text_editor5      TYPE REF TO cl_gui_textedit,
      lv_length         TYPE i,
      lv_length2        TYPE i,
      lv_length3        TYPE i,
      lv_length4        TYPE i,
      lv_length5        TYPE i,
      lv_length6        TYPE i,
      text              TYPE string,
      text1             TYPE string,
      text2             TYPE string,
      text3             TYPE string,
      text4             TYPE string,
      text5             TYPE string,
      lv_string1        TYPE string,
      lv_string2        TYPE string,
      lv_string3        TYPE string,
      lv_string4        TYPE string,
      lv_string5        TYPE string,
      lv_string6        TYPE string,
      gv_length1         TYPE string,
      gv_length2         TYPE string,
      gv_length3         TYPE string,
      gv_length4         TYPE string,
      gv_length5         TYPE string,
      gv_length6         TYPE string.

*&---------------------------------------------------------------------*
*&  Include           MZRK_MPP10O01
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Module  STATUS_9001  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_9001 OUTPUT.
  SET PF-STATUS 'ZSTATUS'.
  SET TITLEBAR 'ZTITLE'.

  PERFORM first_container.
  PERFORM first_container1.
  PERFORM first_container2.
  PERFORM first_container3.
  PERFORM first_container4.
  PERFORM first_container5.

ENDMODULE.                 " STATUS_9001  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_9001  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_9001 INPUT.
  CASE ok_code.
    WHEN 'BACK' OR 'EXIT' OR 'CANCEL' .
      LEAVE PROGRAM.

    WHEN 'SAVE'.
      PERFORM f_save.
    WHEN 'DISPLAY'.
      PERFORM f_dispaly.
  ENDCASE.

ENDMODULE.                 " USER_COMMAND_9001  INPUT
*&---------------------------------------------------------------------*
*&      Form  GETTEXT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM gettext .
  CALL METHOD text_editor->get_textstream
*  EXPORTING
*    only_when_modified     = FALSE
    IMPORTING
      text                   text
*     is_modified            =
    EXCEPTIONS
      error_cntl_call_method 1
      not_supported_by_gui   2
      OTHERS                 3.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

ENDFORM.                    " GETTEXT
*&---------------------------------------------------------------------*
*&      Form  CLEARTEXT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM cleartext .

  CALL METHOD cl_gui_cfw=>flush
    EXCEPTIONS
      cntl_system_error 1
      cntl_error        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.


ENDFORM.                    " CLEARTEXT
*&---------------------------------------------------------------------*
*&      Form  SETBLANK
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM setblank .
  DATA lv_blank TYPE string.

  CALL METHOD text_editor->set_textstream
    EXPORTING
      text                   lv_blank
    EXCEPTIONS
      error_cntl_call_method 1
      not_supported_by_gui   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.

ENDFORM.                    " SETBLANK
*&---------------------------------------------------------------------*
*&      Form  LENGTHCHECK
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM lengthcheck .
  lv_length strlentext ).
  IF lv_length > 255.
    MESSAGE 'Long Text should be less than 255 no of characters' TYPE 'E'.
    CLEARtext_editor.
  ENDIF.


ENDFORM.                    " LENGTHCHECK
*&---------------------------------------------------------------------*
*&      Form  FIRST_CONTAINER1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM first_container1 .
  IF text_editor1 IS INITIAL .
    CREATE OBJECT editor_container1
      EXPORTING
        container_name              'C2'
      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.

    CREATE OBJECT text_editor1
      EXPORTING
        wordwrap_mode              cl_gui_textedit=>wordwrap_at_fixed_position
        wordwrap_position          line
        wordwrap_to_linebreak_mode cl_gui_textedit=>true
        parent                     editor_container1.
    IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    CALL METHOD text_editor1->set_toolbar_mode
      EXPORTING
        toolbar_mode cl_gui_textedit=>false.

    CALL METHOD text_editor1->set_statusbar_mode
      EXPORTING
        statusbar_mode cl_gui_textedit=>false.
  ENDIF.

ENDFORM.                    " FIRST_CONTAINER1
*&---------------------------------------------------------------------*
*&      Form  FIRST_CONTAINER2
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM first_container2 .
  IF text_editor2 IS INITIAL .
    CREATE OBJECT editor_container2
      EXPORTING
        container_name              'C3'
      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.

    CREATE OBJECT text_editor2
      EXPORTING
        wordwrap_mode              cl_gui_textedit=>wordwrap_at_fixed_position
        wordwrap_position          line
        wordwrap_to_linebreak_mode cl_gui_textedit=>true
        parent                     editor_container2.
    IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    CALL METHOD text_editor2->set_toolbar_mode
      EXPORTING
        toolbar_mode cl_gui_textedit=>false.

    CALL METHOD text_editor2->set_statusbar_mode
      EXPORTING
        statusbar_mode cl_gui_textedit=>false.
  ENDIF.

ENDFORM.                    " FIRST_CONTAINER2
*&---------------------------------------------------------------------*
*&      Form  FIRST_CONTAINER3
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM first_container3 .
  IF text_editor3 IS INITIAL .
    CREATE OBJECT editor_container3
      EXPORTING
        container_name              'C4'
      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.

    CREATE OBJECT text_editor3
      EXPORTING
        wordwrap_mode              cl_gui_textedit=>wordwrap_at_fixed_position
        wordwrap_position          line
        wordwrap_to_linebreak_mode cl_gui_textedit=>true
        parent                     editor_container3.
    IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    CALL METHOD text_editor3->set_toolbar_mode
      EXPORTING
        toolbar_mode cl_gui_textedit=>false.

    CALL METHOD text_editor3->set_statusbar_mode
      EXPORTING
        statusbar_mode cl_gui_textedit=>false.
  ENDIF.

ENDFORM.                    " FIRST_CONTAINER3
*&---------------------------------------------------------------------*
*&      Form  FIRST_CONTAINER4
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM first_container4 .
  IF text_editor4 IS INITIAL .
    CREATE OBJECT editor_container4
      EXPORTING
        container_name              'C5'
      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.

    CREATE OBJECT text_editor4
      EXPORTING
        wordwrap_mode              cl_gui_textedit=>wordwrap_at_fixed_position
        wordwrap_position          line
        wordwrap_to_linebreak_mode cl_gui_textedit=>true
        parent                     editor_container4.
    IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    CALL METHOD text_editor4->set_toolbar_mode
      EXPORTING
        toolbar_mode cl_gui_textedit=>false.

    CALL METHOD text_editor4->set_statusbar_mode
      EXPORTING
        statusbar_mode cl_gui_textedit=>false.
  ENDIF.

ENDFORM.                    " FIRST_CONTAINER4
*&---------------------------------------------------------------------*
*&      Form  FIRST_CONTAINER5
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM first_container5 .
  IF text_editor5 IS INITIAL .
    CREATE OBJECT editor_container5
      EXPORTING
        container_name              'C6'
      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.

    CREATE OBJECT text_editor5
      EXPORTING
        wordwrap_mode              cl_gui_textedit=>wordwrap_at_fixed_position
        wordwrap_position          line
        wordwrap_to_linebreak_mode cl_gui_textedit=>true
        parent                     editor_container5.
    IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    CALL METHOD text_editor5->set_toolbar_mode
      EXPORTING
        toolbar_mode cl_gui_textedit=>false.

    CALL METHOD text_editor5->set_statusbar_mode
      EXPORTING
        statusbar_mode cl_gui_textedit=>false.
  ENDIF.

ENDFORM.                    " FIRST_CONTAINER5
*&---------------------------------------------------------------------*
*&      Form  CLEARTEXT2
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM cleartext2 .
  CALL METHOD cl_gui_cfw=>flush
    EXCEPTIONS
      cntl_system_error 1
      cntl_error        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.
ENDFORM.                    " CLEARTEXT2



*&---------------------------------------------------------------------*
*&  Include           MZRK_MPP10I01
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Form  FIRST_CONTAINER
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM first_container .
  IF text_editor IS INITIAL .
    CREATE OBJECT editor_container
      EXPORTING
        container_name              'C1'
      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.

    CREATE OBJECT text_editor
      EXPORTING
        wordwrap_mode              cl_gui_textedit=>wordwrap_at_fixed_position
        wordwrap_position          line
        wordwrap_to_linebreak_mode cl_gui_textedit=>true
        parent                     editor_container.
    IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    CALL METHOD text_editor->set_toolbar_mode
      EXPORTING
        toolbar_mode cl_gui_textedit=>false.

    CALL METHOD text_editor->set_statusbar_mode
      EXPORTING
        statusbar_mode cl_gui_textedit=>false.
  ENDIF.

ENDFORM.                    " FIRST_CONTAINER
*&---------------------------------------------------------------------*
*&      Form  F_CONTAINER1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_container1 .

  DATAlv_text1 TYPE char256.
  PERFORM gettext.
  PERFORM cleartext.
  PERFORM setblank.
  PERFORM lengthcheck.
  gv_length1  text.


ENDFORM.                    " F_CONTAINER1
*&---------------------------------------------------------------------*
*&      Form  F_CONTAINER2
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_container2 .
  DATAlv_text2 TYPE char256.
  PERFORM gettext1.
  PERFORM cleartext1.
  PERFORM setblank1.
  PERFORM lengthcheck1.
  gv_length2  text1.


ENDFORM.                    " F_CONTAINER2
*&---------------------------------------------------------------------*
*&      Form  GETTEXT1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM gettext1 .
  CALL METHOD text_editor1->get_textstream
*  EXPORTING
*    only_when_modified     = FALSE
    IMPORTING
      text                   text1
*     is_modified            =
    EXCEPTIONS
      error_cntl_call_method 1
      not_supported_by_gui   2
      OTHERS                 3.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

ENDFORM.                    " GETTEXT1
*&---------------------------------------------------------------------*
*&      Form  CLEARTEXT1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM cleartext1 .
  CALL METHOD cl_gui_cfw=>flush
    EXCEPTIONS
      cntl_system_error 1
      cntl_error        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.


ENDFORM.                    " CLEARTEXT1
*&---------------------------------------------------------------------*
*&      Form  SETBLANK1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM setblank1 .
  DATA lv_blank TYPE string.

  CALL METHOD text_editor1->set_textstream
    EXPORTING
      text                   lv_blank
    EXCEPTIONS
      error_cntl_call_method 1
      not_supported_by_gui   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.

ENDFORM.                    " SETBLANK1
*&---------------------------------------------------------------------*
*&      Form  LENGTHCHECK1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM lengthcheck1 .
  lv_length strlentext1 ).
  IF lv_length > 255.
    MESSAGE 'Long Text should be less than 255 no of characters' TYPE 'E'.
    CLEARtext_editor.
  ENDIF.
ENDFORM.                    " LENGTHCHECK1
*&---------------------------------------------------------------------*
*&      Form  F_CONTAINER3
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_container3 .
  DATAlv_text3 TYPE char256.
  PERFORM gettext2.
  PERFORM cleartext2.
  PERFORM setblank2.
  PERFORM lengthcheck2.
  gv_length3  text2.


ENDFORM.                    " F_CONTAINER3
*&---------------------------------------------------------------------*
*&      Form  F_CONTAINER4
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_container4 .
  DATAlv_text4 TYPE char256.
  PERFORM gettext3.
  PERFORM cleartext3.
  PERFORM setblank3.
  PERFORM lengthcheck3.
  gv_length4  text3.

ENDFORM.                    " F_CONTAINER4
*&---------------------------------------------------------------------*
*&      Form  F_CONTAINER5
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_container5 .
  DATAlv_text5 TYPE char256.
  PERFORM gettext4.
  PERFORM cleartext4.
  PERFORM setblank4.
  PERFORM lengthcheck4.
  gv_length5  text4.

ENDFORM.                    " F_CONTAINER5
*&---------------------------------------------------------------------*
*&      Form  GETTEXT2
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM gettext2 .
  CALL METHOD text_editor2->get_textstream
*  EXPORTING
*    only_when_modified     = FALSE
      IMPORTING
        text                   text2
*     is_modified            =
      EXCEPTIONS
        error_cntl_call_method 1
        not_supported_by_gui   2
        OTHERS                 3.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

ENDFORM.                    " GETTEXT2
*&---------------------------------------------------------------------*
*&      Form  SETBLANK2
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM setblank2 .
  DATA lv_blank1 TYPE string.

  CALL METHOD text_editor2->set_textstream
    EXPORTING
      text                   lv_blank1
    EXCEPTIONS
      error_cntl_call_method 1
      not_supported_by_gui   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.
ENDFORM.                    " SETBLANK2
*&---------------------------------------------------------------------*
*&      Form  LENGTHCHECK2
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM lengthcheck2 .
  lv_length strlentext2 ).
  IF lv_length > 255.
    MESSAGE 'Long Text should be less than 255 no of characters' TYPE 'E'.
    CLEARtext_editor.
  ENDIF.

ENDFORM.                    " LENGTHCHECK2
*&---------------------------------------------------------------------*
*&      Form  GETTEXT3
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM gettext3 .
  CALL METHOD text_editor3->get_textstream
*  EXPORTING
*    only_when_modified     = FALSE
      IMPORTING
        text                   text3
*     is_modified            =
      EXCEPTIONS
        error_cntl_call_method 1
        not_supported_by_gui   2
        OTHERS                 3.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

ENDFORM.                    " GETTEXT3
*&---------------------------------------------------------------------*
*&      Form  CLEARTEXT3
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM cleartext3 .
  CALL METHOD cl_gui_cfw=>flush
    EXCEPTIONS
      cntl_system_error 1
      cntl_error        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.

ENDFORM.                    " CLEARTEXT3
*&---------------------------------------------------------------------*
*&      Form  SETBLANK3
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM setblank3 .
  DATA lv_blank2 TYPE string.

  CALL METHOD text_editor3->set_textstream
    EXPORTING
      text                   lv_blank2
    EXCEPTIONS
      error_cntl_call_method 1
      not_supported_by_gui   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.

ENDFORM.                    " SETBLANK3
*&---------------------------------------------------------------------*
*&      Form  LENGTHCHECK3
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM lengthcheck3 .
  lv_length strlentext3 ).
  IF lv_length > 255.
    MESSAGE 'Long Text should be less than 255 no of characters' TYPE 'E'.
    CLEARtext_editor.
  ENDIF.

ENDFORM.                    " LENGTHCHECK3
*&---------------------------------------------------------------------*
*&      Form  GETTEXT4
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM gettext4 .
  CALL METHOD text_editor4->get_textstream
*  EXPORTING
*    only_when_modified     = FALSE
      IMPORTING
        text                   text4
*     is_modified            =
      EXCEPTIONS
        error_cntl_call_method 1
        not_supported_by_gui   2
        OTHERS                 3.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

ENDFORM.                    " GETTEXT4
*&---------------------------------------------------------------------*
*&      Form  CLEARTEXT4
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM cleartext4 .
  CALL METHOD cl_gui_cfw=>flush
    EXCEPTIONS
      cntl_system_error 1
      cntl_error        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.
ENDFORM.                    " CLEARTEXT4
*&---------------------------------------------------------------------*
*&      Form  SETBLANK4
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM setblank4 .
  DATA lv_blank3 TYPE string.

  CALL METHOD text_editor4->set_textstream
    EXPORTING
      text                   lv_blank3
    EXCEPTIONS
      error_cntl_call_method 1
      not_supported_by_gui   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.

ENDFORM.                    " SETBLANK4
*&---------------------------------------------------------------------*
*&      Form  LENGTHCHECK4
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM lengthcheck4 .
  lv_length strlentext4 ).
  IF lv_length > 255.
    MESSAGE 'Long Text should be less than 255 no of characters' TYPE 'E'.
    CLEARtext_editor.
  ENDIF.

ENDFORM.                    " LENGTHCHECK4
*&---------------------------------------------------------------------*
*&      Form  GETTEXT5
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM gettext5 .
  CALL METHOD text_editor5->get_textstream
*  EXPORTING
*    only_when_modified     = FALSE
      IMPORTING
        text                   text5
*     is_modified            =
      EXCEPTIONS
        error_cntl_call_method 1
        not_supported_by_gui   2
        OTHERS                 3.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.


ENDFORM.                    " GETTEXT5
*&---------------------------------------------------------------------*
*&      Form  CLEARTEXT5
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM cleartext5 .
  CALL METHOD cl_gui_cfw=>flush
    EXCEPTIONS
      cntl_system_error 1
      cntl_error        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.

ENDFORM.                    " CLEARTEXT5
*&---------------------------------------------------------------------*
*&      Form  SETBLANK5
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM setblank5 .
  DATA lv_blank4 TYPE string.

  CALL METHOD text_editor5->set_textstream
    EXPORTING
      text                   lv_blank4
    EXCEPTIONS
      error_cntl_call_method 1
      not_supported_by_gui   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.
ENDFORM.                    " SETBLANK5
*&---------------------------------------------------------------------*
*&      Form  LENGTHCHECK5
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM lengthcheck5 .
  lv_length strlentext5 ).
  IF lv_length > 255.
    MESSAGE 'Long Text should be less than 255 no of characters' TYPE 'E'.
    CLEARtext_editor.
  ENDIF.

ENDFORM.                    " LENGTHCHECK5
*&---------------------------------------------------------------------*
*&      Form  F_SAVE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_save .
  PERFORM f_container1.
  PERFORM f_container2.
  PERFORM f_container3.
  PERFORM f_container4.
  PERFORM f_container5.
  PERFORM f_container6.
  PERFORM f_number_range.
ENDFORM.                    " F_SAVE
*&---------------------------------------------------------------------*
*&      Form  F_NUMBER_RANGE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_number_range .
  IF gv_length1  IS NOT INITIAL  AND gv_length2 IS NOT INITIAL
  AND gv_length3 IS NOT INITIAL AND gv_length4 IS NOT INITIAL
  AND gv_length5 IS NOT INITIAL AND gv_length6 IS NOT INITIAL.
    DATAnumber TYPE int2.
    CALL FUNCTION 'NUMBER_GET_NEXT'
      EXPORTING
        nr_range_nr             '01'
        object                  'ZRK_TEXT'
*       QUANTITY                = '1'
*       SUBOBJECT               = ' '
*       TOYEAR                  = '0000'
*       IGNORE_BUFFER           = ' '
      IMPORTING
        number                  number
*       QUANTITY                =
*       RETURNCODE              =
      EXCEPTIONS
        interval_not_found      1
        number_range_not_intern 2
        object_not_found        3
        quantity_is_0           4
        quantity_is_not_1       5
        interval_overflow       6
        buffer_overflow         7
        OTHERS                  8.
    IF sy-subrc <> 0.
* Implement suitable error handling here
    ENDIF.
    IF number IS NOT INITIAL.
      DATAlv_table TYPE ztext_table.
      lv_table-znumber    number.
      lv_table-gv_length1 gv_length1.
      lv_table-gv_length2 gv_length2.
      lv_table-gv_length3 gv_length3.
      lv_table-gv_length4 gv_length4.
      lv_table-gv_length5 gv_length5.
      lv_table-gv_length6 gv_length6.

      INSERT ztext_table FROM lv_table.
      IF sy-subrc EQ 0.
        MESSAGE 'Records insert Sucessfully' TYPE 'I'.
      ELSE.
        MESSAGE 'Probles inserting records' TYPE 'E'.
      ENDIF.
    ENDIF.
  ELSE.
    MESSAGE 'Plese fill all long text' TYPE 'E'.
  ENDIF.
ENDFORM.                    " F_NUMBER_RANGE
*&---------------------------------------------------------------------*
*&      Form  F_DISPALY
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_dispaly .
  DATAlv_dispaly TYPE string.
  lv_dispaly 'Dispaly text'.
  CALL METHOD text_editor1->get_textstream
*  EXPORTING
*    only_when_modified     = FALSE
     IMPORTING
       text                   lv_dispaly
*     is_modified            =
     EXCEPTIONS
       error_cntl_call_method 1
       not_supported_by_gui   2
       OTHERS                 3.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.
ENDFORM.                    " F_DISPALY




*----------------------------------------------------------------------*
FORM f_container6 .
  DATAlv_text6 TYPE char256.
  PERFORM gettext5.
  PERFORM cleartext5.
  PERFORM setblank5.
  PERFORM lengthcheck5.
  gv_length6  text5.

ENDFORM.    







Comments

Popular posts from this blog

all user exit mv45afzz (implicit user exit )

How to Give Dropdown in alv report in sap abap programming Language

Long Text in input and output field in module pool