2009 Oct 21 11:36 AM
Hello everyone,
I have created a custom control in my module pool screen. Now I want to store the text in the container into a ztable field of type string. Could any one suggest me how to do that.
Thanks in advance,
Bhaskar.
Hi Tarun,
Thank you very much for the continues help. Apolgies if these are basic questions.
populate this string in the wa .
wa-textid = 'someid' .
wa_desc = <string returned by method> .
append wa to itab .
modify ztable from table itab .In the solution above,
wa-textid = 'someid' .
wa_desc = <string returned by method> .
Could you please tell me where the string returned is going to be saved.
Regards,
Bhaskar.
2009 Oct 21 11:49 AM
Hi,
You can proceed with TEXT AREA
Refer:-
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
2009 Oct 21 12:05 PM
Hi Tarun,
I have created the text editor as said by you. But when I press the save button then I need to save the text in the editor into the database table field which is of string type. I am no understanding how to do that. Please hel me in this regard.
TIA,
Bhaskar.
2009 Oct 21 12:26 PM
2009 Oct 21 2:07 PM
Hi Tarun,
In the solution provided by Durairaj,
when the save button is clicked call the method
GET_TEXTSTREAM of textedit control object to get the text entered in the control. and the returned text is in string format.
populate this string in the wa .
wa-textid = 'someid' .
wa_desc = <string returned by method> .
append wa to itab .
modify ztable from table itab .
Hope this is clear.
Regards
RajaHow to call the method GET_TEXTSTREAM. If it is through pattern, it is saying that the method does not exist. Please suggest me what to do.
Thanks,
Bhaskar.
2009 Oct 22 11:52 AM
Hi,
Refer class CL_GUI_TEXTEDIT and use method GET_TEXTSTREAM.
Click pattern button, select ABAP objects -> provide with the object name created by you for class CL_GUI_TEXTEDIT and call the method.
Hope this helps you.
Regards,
Tarun
2009 Oct 22 1:34 PM
Hi Tarun,
Thank you very much for the continues help. Apolgies if these are basic questions.
populate this string in the wa .
wa-textid = 'someid' .
wa_desc = <string returned by method> .
append wa to itab .
modify ztable from table itab .In the solution above,
wa-textid = 'someid' .
wa_desc = <string returned by method> .
Could you please tell me where the string returned is going to be saved.
Regards,
Bhaskar.
2009 Oct 23 10:48 AM
Hi,
The method will give you one string.
Assign this string to wa-desc. Append this to the internal table itab.
Now use this internal table to insert these text into Z database table.
Hope this helps you.
Regards,
Tarun
2009 Oct 23 12:23 PM
2009 Oct 21 12:35 PM
>
> Hello everyone,
>
> I have created a custom control in my module pool screen. Now I want to store the text in the container into a ztable field of type string. Could any one suggest me how to do that.
>
> Thanks in advance,
> Bhaskar.
Is there any particular reason you are using custom control and text area to display a field?
This can be easily done using a Input/Output field.
Edited by: Pawan Kesari on Oct 21, 2009 5:05 PM
2009 Oct 21 1:02 PM
Hi Pawan,
I want the data to be written in multiple lines which is not possible with i/o field. That's the reason Iam using a text editor.
Thanks,
Bhaskar.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |