‎2008 Jun 09 7:22 AM
How to add text-editor in module pool programming and how to code it please explain me its very urgent
‎2008 Jun 09 7:44 AM
Hi Naveen,
In ur screen place a custom control (say with name CONTAINER )....
Check the below code.....
DATA : container TYPE REF TO cl_gui_custom_container,
text_editor TYPE REF TO cl_gui_textedit,
lt_texttab TYPE soli_tab.
CALL SCREEN 100. " Assuming ur screen no is 100
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT. "PBO MODULE
SET PF-STATUS '001'.
IF sy-ucomm EQ 'BACK'.
LEAVE PROGRAM.
ENDIF.
CHECK container IS NOT BOUND.
CREATE OBJECT container EXPORTING container_name = 'CONTAINER'.
CREATE OBJECT text_editor EXPORTING parent = container
wordwrap_mode = cl_gui_textedit=>wordwrap_at_windowborder.
***to put some text in the text editor.
APPEND 'Type something place ur cursor outside the editor and hit enter' TO lt_texttab.
CALL METHOD text_editor->set_text_as_r3table
EXPORTING
table = lt_texttab " Contents of this table is displayed in text editor
EXCEPTIONS
error_dp = 1
error_dp_create = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
MODULE user_command_0100 INPUT. "PAI MODULE
CALL METHOD text_editor->get_text_as_r3table
IMPORTING
table = lt_texttab " Text tyed in editor gets collected in this table
EXCEPTIONS
error_dp = 1
error_dp_create = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
BREAK-POINT. " Check the table lt_texttab
ENDMODULE. " USER_COMMAND_0100 INPUTCheers,
Jose.
‎2008 Jun 09 7:24 AM
Hi,
Refer the method below:
CALL METHOD editor->get_text_as_r3table
IMPORTING
table = i_itempo
EXCEPTIONS
OTHERS = 1.
Create obejct for the TextEditor control
CREATE OBJECT editor
EXPORTING
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_position = line_length
wordwrap_to_linebreak_mode = cl_gui_textedit=>true
parent = custom_container
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 <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
Also refer,
‎2008 Jun 09 7:25 AM
Hi,
Creating the TextEdit control
This is a simple example of how to implement a text edit control.
Steps
Create a report
In the start of selection event add: SET SCREEN '100'.
Create screen 100
Place a custom control on the screen by choosing the custom control icon which can be recognized by the letter 'C', and give it the name MYCONTAINER1.
To be able to exit the program, add a pushbutton with the function code EXIT.
In the elements list enter the name OK_CODE for the element of type OK.
The code
REPORT sapmz_hf_controls1 .
CONSTANTS:
line_length TYPE i VALUE 254.
DATA: ok_code LIKE sy-ucomm.
DATA:
Create reference to the custom container
custom_container TYPE REF TO cl_gui_custom_container,
Create reference to the TextEdit control
editor TYPE REF TO cl_gui_textedit,
repid LIKE sy-repid.
START-OF-SELECTION.
SET SCREEN '100'.
----
MODULE USER_COMMAND_0100 INPUT *
----
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
&----
*& Module STATUS_0100 OUTPUT
&----
MODULE status_0100 OUTPUT.
The TextEdit control should only be initialized the first time the
PBO module executes
IF editor IS INITIAL.
repid = sy-repid.
Create obejct for custom container
CREATE OBJECT custom_container
EXPORTING
container_name = 'MYCONTAINER1'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Create obejct for the TextEditor control
CREATE OBJECT editor
EXPORTING
wordwrap_mode =
cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_position = line_length
wordwrap_to_linebreak_mode = cl_gui_textedit=>true
parent = custom_container
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 <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
http://abaplovers.blogspot.com/2008/03/sap-abap-tutorial-module-pool_17.html
http://sap.mis.cmich.edu/sap-abap/abap09/sld011.htm
http://www.erpgenie.com/abap/controls/textedit.htm
Regards,
Jagadish
‎2008 Jun 09 7:44 AM
Hi Naveen,
In ur screen place a custom control (say with name CONTAINER )....
Check the below code.....
DATA : container TYPE REF TO cl_gui_custom_container,
text_editor TYPE REF TO cl_gui_textedit,
lt_texttab TYPE soli_tab.
CALL SCREEN 100. " Assuming ur screen no is 100
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT. "PBO MODULE
SET PF-STATUS '001'.
IF sy-ucomm EQ 'BACK'.
LEAVE PROGRAM.
ENDIF.
CHECK container IS NOT BOUND.
CREATE OBJECT container EXPORTING container_name = 'CONTAINER'.
CREATE OBJECT text_editor EXPORTING parent = container
wordwrap_mode = cl_gui_textedit=>wordwrap_at_windowborder.
***to put some text in the text editor.
APPEND 'Type something place ur cursor outside the editor and hit enter' TO lt_texttab.
CALL METHOD text_editor->set_text_as_r3table
EXPORTING
table = lt_texttab " Contents of this table is displayed in text editor
EXCEPTIONS
error_dp = 1
error_dp_create = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
MODULE user_command_0100 INPUT. "PAI MODULE
CALL METHOD text_editor->get_text_as_r3table
IMPORTING
table = lt_texttab " Text tyed in editor gets collected in this table
EXCEPTIONS
error_dp = 1
error_dp_create = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
BREAK-POINT. " Check the table lt_texttab
ENDMODULE. " USER_COMMAND_0100 INPUTCheers,
Jose.