2014 Jun 04 9:53 AM
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
2014 Jun 04 10: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
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
2014 Jun 04 10: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
2014 Jun 04 10:44 AM
hi Raymond,
I put the condition if object is initial. and it resolve my problem. Thank You. 🙂
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |