Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Protect text lines in long text editor

$
0
0

Hi,

  In the long text editor I want to protect some text line for editing, but it is not allowing to enter any new lines in the editor.

 

 

         CALL METHOD text_editor->set_text_as_r3table
         EXPORTING
           table           =  GT_ELINES
         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.

   CLEAR : GV_LINE.
   APPEND GV_LINE TO GT_ELINES.
   DESCRIBE TABLE GT_ELINES LINES GV_TABIX.     "GV_ILINE.

  GV_ILINE = GV_TABIX - 1.
  CALL METHOD text_editor->SELECT_LINES
      EXPORTING
      FROM_LINE = 1
      TO_LINE   = GV_ILINE.

   CALL METHOD text_editor->PROTECT_SELECTION
      EXPORTING
      PROTECT_MODE = 1
      ENABLE_EDITING_PROTECTED_TEXT = 1.

   GV_TABIX1 = GV_TABIX.  " + 1.
   GV_TABIX2 = GV_TABIX1.

  CALL METHOD text_editor->SELECT_LINES
    EXPORTING
     FROM_LINE = GV_TABIX1
       TO_LINE = GV_TABIX2.

CALL METHOD text_editor->PROTECT_SELECTION
    EXPORTING
    PROTECT_MODE = 0
    ENABLE_EDITING_PROTECTED_TEXT = 0.

  CALL METHOD text_editor->SET_SELECTION_POS
    EXPORTING
      FROM_LINE = 0       " YOCX_TEXT-FROM_LINE
      FROM_POS  = 0       " YOCX_TEXT-FROM_POS
      TO_LINE   = 0       " YOCX_TEXT-TO_LINE
      TO_POS    = 0.      " YOCX_TEXT-TO_POS.

  CALL METHOD cl_gui_cfw=>flush.

 

 

regards,

zafar


Viewing all articles
Browse latest Browse all 8332

Trending Articles