Skip to Content
0
Former Member
Oct 15, 2009 at 09:07 AM

CL_GUI_TEXTEDIT refresh problem

86 Views

Dear Gurus ,

I made a custom screen that has 3 texteditor controls . The screen works fine but the one problem that i have is the below :

I have 2 kind of users: Full user - Particiopant user

When i load the screen at the first time all the controls are editable .

When i choose the the participant user i want the texteditor controls to be in readonly mode.

So i do the following :

IF PARTICIPANTS = 'X'.

    CALL METHOD G_EDITOR_1->SET_READONLY_MODE
        EXPORTING
          READONLY_MODE          = '1'
        EXCEPTIONS
          ERROR_CNTL_CALL_METHOD = 1
          INVALID_PARAMETER      = 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 i change the user to full can't change !!!!!!

Look the problem in steps:

1. load the screen in editable mode

2. changing the controls to readonly ok

3. changing to editble false

Only one time i can change the screen control !!!!

look my code ...



  IF G_EDITOR_1 IS INITIAL.

*   initilize local variable with sy-repid, since sy-repid doesn't work
*    as parameter directly.
    G_REPID = SY-REPID.

*   create control container
    CREATE OBJECT G_EDITOR_CONTAINER_1
        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 G_EDITOR_CONTAINER_2
        EXPORTING
            CONTAINER_NAME = 'TEXTEDITOR2'
        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 G_EDITOR_CONTAINER_5
        EXPORTING
            CONTAINER_NAME = 'TEXTEDITOR5'
        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 calls constructor, which initializes, creats and links
*    a TextEdit Control
    CREATE OBJECT G_EDITOR_1
      EXPORTING
         PARENT = G_EDITOR_CONTAINER_1
         WORDWRAP_MODE = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION
         WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>TRUE
         WORDWRAP_POSITION          = 65
      EXCEPTIONS
          OTHERS = 1.
    IF SY-SUBRC NE 0.
      CALL FUNCTION 'POPUP_TO_INFORM'
        EXPORTING
          TITEL = G_REPID
          TXT2  = SPACE
          TXT1  = TEXT-001.
    ENDIF.

    CREATE OBJECT G_EDITOR_2
      EXPORTING
         PARENT = G_EDITOR_CONTAINER_2
         WORDWRAP_MODE = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION
         WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>TRUE
         WORDWRAP_POSITION          = 65
      EXCEPTIONS
          OTHERS = 1.
    IF SY-SUBRC NE 0.
      CALL FUNCTION 'POPUP_TO_INFORM'
        EXPORTING
          TITEL = G_REPID
          TXT2  = SPACE
          TXT1  = TEXT-001.
    ENDIF.

    CREATE OBJECT G_EDITOR_5
      EXPORTING
         PARENT = G_EDITOR_CONTAINER_5
         WORDWRAP_MODE = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION
         WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>TRUE
         WORDWRAP_POSITION          = 65
      EXCEPTIONS
          OTHERS = 1.
    IF SY-SUBRC NE 0.
      CALL FUNCTION 'POPUP_TO_INFORM'
        EXPORTING
          TITEL = G_REPID
          TXT2  = SPACE
          TXT1  = TEXT-001.
    ENDIF.

  ENDIF.


   IF PARTICIPANTS = 'X'.

    CALL METHOD G_EDITOR_1->SET_READONLY_MODE
        EXPORTING
          READONLY_MODE          = '1'
        EXCEPTIONS
          ERROR_CNTL_CALL_METHOD = 1
          INVALID_PARAMETER      = 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.