cancel
Showing results for 
Search instead for 
Did you mean: 

Text editor

Former Member
0 Kudos

Dear All,

Could you tell me how I can realize the text editor on the screen? I must afford an opportunity for user input a long text and then save into field ANY_TXT(1024).

Thanks a lot.

Best regards,

Igor

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member188685
Active Contributor
0 Kudos

hi You Need to Use controls to acheive .

create custom container in screen and handle in the as following way

*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*  populate the custom control table
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.

data:l_zzproject_nbr1 like vbak-zzproject_nbr,
     tcode like sy-tcode.
  CLEAR: w_status,it_menu,it_menu[],i_status.

progname = sy-repid.
dynnum   = sy-dynnr.

*tcode = 'VA02'.
*call 'AUTH_CHECK_TCODE'
*     id 'TCODE' field tcode.



  AUTHORITY-CHECK OBJECT 'V_VBAK_AAT'
              ID 'ACTVT' FIELD '02'
              ID 'AUART' DUMMY.
  IF SY-SUBRC <> 0.
      MESSAGE e002(zz) WITH
          'You do not have authorization to run this program.'.
  ENDIF.

  MOVE 'SAVE_PROJ' TO w_status-fcode.
  APPEND w_status TO i_status.
  CLEAR w_status.
* Reset button has been adviced to remove
  MOVE 'RENAME' TO w_status-fcode.
  APPEND w_status TO i_status.
  CLEAR w_status.
*-Delete button added
  MOVE 'DELETE' TO w_status-fcode.
  APPEND w_status TO i_status.
  CLEAR w_status.
*-Reset
  MOVE 'RESET' TO w_status-fcode.
  APPEND w_status TO i_status.
  CLEAR w_status.

  SET TITLEBAR 'TITLE'.
*-This logic is to set the application toolbar according to the
*-contents of the various fields in the screen
  IF v_zzproject_nbr IS INITIAL.
    SET PF-STATUS 'ZVPM_MENU1' EXCLUDING i_status.
  ELSE.
     if not i_vbak[] is initial.
      select  vbeln
              zzproject_nbr
        into  table it_menu
        from  vbak
         for  all entries in i_vbak
       where  vbeln = i_vbak-vbeln.
      endif.

   if not it_menu[] is initial.
       sort it_menu by vbeln zzproject_nbr.
       read table it_menu with key zzproject_nbr = v_zzproject_nbr
               binary search transporting zzproject_nbr.
       if it_menu-zzproject_nbr = v_zzproject_nbr.
        SET PF-STATUS 'ZVPM_MENU1'.
       else.
        DELETE I_STATUS WHERE FCODE = 'SAVE_PROJ'.
        DELETE I_STATUS WHERE FCODE = 'RESET'.
        SET PF-STATUS 'ZVPM_MENU1' EXCLUDING i_status.
       endif.
    else.
      DELETE I_STATUS WHERE FCODE = 'SAVE_PROJ'.
      DELETE I_STATUS WHERE FCODE = 'RESET'.
      SET PF-STATUS 'ZVPM_MENU1' EXCLUDING i_status.
    endif.
    endif.
  CLEAR v_comm .
* Check whether the project nbr is initial
  IF NOT v_zzproject_nbr IS INITIAL.
    v_prev_projectid_nbr = v_zzproject_nbr.
  ENDIF.
  IF v_zzproject_nbr IS INITIAL.
    LOOP AT SCREEN.
      IF screen-group1 = 'GP1'.
        screen-active = '0'.
        MODIFY SCREEN.
      ENDIF.
      if screen-name = 'V_EXPNR'.
        screen-input = '0'.
        MODIFY SCREEN.
      endif.
      IF screen-name = 'V_ZZPROJECT_DESC'.
        screen-input  = '0'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
   ELSE.
    LOOP AT SCREEN.
       IF SCREEN-NAME = 'V_ZZPROJECT_NBR'.
        SCREEN-INPUT = '0'.
       MODIFY SCREEN.
       ENDIF.
      ENDLOOP.
  ENDIF.
* The below perform is used to get the project notes text in the
* custom control text edit

  IF editor IS INITIAL.
    repid = sy-repid.
    CREATE OBJECT textedit_custom_container
        EXPORTING
            container_name = 'TEXTEDITOR1'
        EXCEPTIONS
            cntl_error = 1
            cntl_system_error = 2
            create_error = 3
            lifetime_error = 4
            lifetime_dynpro_dynpro_link = 5.
    IF sy-subrc NE 0.
*      add your handling
    ENDIF.

    CREATE OBJECT editor
      EXPORTING
         parent = textedit_custom_container
         wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
         wordwrap_to_linebreak_mode = cl_gui_textedit=>true
      EXCEPTIONS
          others = 1.
    IF sy-subrc NE 0.

    ENDIF.

  ENDIF.                               " Editor is initial
* initially flush
  CALL METHOD cl_gui_cfw=>flush
         EXCEPTIONS
           OTHERS = 1.
  IF sy-subrc NE 0.

  ENDIF.

  IF v_zzproject_nbr IS INITIAL.

    CALL METHOD editor->set_readonly_mode
        EXPORTING
             readonly_mode = 1
         EXCEPTIONS
           error_cntl_call_method = 1
           invalid_parameter = 2
           OTHERS = 3.

  else.

    CALL METHOD editor->set_readonly_mode
EXPORTING
     readonly_mode = 0
 EXCEPTIONS
   error_cntl_call_method = 1
   invalid_parameter = 2
   OTHERS = 3.

  ENDIF.

* finally flush
  CALL METHOD cl_gui_cfw=>flush
         EXCEPTIONS
           OTHERS = 1.
  IF sy-subrc NE 0.
*    CALL FUNCTION 'POPUP_TO_INFORM'
*         EXPORTING
*              titel = repid
*              txt2  = space
*              txt1  = text-004.
  ENDIF.



  IF NOT i_vbak[] IS INITIAL.
    i_tcdata[] = i_vbak[].
  ENDIF.
ENDMODULE.                 " STATUS_0100  OUTPUT

Reagrds

vijay

Message was edited by: Vijay Babu Dudla

Former Member
0 Kudos

Hi,

There will be some button which named "Long text" which you can click on it and type in the long text that you require. Please find for those button inside the tcode.

Thanks.

kanthimathikris
Employee
Employee
0 Kudos

Just a suggestion.

Why not to have nearly 6 to 7 parameters under 1 name & concatenate and place the value in the field any_txt.

P.S : A parameter can support a maximum of 132 characters

Former Member
0 Kudos

Hello Igor,

You can refer search this forum for some examples. Rich Heilman has given the sample program. Here's the .

Regards,

Anand Mandalika.