Skip to Content
avatar image
Former Member

Text editor in module pool

Hi Frds,

I have Scenario where enduser have to enter text of maximum length(sometimes 1000 characters)in module pool and save that text in the data base.

is it possible to save this data ?or there is any othe way for solving this problem

PLZ help me with exact scenario

Txn in advance

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Oct 17, 2008 at 05:45 AM

    hai,

    refer this demo program here they have used text box ...

    RSDEMO_DRAG_DROP_EDIT_TREE

    DATA editor TYPE REF TO cl_gui_textedit.

    CREATE OBJECT container

    EXPORTING container_name = 'CONTAINER'.

    CREATE OBJECT editor

    EXPORTING parent = container.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 17, 2008 at 05:47 AM

    yes it is possible

    in module pool screen place a input filed and one pushbutton (SAVE) .

    in program write a logic

    case sy-ucomm.
    
    when 'S'.
    update ztable from (workarea) or (table)
    
    endcase

    Revert back for any query regarding this

    Edited by: srinivasu bv on Oct 17, 2008 7:47 AM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 17, 2008 at 05:52 AM

    Dear Pranu,

    It is possible when u wil save this text in ztable .and u take one field as STRING or normally CHAR. and save u r data in zatable.

    ansd if u want save this field in standard table thn 1st u append u r field in standar table using append structure. and thn save this data.

    regards,

    Nikhil.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 17, 2008 at 05:55 AM

    Checkout the below code for Text Editor in Module Pool :

                                                                                    REPORT zdemo_editor .
    
    * Declarations *****************************************************
    
    DATA: ok_code LIKE sy-ucomm,
          save_ok LIKE sy-ucomm.
    
    DATA: init,
          container TYPE REF TO cl_gui_custom_container,
          editor    TYPE REF TO cl_gui_textedit.
    
    TYPES:
    *      Messages
         BEGIN OF lt_line,
          line(256) TYPE c,    "Line
         END OF   lt_line.
    
    DATA:
    *line(256) TYPE c,
          text_tab TYPE TABLE OF lt_line,
          ls_tab   TYPE lt_line,
          lv_mode  TYPE i.
    *      field LIKE line.
    
    * Reporting Events ***************************************************
    
    START-OF-SELECTION.
    
      CALL SCREEN 100.
    
    * Dialog Modules *****************************************************
    
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
      IF init IS INITIAL.
        lv_mode = 1.
        init = 'X'.
        CREATE OBJECT: container EXPORTING container_name = 'TEXTEDIT',
                       editor    EXPORTING parent = container.
    
    
        CALL METHOD editor->set_readonly_mode
          EXPORTING
            readonly_mode          = lv_mode
          EXCEPTIONS
            error_cntl_call_method = 1
            OTHERS                 = 2.
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        CLEAR: lv_mode.
      ENDIF.
    ENDMODULE.                    "status_0100 OUTPUT
    
    *----------------------------------------------------------------------*
    *  MODULE cancel INPUT
    *----------------------------------------------------------------------*
    *
    *----------------------------------------------------------------------*
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.                    "cancel INPUT
    
    *----------------------------------------------------------------------*
    *  MODULE user_command_0100 INPUT
    *----------------------------------------------------------------------*
    *
    *----------------------------------------------------------------------*
    *MODULE user_command_0100 INPUT.
    *  DATA: lv_text(256) TYPE c,             "string,
    **        lv_mode2 type i,
    **        lv_mode1 type i,
    *       lit_lines      TYPE TABLE OF tline,
    *       ls_lines       TYPE tline.
    *
    *  save_ok = ok_code.
    *  CLEAR ok_code.
    *  CASE save_ok.
    *    WHEN 'SAVE'.
    *lv_mode2 = 1.
    *lv_mode1 = 0.
    *
    *CALL METHOD editor->get_textstream
    *  EXPORTING
    *    only_when_modified     = lv_mode2
    *  IMPORTING
    *    text                   = lv_text
    *    is_modified           = lv_mode1
    *  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.
    
    
    *      CALL METHOD editor->get_text_as_stream
    *        IMPORTING
    *          text = text_tab.
    *
    *      LOOP AT text_tab INTO ls_tab.
    *        CONCATENATE lv_text ls_tab-line INTO lv_text SEPARATED BY space.
    *      ENDLOOP.
    *
    *      PERFORM save_text USING lv_text.    "TABLES ext_tab.
    *
    *
    *
    *    WHEN 'READ'.
    *
    *      CALL FUNCTION 'READ_TEXT'
    *        EXPORTING
    *          id                      = '0001'
    *          language                = sy-langu
    *          name                    = '0000002400'
    *          object                  = 'KNA1'
    *        TABLES
    *          lines                   = lit_lines
    *        EXCEPTIONS
    *          id                      = 1
    *          language                = 2
    *          name                    = 3
    *          not_found               = 4
    *          object                  = 5
    *          reference_check         = 6
    *          wrong_access_to_archive = 7
    *          OTHERS                  = 8.
    *      IF sy-subrc <> 0.
    ** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    **         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *      ENDIF.
    *
    *      text_tab = lit_lines.
    *
    *
    *
    *      CALL METHOD editor->set_text_as_stream
    *        EXPORTING
    *          text            = text_tab
    *        EXCEPTIONS
    *          error_dp        = 1
    *          error_dp_create = 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.
    *
    *    WHEN 'UPDATE'.
    *      lv_mode = 0.
    *      CALL METHOD editor->set_readonly_mode
    *        EXPORTING
    *          readonly_mode          = lv_mode
    *        EXCEPTIONS
    *          error_cntl_call_method = 1
    *          OTHERS                 = 2.
    *      IF sy-subrc <> 0.
    ** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    **            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *      ENDIF.
    *      CLEAR: lv_mode.
    *
    *  ENDCASE.
    *  SET SCREEN 100.
    *ENDMODULE.                    "user_command_0100 INPUT
    *
    **&---------------------------------------------------------------------*
    **&      Form  SAVE_TEXT
    **&---------------------------------------------------------------------*
    **       text
    **----------------------------------------------------------------------*
    *FORM save_text USING pv_text TYPE any.
    *
    *  DATA: ls_header TYPE thead.
    *
    *  TYPES:
    **      Messages
    *       BEGIN OF lt_mess,
    *        line(70) TYPE c,    "Line
    *       END OF   lt_mess.
    *
    *  DATA:
    *       lit_mess       TYPE TABLE OF lt_mess,
    *       lit_mess1      TYPE TABLE OF lt_mess,
    *       lit_lines      TYPE TABLE OF tline,
    *       ls_lines       TYPE tline,
    *       lv_flag        TYPE c,
    *       ls_mess        TYPE lt_mess,
    *       ls_mess1       TYPE lt_mess,
    *       lv_line        TYPE lt_mess-line,
    *       lv_fixedline   TYPE lt_mess-line.
    *
    *
    *  ls_header-tdid     = '0001'.
    *  ls_header-tdspras  = sy-langu.
    *  ls_header-tdname   = '0000002400'.
    *  ls_header-tdobject = 'KNA1'.
    *
    ** Split the message
    *  CLEAR: lit_mess1,
    *         lv_flag,
    *         lv_line,
    *         lv_fixedline.
    *
    *  SPLIT pv_text AT space INTO TABLE lit_mess.
    *
    *  LOOP AT lit_mess INTO ls_mess.
    *
    *    CONCATENATE lv_line ls_mess-line INTO lv_line SEPARATED BY space.
    *    AT FIRST.
    *      SHIFT lv_line BY 1 PLACES LEFT.
    *    ENDAT.
    *
    *    IF sy-subrc EQ 0.
    *      lv_fixedline = lv_line.
    *      lv_flag = 'X'.
    *    ELSE.
    *      APPEND lv_fixedline TO lit_mess1.
    *
    *      CLEAR : lv_line,
    *              lv_flag.
    *
    *      CONCATENATE lv_line ls_mess-line INTO lv_line.
    *      lv_fixedline = lv_line.
    *      lv_flag = 'X'.
    *    ENDIF.
    *  ENDLOOP.                "message
    *
    *  IF lv_flag = 'X'.
    *    APPEND lv_fixedline TO lit_mess1.
    *  ENDIF.
    *
    *  LOOP AT lit_mess1 INTO ls_mess1.
    *    ls_lines-tdline  = ls_mess1-line.
    *    APPEND ls_lines TO lit_lines.
    *  ENDLOOP.
    *
    *  CALL FUNCTION 'SAVE_TEXT'
    *    EXPORTING
    *     client                = sy-mandt
    *      header               = ls_header
    **   insert                  = 'X'
    *   savemode_direct         = 'X'
    *    TABLES
    *      lines                 = lit_lines
    ** EXCEPTIONS
    **   ID                    = 1
    **   LANGUAGE              = 2
    **   NAME                  = 3
    **   OBJECT                = 4
    **   OTHERS                = 5
    *            .
    *  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.                    " SAVE_TEXT
    

    Add comment
    10|10000 characters needed characters exceeded