‎2007 Nov 12 9:34 AM
Hi experts,
How to add a text field which can have more than one line(like text area) in module pool..
It want to except more thn one lines..
Anyone plz help me with the code..
‎2007 Nov 12 10:04 AM
HI,
see this code.
DATA:container TYPE scrfname VALUE 'CONT',(cont is container in screen 101)
cl_container TYPE REF TO cl_gui_custom_container,
text_area TYPE REF TO cl_gui_textedit.
data:okcode type sy-ucomm.
set screen 101.
MODULE STATUS_0101 OUTPUT.
set PF-STATUS 'MENU'.
IF CL_CONTAINER IS NOT INITIAL.
CALL METHOD CL_CONTAINER->FREE
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2.
IF SY-SUBRC <> 0.
MESSAGE A000(ZTMW_MSGTAB).
ENDIF.
CLEAR CL_CONTAINER."clearing the custom container1
ENDIF.
IF CL_CONTAINER IS INITIAL.
CREATE OBJECT CL_CONTAINER
EXPORTING CONTAINER_NAME = CONTAINER.
CREATE OBJECT TEXT_AREA
EXPORTING
parent = CL_CONTAINER
wordwrap_mode = cl_gui_textedit=>WORDWRAP_AT_WINDOWBORDER
wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
CALL METHOD CL_CONTAINER->link
EXPORTING
repid = sy-repid
dynnr = '0101'
container = CONTAINER.
CALL METHOD CL_CONTAINER->set_width
EXPORTING
width = 15.
CALL METHOD CL_CONTAINER->set_height
EXPORTING
height = 5.
ENDIF.
ENDMODULE. " STATUS_0101 OUTPUT
MODULE USER_COMMAND_0101 INPUT.
CASE OKCODE."okcode of screen 101
WHEN 'BACK'.
SET SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0101 INPUT
flow logic:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0101.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0101.
rgds,
bharat.
‎2007 Nov 12 9:53 AM
‎2007 Nov 12 10:00 AM
‎2007 Nov 12 10:04 AM
HI,
see this code.
DATA:container TYPE scrfname VALUE 'CONT',(cont is container in screen 101)
cl_container TYPE REF TO cl_gui_custom_container,
text_area TYPE REF TO cl_gui_textedit.
data:okcode type sy-ucomm.
set screen 101.
MODULE STATUS_0101 OUTPUT.
set PF-STATUS 'MENU'.
IF CL_CONTAINER IS NOT INITIAL.
CALL METHOD CL_CONTAINER->FREE
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2.
IF SY-SUBRC <> 0.
MESSAGE A000(ZTMW_MSGTAB).
ENDIF.
CLEAR CL_CONTAINER."clearing the custom container1
ENDIF.
IF CL_CONTAINER IS INITIAL.
CREATE OBJECT CL_CONTAINER
EXPORTING CONTAINER_NAME = CONTAINER.
CREATE OBJECT TEXT_AREA
EXPORTING
parent = CL_CONTAINER
wordwrap_mode = cl_gui_textedit=>WORDWRAP_AT_WINDOWBORDER
wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
CALL METHOD CL_CONTAINER->link
EXPORTING
repid = sy-repid
dynnr = '0101'
container = CONTAINER.
CALL METHOD CL_CONTAINER->set_width
EXPORTING
width = 15.
CALL METHOD CL_CONTAINER->set_height
EXPORTING
height = 5.
ENDIF.
ENDMODULE. " STATUS_0101 OUTPUT
MODULE USER_COMMAND_0101 INPUT.
CASE OKCODE."okcode of screen 101
WHEN 'BACK'.
SET SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0101 INPUT
flow logic:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0101.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0101.
rgds,
bharat.
‎2007 Nov 12 10:24 AM
Thanks,but plz tell me how to design the screen as per this code
‎2007 Nov 12 10:28 AM
HI,
for this create a screen with screen number 101.
create a <b>custom control</b>(symbol with c in the left side listing) with name 'CONT'
rgds,
bharat.
‎2007 Nov 12 10:08 AM
Hello Mahesh,
Follow the below steps:
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
now you will get the text editor.
source is:
Reward If Helpful.
regards
--
Sasidhar Reddy Matli.
‎2007 Nov 12 11:00 AM
Hi Reddy,
It was very useful..Is it possible to made invisible the symbols which is coming on the top and bottom of the text box