2009 Apr 14 1:33 PM
Hi,
I am adding new screen so that user can write some comment before print.
That comment should comes in smartform.
Now i Create a custom control on screen with name TEXTEDITOR.
User can enter a text here.
But when i am moving that text to a variable, '##' is comming when ever the user is hitting enter key.
How to save that text in a variable.
The text can be large enough.
Second i create a text box.
User can input the text here also.
how to move the input data of that of that text box into a variable, so as to print this one also in smartform.
Please help in finding the solution
Thanks
Nitin Malhotra
Hi,
I am adding new screen so that user can write some comment before print.
That comment should comes in smartform.
Now i Create a custom control on screen with name TEXTEDITOR.
User can enter a text here.
But when i am moving that text to a variable, '##' is comming when ever the user is hitting enter key.
How to save that text in a variable.
The text can be large enough.
Second i create a text box.
User can input the text here also.
how to move the input data of that of that text box into a variable, so as to print this one also in smartform.
Please help in finding the solution
Thanks
Nitin Malhotra
2009 Apr 15 8:03 AM
HI,
u can use the FM : READ_TEXT & SAVE_TEXT
for this sort of text editor text save.
Provide the textid, name and other parameters into FM.
-
Regards,
Srinath
2009 Apr 15 8:09 AM
HI,
Yes, you can add using TEXT AREA control. Insert a custom control area in the screen and create a object of the text editor.
Check this code for PBO and PAI.
TEDITOR is the custom contorl area name on screen:-
MODULE PBO OUTPUT.
IF EDITOR IS INITIAL.
* set status
SET pf-status '1111'.
* create control container
CREATE OBJECT TextEdit_Custom_Container
EXPORTING
CONTAINER_NAME = 'TEDITOR'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
if sy-subrc ne 0.
* add your handling
ENDif.
mycontainer = 'TEDITOR'.
* create calls constructor, which initializes, creats and links
* TextEdit Control
create object editor
exporting
parent = TextEdit_Custom_Container
WORDWRAP_MODE =
* cl_gui_textedit=>wordwrap_off
cl_gui_textedit=>wordwrap_at_fixed_position
* cl_gui_textedit=>WORDWRAP_AT_WINDOWBORDER
WORDWRAP_POSITION = line_length
wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
* to handle different containers
container_linked = 1.
refresh mytable.
ENDIF.
ENDMODULE. " PBO OUTPUT
MODULE pai INPUT.
case ok_code.
WHEN 'SAVE'.
* retrieve table from control
clear: txt.
call method editor->get_text_as_r3table
importing table = mytable.
loop at mytable into wa.
concatenate txt wa into txt
separated by '|'.
endloop.
shift txt left.
length = strlen( txt ).
ztext-CLUSTR = length.
ztext-text = txt.
modify ztext.
clear: ztext.
refresh: mytable.
call method editor->set_text_as_r3table
exporting table = mytable.
Message s000(zwa).
when 'DISP'.
select single * from
ztext
where fund = ztext-fund.
SPLIT ztext-text AT '|' INTO TABLE mytable.
call method editor->set_text_as_r3table
exporting table = mytable.
endcase.
clear: ok_code.
ENDMODULE. " pai INPUT
Also you can refer:-
Hope this helps you.
Regards,
Tarun