Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Issue with GET_TEXTSTREAM for Long Text

former_member185978
Active Participant
0 Likes
1,977

Hi Friends,

I am facing a problem with Dynamic Creation of Object to read the Long text given in Screen in SAPLXQQM 100.

There are 10 Long texts in my screen 100 and I am able to display them using Dynamic Object creation and Disply.

But When changed the Long text and save .. I am not getting the any text into WHY1 field in call method GET_TEXTSTREAM as shown below.

Here is the complete code in PAI.

* PAI of Screen 100

     WHEN 'BUCH'.  " SAVE

DO 10 Times.
             move sy-index to lv_index.
             MOVE 1 TO LV_INDEX.
            CONCATENATE 'TEXTEDITOR' lv_index INTO lv_textedit.
CREATE OBJECT EDITOR_CONTAINER
      EXPORTING
*        CONTAINER_NAME              = 'TEXTEDITOR1'  " Instead of Hard code Used as Dynamic Container Name
        CONTAINER_NAME              = lv_textedit
      EXCEPTIONS
        CNTL_ERROR                  = 1
        CNTL_SYSTEM_ERROR           = 2
        CREATE_ERROR                = 3
        LIFETIME_ERROR              = 4
        LIFETIME_DYNPRO_DYNPRO_LINK = 5.


CREATE OBJECT TEXTED TYPE ('CL_GUI_TEXTEDIT')
  EXPORTING
        PARENT           = EDITOR_CONTAINER.


      CALL METHOD TEXTED->GET_TEXTSTREAM
*               EXPORTING
*                   ONLY_WHEN_MODIFIED     = CL_GUI_TEXTEDIT=>TRUE
                IMPORTING
                    TEXT                   = WHY1
*                   IS_MODIFIED            =
                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 CL_GUI_CFW=>FLUSH
        EXCEPTIONS
          CNTL_SYSTEM_ERROR = 1
          CNTL_ERROR        = 2
          OTHERS            = 3.

ENDDO.

But Without an Dynamic If I call the GET_TEXTSTREAM , Its getting the value what I gave in SCREEN 100,

I made this dynamic becos there are 10 Long texts in SCREEN 100 so, I dont want to repead the same code 10 times, Instead

DO 10 Times.

Use the above CODE.

ENDDO.

Please help .

Hi Friends,

I am facing a problem with Dynamic Creation of Object to read the Long text given in Screen in SAPLXQQM 100.

There are 10 Long texts in my screen 100 and I am able to display them using Dynamic Object creation and Disply.

But When changed the Long text and save .. I am not getting the any text into WHY1 field in call method GET_TEXTSTREAM as shown below.

Here is the complete code in PAI.

* PAI of Screen 100

     WHEN 'BUCH'.  " SAVE

DO 10 Times.
             move sy-index to lv_index.
             MOVE 1 TO LV_INDEX.
            CONCATENATE 'TEXTEDITOR' lv_index INTO lv_textedit.
CREATE OBJECT EDITOR_CONTAINER
      EXPORTING
*        CONTAINER_NAME              = 'TEXTEDITOR1'  " Instead of Hard code Used as Dynamic Container Name
        CONTAINER_NAME              = lv_textedit
      EXCEPTIONS
        CNTL_ERROR                  = 1
        CNTL_SYSTEM_ERROR           = 2
        CREATE_ERROR                = 3
        LIFETIME_ERROR              = 4
        LIFETIME_DYNPRO_DYNPRO_LINK = 5.


CREATE OBJECT TEXTED TYPE ('CL_GUI_TEXTEDIT')
  EXPORTING
        PARENT           = EDITOR_CONTAINER.


      CALL METHOD TEXTED->GET_TEXTSTREAM
*               EXPORTING
*                   ONLY_WHEN_MODIFIED     = CL_GUI_TEXTEDIT=>TRUE
                IMPORTING
                    TEXT                   = WHY1
*                   IS_MODIFIED            =
                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 CL_GUI_CFW=>FLUSH
        EXCEPTIONS
          CNTL_SYSTEM_ERROR = 1
          CNTL_ERROR        = 2
          OTHERS            = 3.

ENDDO.

But Without an Dynamic If I call the GET_TEXTSTREAM , Its getting the value what I gave in SCREEN 100,

I made this dynamic becos there are 10 Long texts in SCREEN 100 so, I dont want to repead the same code 10 times, Instead

DO 10 Times.

Use the above CODE.

ENDDO.

Please help .

2 REPLIES 2
Read only

arindam_m
Active Contributor
0 Likes
1,107

Hi,

May be you have to refer to the same instance of the text editor to read the text. I think

ME->GET_TEXTSTREAM

might help. The first time instance is created. Next time you have to refer the existing instance as you have the same instance still existing when you go to other lines.

Cheers,

Arindam

Read only

0 Likes
1,107

Hi Arindam,

Thanks for your reply.

That will not work.

Here is my complete code of Module pool.

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.

PAI Module has you see in my initial Question.

I created instance first time in PBO dynamically. Here is the Code.

In PBO:

MODULE STATUS_0100 OUTPUT.

data readonly type I value '1'.
data name type THEAD-TDNAME.
data :lt_tlines   TYPE TABLE OF tline,
      ls_tlines   TYPE tline,
      texthdr     TYPE thead.
DATA: BEGIN OF LT_TXT OCCURS 0,
        LINE(200),
      END OF LT_TXT.

data lv_textedit(12) TYPE C.
data lv_index(2) TYPE c.
data lv_result(2) type c.
data lv_add(2) type c.

lv_add = 1.
do 10 TIMES.
     move sy-index to lv_index.
     CONCATENATE 'TEXTEDITOR' lv_index INTO lv_textedit.

           CREATE OBJECT EDITOR_CONTAINER
                  EXPORTING
                     CONTAINER_NAME              = lv_textedit
                  EXCEPTIONS
                     CNTL_ERROR                  = 1
                     CNTL_SYSTEM_ERROR           = 2
                     CREATE_ERROR                = 3
                     LIFETIME_ERROR              = 4
                     LIFETIME_DYNPRO_DYNPRO_LINK = 5.

        CREATE OBJECT TEXTED TYPE ('CL_GUI_TEXTEDIT')
                EXPORTING
                     PARENT           = EDITOR_CONTAINER
                     WORDWRAP_MODE    = CL_GUI_TEXTEDIT=>wordwrap_at_windowborder ."WORDWRAP_AT_FIXED_POSITION


  if sy-tcode = 'IW23' or
     sy-tcode = 'IW22'.
              COMPUTE lv_result = lv_index mod 2.
            if lv_result eq 1.
              CONCATENATE VIQMEL-QMNUM 'WHY' lv_add into name.
            else.
              CONCATENATE VIQMEL-QMNUM 'ACT' lv_add into name.
              lv_add = lv_add + 1.
            endif.

          CALL FUNCTION 'READ_TEXT '
                 EXPORTING
                    CLIENT                        = SY-MANDT
                    ID                            = 'ST'
                    LANGUAGE                      = sy-langu
                    NAME                          = name
                    OBJECT                        = 'TEXT'
                IMPORTING
                   HEADER                        = texthdr
               TABLES
                   LINES                         = lt_tlines.

if sy-tcode = 'IW23'.
    * set dISPLAY mode - Disable mode
          CALL METHOD TEXTED->set_readonly_mode
               EXPORTING
                 readonly_mode          = readonly
              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.

        CALL METHOD CL_GUI_CFW=>FLUSH.
endif.


     loop at lt_tlines into ls_tlines.
       move ls_tlines-TDLINE to lt_txt-line.
       APPEND lt_txt.
     ENDLOOP.

       CALL METHOD TEXTED->SET_TEXT_AS_R3TABLE
             EXPORTING
                TABLE           = lt_txt[].

       CALL METHOD TEXTED->AUTO_REDRAW
                    EXPORTING ENABLE_REDRAW = 1.
       CALL METHOD CL_GUI_CFW=>FLUSH.

      CLEAR lt_txt[].
      CLEAR lt_tlines[].

endif.
ENDDO.