I'm using the ABAP standard class cl_gui_textedit
to read text from a textarea on my selection screen. But the result after calling the method get_textstream
on the instance is empty.
Minimal working example:
REPORT z_mwe_textarea_bug.
DATA lr_edit TYPE REF TO cl_gui_textedit.
DATA lr_docker TYPE REF TO cl_gui_docking_container.
PARAMETERS p_dummy TYPE string DEFAULT 'just for testing'. ""// <--- need this to show selection screen.
INITIALIZATION.
CREATE OBJECT lr_docker
EXPORTING
ratio = 60.
CREATE OBJECT lr_edit
EXPORTING
parent = lr_docker.
lr_docker->dock_at( EXPORTING side = cl_gui_docking_container=>dock_at_left ).
START-OF-SELECTION.
DATA lv_text_from_textarea TYPE string.
lr_edit->get_textstream( IMPORTING text = lv_text_from_textarea ). ""// <-- why is lv_text_from_textarea empty??
You (or I, answering my own question) have to call cl_gui_cfw=>flush( )
afterwards. Like this:
lr_edit->get_textstream( IMPORTING text = lv_text_from_textarea ). ""// <-- lv_text_from_textarea still empty
cl_gui_cfw=>flush( ). ""//<-- now it's not empty anymore.
Disclaimer: Found the answer on abapforum.de but removed all the useless (and german) discussions and added a minimal working example to my question.