Para ingresar texto en un cuadro de texto creado en la Dynpro
se debe hacer los siguiente :
*--------------------------------------------------------------------*
* Declaracion variables para el cuadro de textos
*--------------------------------------------------------------------*
*
CLASS event_handler DEFINITION.
PUBLIC SECTION.
METHODS: handle_f1 FOR EVENT f1 OF cl_gui_textedit
IMPORTING sender,
handle_f4 FOR EVENT f4 OF cl_gui_textedit
IMPORTING sender.
ENDCLASS.
*--------------------------------------------------------------------*
DATA: init,
container TYPE REF TO cl_gui_custom_container,
editor TYPE REF TO cl_gui_textedit.
DATA: event_tab TYPE cntl_simple_events,
event TYPE cntl_simple_event.
DATA handle TYPE REF TO event_handler.
DATA: line(256) TYPE c,
text_tab LIKE STANDARD TABLE OF line,
field LIKE line.
*--------------------------------------------------------------------*
* Declaracion de datos para el texto
*--------------------------------------------------------------------*
DATA: gt_THEADER LIKE THEAD.
DATA BEGIN OF gt_TLINETAB OCCURS 10.
INCLUDE STRUCTURE TLINE.
DATA: END OF gt_TLINETAB.
*--------------------------------------------------------------------*
* Implementacion de la Clase
*--------------------------------------------------------------------*
CLASS event_handler IMPLEMENTATION.
METHOD handle_f1.
DATA row TYPE i.
MESSAGE i888(sabapdocu) WITH text-004.
CALL METHOD sender->get_selection_pos
IMPORTING from_line = row.
CALL METHOD sender->get_line_text
EXPORTING line_number = row
IMPORTING text = field.
CALL METHOD cl_gui_cfw=>set_new_ok_code "raise PAI for
EXPORTING new_code = 'F1'. "system events
CALL METHOD cl_gui_cfw=>flush.
ENDMETHOD.
METHOD handle_f4.
DATA row TYPE i.
MESSAGE i888(sabapdocu) WITH text-005.
CALL METHOD sender->get_selection_pos
IMPORTING from_line = row.
CALL METHOD sender->get_line_text
EXPORTING line_number = row
IMPORTING text = field.
CALL METHOD cl_gui_cfw=>flush.
ENDMETHOD.
ENDCLASS.
*----->>> Crear custom container en la Dynpro, llamado 'CUST_TEXTO'
*----->>> En el PBO de la Dynpro crear modulo:
*---------------------------------------------------------------------*
* Module PBO_TEXTO OUTPUT
*---------------------------------------------------------------------*
MODULE PBO_TEXTO OUTPUT.
IF init is initial.
init = 'X'.
*--------------------------------------------------------------------*
* Crear Control del Container
*--------------------------------------------------------------------*
CREATE OBJECT: container EXPORTING container_name = 'CUST_TEXTO',
editor EXPORTING parent = container,
handle.
*
event-eventid = cl_gui_textedit=>event_f1.
event-appl_event = ' '.
APPEND event TO event_tab.
event-eventid = cl_gui_textedit=>event_f4.
event-appl_event = 'X'.
APPEND event TO event_tab.
CALL METHOD: editor->set_registered_events
EXPORTING events = event_tab.
*--------------------------------------------------------------------*
* Mostrar Status Bar en la Dynpro
*--------------------------------------------------------------------*
CALL METHOD editor->set_toolbar_mode
EXPORTING
toolbar_mode = editor->false.
CALL METHOD editor->set_statusbar_mode
EXPORTING
statusbar_mode = editor->false.
*
SET HANDLER handle->handle_f1
handle->handle_f4 FOR editor.
ENDIF.
CALL METHOD editor->set_text_as_stream
EXPORTING
text = text_tab.
*
ENDMODULE.
*---->>> En el PAI de la Dynpro crear modulo:
*---------------------------------------------------------------------*
* Module PAI_TEXTO_REFRESH INPUT
*---------------------------------------------------------------------*
MODULE PAI_TEXTO_REFRESH.
CALL METHOD editor->get_text_as_stream
IMPORTING
text = text_tab.
ENDMODULE.