‎2010 Nov 30 3:52 AM
hi experts,
i am doing a module pool to create a gate pass and i when i press create it will go to the next screen .in that screen i have created a texteditor for entering the purpose . if i enter the purpose and if i dont save and click back it goes to the previous screen and then if i again click create the text i entered in the texteditor still is retained. how can i clear that?. will be thankful if some one could help.below is the code i have used in PBO.
IF G_EDITOR IS INITIAL.
CREATE OBJECT g_editor_container
EXPORTING
container_name = 'TEXTEDITOR1'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
CREATE OBJECT g_editor
EXPORTING
parent = g_editor_container
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_to_linebreak_mode = cl_gui_textedit=>true
EXCEPTIONS
others = 1.
endif.
with thanks in advance,
syed
Edited by: SYED_ibbu on Nov 30, 2010 5:08 AM
‎2010 Nov 30 5:57 AM
Syed try it from PBO module it wil work,
If not I wil giv you an Example program
Let me know the status , after u tried..
‎2010 Nov 30 4:23 AM
Use this logic.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
OTHERS = 1.
‎2010 Nov 30 4:33 AM
hi,
thanks gautam for the rply.But i had used flush part that i removed while posting before creating the container.but it is not still getting cleared.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2.
CREATE OBJECT g_editor_container
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.
ENDIF.
with thanks in advance,
syed
‎2010 Nov 30 4:46 AM
Try this.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
OTHERS = 1.
Clear G_editor.
‎2010 Nov 30 4:54 AM
thanks again gautam,
i tried with clear g_editor .still no luck.i am posting the whole code for a better picture.
"in PBO
g_repid = sy-repid.
IF G_EDITOR IS INITIAL.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2.
***
CLEAR G_EDITOR_CONTAINER.CLEAR G_EDITOR.
CREATE OBJECT g_editor_container
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.
ENDIF.
CREATE OBJECT g_editor
EXPORTING
parent = g_editor_container
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_to_linebreak_mode = cl_gui_textedit=>true
EXCEPTIONS
others = 1.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = space
txt1 = text-001.
ENDIF.
IF ( L_FUNC = C_DISPLAY OR L_FUNC = C_CHANGE ).
REFRESH G_MYTABLE.CLEAR W_MYTABLELINE.
SELECT SINGLE PURPOSE PURPOSE1 PURPOSE2 PURPOSE3 INTO (TEXT,TEXT1,TEXT2,TEXT3) FROM ZGATE_PASS_CFL WHERE PASS_NO = ZST_GP_CFL-PASS_NO.
W_MYTABLELINE-LINE = TEXT. APPEND W_MYTABLELINE TO G_MYTABLE.
W_MYTABLELINE-LINE = TEXT1. APPEND W_MYTABLELINE TO G_MYTABLE.
W_MYTABLELINE-LINE = TEXT2. APPEND W_MYTABLELINE TO G_MYTABLE.
W_MYTABLELINE-LINE = TEXT3. APPEND W_MYTABLELINE TO G_MYTABLE.
CALL METHOD g_editor->SET_text_as_r3table
EXPORTING
table = g_mytable
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = space
txt1 = text-003.
ENDIF.
ENDIF.
ENDIF.
IF L_FUNC = C_DISPLAY OR C_APPROVE2 IS NOT INITIAL.
CALL METHOD g_editor->set_focus
EXPORTING
control = g_editor.
call method G_editor->SET_READONLY_MODE( '1' ).
ELSEIF L_FUNC = C_CHANGE AND C_APPROVE2 IS INITIAL.
CALL METHOD g_editor->set_focus
EXPORTING
control = g_editor.
call method G_editor->SET_READONLY_MODE( '0' ).
ENDIF.
" in PAI
IF MENGE_FL IS NOT INITIAL AND ( L_FUNC = C_CREATE OR L_FUNC = C_CHANGE ).
CALL METHOD g_editor->get_text_as_r3table
IMPORTING
table = g_mytable
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = space
txt1 = text-003.
ENDIF.
LOOP AT G_MYTABLE INTO W_MYTABLELINE.
IF SY-TABIX = 1.
TEXT = W_MYTABLELINE-LINE.
ELSEIF SY-TABIX = 2.
TEXT1 = W_MYTABLELINE-LINE.
ELSEIF SY-TABIX = 3.
TEXT2 = W_MYTABLELINE-LINE.
ELSEIF SY-TABIX = 4.
TEXT3 = W_MYTABLELINE-LINE.
ENDIF.
ENDLOOP.
* READ TABLE G_MYTABLE INTO W_MYTABLELINE INDEX 1.
* TEXT = W_MYTABLELINE-LINE.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = space
txt1 = text-002.
ENDIF.
CLEAR g_ok_code.
with thanks in advance,
syed
‎2010 Nov 30 6:08 AM
Hi Syed ,
Please try this code below :
"in PBO
g_repid = sy-repid.
IF G_EDITOR IS NOT INITIAL.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2.
This should work ... the reason it is not working currently is in PBO of screen the system checkes the editor is initial or not ..
if it is not initial then only it should call the flush .
Regards,
Ranjita
‎2010 Nov 30 5:01 AM
Edited by: SYED_ibbu on Nov 30, 2010 6:02 AM
Edited by: SYED_ibbu on Nov 30, 2010 6:02 AM
‎2010 Nov 30 5:17 AM
Call the method free before initilizing the object for editor,
CALL METHOD g_editor->free( ).
CLEAR g_editor.
‎2010 Nov 30 5:55 AM
thanks benu,
i have used it as below.it is dumping as access not possible due to null refrence.
call method g_editor->free( ).
clear g_editor.
CREATE OBJECT g_editor
EXPORTING
parent = g_editor_container
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_to_linebreak_mode = cl_gui_textedit=>true
EXCEPTIONS
others = 1.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = space
txt1 = text-001.
ENDIF.
with thanks in advance,
syed
‎2010 Nov 30 5:17 AM
HI SYED,
try this code from 'PBO' then it will work.
CALL METHOD cpreg->delete_text. " cpreg : container name
Edited by: Murthy.SAP on Nov 30, 2010 6:20 AM
‎2010 Nov 30 5:50 AM
thanks murthy,
when i tried his it is showing the error as 'delete_text is unknown or protected or private'
with thanks,
syed
‎2010 Nov 30 5:50 AM
thanks murthy,
when i tried his it is showing the error as 'delete_text is unknown or protected or private'
with thanks,
syed
‎2010 Nov 30 5:57 AM
Syed try it from PBO module it wil work,
If not I wil giv you an Example program
Let me know the status , after u tried..
‎2010 Nov 30 6:04 AM
tahnks again,
i tried it from PBO only.below is the code.
"PBO
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2.
CLEAR G_EDITOR_CONTAINER.CLEAR G_EDITOR.
CALL METHOD g_editor_container->delete_text.
CREATE OBJECT g_editor_container
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.
thanks in advance,
syed
‎2010 Nov 30 6:08 AM
SYED
This is an example program which iam using in my current project
Surely it wil work check it out..
" IN PBO
DATA : editor_container TYPE REF TO cl_gui_custom_container,
cpreg TYPE REF TO cl_gui_textedit.
IF cpreg IS INITIAL.
CREATE OBJECT editor_container
EXPORTING
container_name = 'CPREG'.
CREATE OBJECT cpreg
EXPORTING
parent = editor_container
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_position = 45
wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
CALL METHOD cpreg->set_toolbar_mode
EXPORTING
toolbar_mode = cl_gui_textedit=>false.
CALL METHOD cpreg->set_statusbar_mode
EXPORTING
statusbar_mode = cl_gui_textedit=>false.
ENDIF.
"THIS IS ALSO IN PBO
IF sy-ucomm = 'CLEAR'.
PERFORM clear_data.
ENDIF.
"FORM CLEAR_DATA...
FORM clear_data .
CALL METHOD cpreg->delete_text.
ENDFORM.
Let me know the Status
‎2010 Nov 30 6:10 AM
The dump is due to the null reference for the object. You should have cleared the object in PAI event.
So, before freeing the object try calling the free() method.
Regards,
Benu
‎2010 Nov 30 6:45 AM
hi murthy,
thanks a lot.it worked.and thanks everyone for helping me out.
with thanks,
syed