Skip to Content
0
Former Member
Jul 31, 2008 at 09:43 AM

Problem in TextEditor Control

106 Views

Hi,

I created a text editor control (CL_GUI_TEXTEDITOR). I am filling text from an internal table. This text displays correctly. But after that, when I use the instance method GET_LINE_COUNT, which is supposed to give me the number of lines displayed by the editor, it returns 0 (initial value).

Please take some time to go through the following code.

PARAMETERS P_PROG TYPE PROGRAMM.

DATA: R_CCONT TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
      R_TEDIT TYPE REF TO CL_GUI_TEXTEDIT,
      REPID TYPE SY-REPID,
      CHMOD_FLAG TYPE C VALUE ' '.

DATA: COUNT TYPE  I.

DATA: CODELINE TYPE C LENGTH 72,
      CODETAB LIKE TABLE OF CODELINE.

START-OF-SELECTION.
  READ REPORT P_PROG INTO CODETAB.
  IF SY-SUBRC = 0.
    REPID = SY-REPID.

    CREATE OBJECT R_CCONT
      EXPORTING
        CONTAINER_NAME              = 'MYCONTAINER'   "container area defined in screen 100.
      EXCEPTIONS
        CNTL_ERROR                  = 1
        CNTL_SYSTEM_ERROR           = 2
        CREATE_ERROR                = 3
        LIFETIME_ERROR              = 4
        LIFETIME_DYNPRO_DYNPRO_LINK = 5
        OTHERS                      = 6
        .

    CREATE OBJECT R_TEDIT
      EXPORTING
     WORDWRAP_MODE          = CL_GUI_TEXTEDIT=>WORDWRAP_AT_WINDOWBORDER
        WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>TRUE
        PARENT                 = R_CCONT
      EXCEPTIONS
        ERROR_CNTL_CREATE      = 1
        ERROR_CNTL_INIT        = 2
        ERROR_CNTL_LINK        = 3
        ERROR_DP_CREATE        = 4
        GUI_TYPE_NOT_SUPPORTED = 5
        OTHERS                 = 6
        .

    R_TEDIT->SET_TEXT_AS_R3TABLE( EXPORTING TABLE = CODETAB
                                  EXCEPTIONS OTHERS = 1 ).

    CALL METHOD R_TEDIT->GET_LINE_COUNT
      IMPORTING
        LINES                  = COUNT
      EXCEPTIONS
        ERROR_CNTL_CALL_METHOD = 1
        OTHERS                 = 2.
    CALL SCREEN 100.
  ELSEIF SY-SUBRC = 4.
    MESSAGE I001(ZAB_RD1) WITH P_PROG.    "Program does not exist.
  ENDIF.

The Internal table codetab has more than 100 lines. And the texteditor displays all of them correctly. Only thing is that the method GET_LINE_COUNT doesn't return value. I get 0 into COUNT always.

Does this have something to do with the CL_GUI_CFW=>FLUSH( ).? Please suggest..

Thanks in advance

Arun B