romario2
19/12/08, 12:02:31
Necesito un objeto de texto que guarde datos en una dynpro de Module Pool.
Tengo este código pero no acaba de funcionar:
*&---------------------------------------------------------------------*
*& Module STATUS_1000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_1000 OUTPUT.
SET TITLEBAR 'TITLE'.
SET PF-STATUS 'STATUS_1000'.
DATA: gcl_container TYPE REF TO cl_gui_custom_container.
DATA: gcl_editor TYPE REF TO cl_gui_textedit.
* Instancio el container
CREATE OBJECT gcl_container
EXPORTING
container_name = 'TXTAREA_CABECERA'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Intancio el editor de texto con el contenedor como 'parent'
CREATE OBJECT gcl_editor
EXPORTING
parent = gcl_container
wordwrap_mode = 2
wordwrap_position = 228
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
gui_type_not_supported = 5
others = 6.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMODULE. " STATUS_1000 OUTPUT
******************
MODULE user_command_1000 INPUT.
CASE sy-ucomm.
WHEN 'CAN' OR 'FIN' OR 'BACK' OR 'EXIT'.
CLEAR sy-ucomm.
SET SCREEN 0.
LEAVE PROGRAM.
WHEN 'SAVE'.
DATA: t_texto TYPE line OCCURS 0.
DATA: w_texto TYPE line.
DATA: v_modif TYPE i.
* Obtengo los datos introducidos en la tabla 't_texto'
CALL METHOD gcl_editor->get_text_as_r3table
IMPORTING
table = t_texto
is_modified = v_modif
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
error_dp_create = 3
potential_data_loss = 4
others = 5.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* En este punto deberías tener en la tabla 't_texto' lo que
* has ingresado en el text_editor. Cada entrada de la tabla
* representa una línea ingresada en el text_editor.
* Finalmente, libero los recursos del objeto editor.
CALL METHOD gcl_editor->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
MUCHAS GRACIAS:)
Tengo este código pero no acaba de funcionar:
*&---------------------------------------------------------------------*
*& Module STATUS_1000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_1000 OUTPUT.
SET TITLEBAR 'TITLE'.
SET PF-STATUS 'STATUS_1000'.
DATA: gcl_container TYPE REF TO cl_gui_custom_container.
DATA: gcl_editor TYPE REF TO cl_gui_textedit.
* Instancio el container
CREATE OBJECT gcl_container
EXPORTING
container_name = 'TXTAREA_CABECERA'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Intancio el editor de texto con el contenedor como 'parent'
CREATE OBJECT gcl_editor
EXPORTING
parent = gcl_container
wordwrap_mode = 2
wordwrap_position = 228
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
gui_type_not_supported = 5
others = 6.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMODULE. " STATUS_1000 OUTPUT
******************
MODULE user_command_1000 INPUT.
CASE sy-ucomm.
WHEN 'CAN' OR 'FIN' OR 'BACK' OR 'EXIT'.
CLEAR sy-ucomm.
SET SCREEN 0.
LEAVE PROGRAM.
WHEN 'SAVE'.
DATA: t_texto TYPE line OCCURS 0.
DATA: w_texto TYPE line.
DATA: v_modif TYPE i.
* Obtengo los datos introducidos en la tabla 't_texto'
CALL METHOD gcl_editor->get_text_as_r3table
IMPORTING
table = t_texto
is_modified = v_modif
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
error_dp_create = 3
potential_data_loss = 4
others = 5.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* En este punto deberías tener en la tabla 't_texto' lo que
* has ingresado en el text_editor. Cada entrada de la tabla
* representa una línea ingresada en el text_editor.
* Finalmente, libero los recursos del objeto editor.
CALL METHOD gcl_editor->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
MUCHAS GRACIAS:)