Skip to Content
author's profile photo Former Member
Former Member

Text Editor get refresh for 2 time

Hello all,


Below is my coad, if i run it once it will capture the value of text editor and put it into the g_mytable, but when i come back to selection screen after 1 time execution and during 2 time execution its not capture value of text editor.


can anyone help me for how holding value every time in internal table via GET_TEXT_AS_R3TABLE method of CL_GUI_TEXTEDIT class.


CONSTANTS: line_length type I value 254.

data: GC_CONTAINER type ref to cl_gui_custom_container,

GC_editor type ref to cl_gui_textedit,

GV_text type string,

g_container_linked TYPE i, " container to which control is linked

g_mytable(line_length) TYPE c OCCURS 0,

g_mycontainer(30) TYPE c. " string for the containers

start-of-selection.

call screen '0100'.

*&---------------------------------------------------------------------*

*& Module STATUS_0100 OUTPUT

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'ZTEXTEDIT_TEST'.

CREATE OBJECT GC_CONTAINER

EXPORTING

CONTAINER_NAME = 'TEXTEDITOR'

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

LIFETIME_DYNPRO_DYNPRO_LINK = 5

others = 6.

g_mycontainer = 'TEXTEDITOR'.

CREATE OBJECT GC_editor

EXPORTING

PARENT = GC_CONTAINER

WORDWRAP_MODE = '2'

WORDWRAP_POSITION = 75

WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>TRUE "FALSE

EXCEPTIONS

ERROR_CNTL_CREATE = 1

ERROR_CNTL_INIT = 2

ERROR_CNTL_LINK = 3

ERROR_DP_CREATE = 4

GUI_TYPE_NOT_SUPPORTED = 5

others = 6.

CALL METHOD gc_editor->set_toolbar_mode

EXPORTING

toolbar_mode = cl_gui_textedit=>FALSE.

CALL METHOD gc_editor->set_statusbar_mode

EXPORTING

statusbar_mode = cl_gui_textedit=>FALSE.

ENDMODULE. " STATUS_0100 OUTPUT



*&---------------------------------------------------------------------*

*& Module USER_COMMAND_0100 INPUT

*&---------------------------------------------------------------------*

MODULE USER_COMMAND_0100 INPUT.

case sy-ucomm.

when 'EXIT'.


if not gc_editor is initial.

CALL METHOD gc_editor->free

EXCEPTIONS

others = 1.

if sy-subrc ne 0.

endif.

free gc_editor.

endif.


if not gc_container is initial.

CALL METHOD gc_container->free

EXCEPTIONS

others = 1.

if sy-subrc <> 0.

endif.

free gc_container.

endif.

CALL METHOD cl_gui_cfw=>flush

EXCEPTIONS

OTHERS = 1.

leave program.

WHEN 'EXE'.

break dgiri.

CALL METHOD GC_editor->GET_TEXT_AS_R3TABLE

* EXPORTING

* ONLY_WHEN_MODIFIED = CL_GUI_TEXTEDIT=>TRUE

IMPORTING

TABLE = g_mytable

* IS_MODIFIED = IS_MODIFIED

EXCEPTIONS

ERROR_DP = 1

ERROR_CNTL_CALL_METHOD = 2

ERROR_DP_CREATE = 3

POTENTIAL_DATA_LOSS = 4

others = 5.

CALL METHOD cl_gui_cfw=>flush

EXCEPTIONS

OTHERS = 1.

endcase.

ENDMODULE. " USER_COMMAND_0100 INPUT



Thanks in Advance

Jahnavee Trivedi

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Jun 04, 2014 at 09:01 AM

    First adjust the PBO module, check that objects are not already assigned before creating them again (also actually check the error returned codes) :

    IF object IS INITIAL.
      CREATE object...
    ENDIF.
    

    NB: You could also add some CLEAR object after object->free to prevent you against different behavior of the free method.

    Regards,

    Raymond

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.