‎2008 Nov 20 8:16 AM
Hi,
i've wrote a function module which is called via a pattern in the ABAP Editor (SE38).
This FM has a screen which is defined as modal screen. The screen contains nothing but a single container.
In the PBO i'm creating the two controls like this:
MODULE status_9000 OUTPUT.
SET PF-STATUS '9000'.
SET TITLEBAR '9000'.
PERFORM build_container.
ENDMODULE.
FORM build_container .
DATA:
width TYPE i.
width = 66.
IF modus = c_frame.
width = 66.
ELSEIF modus = c_hist.
width = 42.
ENDIF.
IF custom_container IS INITIAL.
CREATE OBJECT custom_container
EXPORTING
container_name = 'CONTAINER'
lifetime = cl_gui_custom_container=>lifetime_imode
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
subrc = 4.
MESSAGE 'Cant create container' TYPE 'E'.
RETURN.
ENDIF.
ENDIF.
IF editor IS INITIAL.
CREATE OBJECT editor
EXPORTING
parent = custom_container
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_position = width
wordwrap_to_linebreak_mode = cl_gui_textedit=>true
lifetime = cl_gui_textedit=>lifetime_imode.
IF sy-subrc <> 0.
subrc = 4.
MESSAGE 'Cant create editor' TYPE 'E'.
RETURN.
ENDIF.
ENDIF.
ENDFORM. " BUILD_CONTAINER
In the PAI, i'm closing like this:
subrc = 0.
editor->free( ). (*)
SET SCREEN 0. LEAVE SCREEN.
The first time i'm calling this, everything works well. But the second time and all following, the conatiner remains empty.
If i delete the editor->free( ) (constructor), the editor is shown the second time, but the text i've entered is not given back by
CALL METHOD editor->get_text_as_r3table
IMPORTING
table = it_desc.
Remember, this works fine if i'm calling the FM the first time.
In short terms, after the first call the editor is not shown when the destructor is used, and if it is not used the text cant be retrieved.
Does it have something to do with the lifetime?
‎2008 Nov 20 8:40 AM
Try using CALL METHOD cl_gui_cfw=>flush after using
CALL METHOD editor->get_text_as_r3table
for the first time with out editor->free( ).
Hope this helps.
..
‎2008 Nov 20 8:59 AM
I commented out the destructor and tried
cl_gui_cfw=>flush( )
at different positions (direct after get_text), diectly before SET SCREEN 0. and dierctly after the call screen 9000. There's no change, i can not retrieve the entered text the second time and all follwoing calls.
What i'm wondering is that the text from the first call is displayed the second time in the control... even when i clear the instance and create a new one....
Any other idea?
‎2008 Nov 20 9:12 AM
I commented out the destructor and tried the flush at several positions (right behind the get_text), right before the set screen 0 and right behind the call screen, but the text cant be retrieved after the first call.
What i'm wondering is that the text from the first call is shown the second time....
‎2008 Nov 20 9:22 AM
Hi,
I also faced the same probelm with refreshing the container editor.
Try to use methods
CALL METHOD editor->set_textstream
EXPORTING
text = ' '
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.
And
CALL METHOD editor->set_text_as_r3table
EXPORTING
TABLE =
EXCEPTIONS
ERROR_DP = 1
ERROR_DP_CREATE = 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.
when you try to come out of the screen and run it for the second time.
I am not sure with the output but it was used in my program..
Hope this works...
R
‎2008 Nov 25 8:06 AM