‎2006 Aug 15 7:09 PM
Hi all,
can any one tell me how to create a free txt in module pool program.
I NEED TO TYPE IN WHATEVER IN NEED AND I NEED TO DISPLAY WHEN I NEED TO DO SO.
Do i need to create a table for that .if yes what should be the fields in the table.
thanks
‎2006 Aug 15 7:13 PM
You can use a text editor container, or you can use a full screen editor. Here is an example program using a text editor in a docking container, it is essentiall the same thing in your module pool program, only you would substitute a custom control instead of the docking container and you would embed a custom container in your screen.
report zrich_0001
no standard page heading.
* Variable for "Text Container" Abap Object
data: editor type ref to cl_gui_textedit,
docking type ref to cl_gui_docking_container.
data: wa_text like tline-tdline.
data: begin of lines occurs 0.
include structure tline.
data: end of lines.
data: textlines like tline-tdline occurs 0.
data: syrepid type sy-repid.
parameters: p_check type c.
at selection-screen output.
syrepid = sy-repid.
check docking is initial.
create object docking
exporting repid = syrepid
dynnr = sy-dynnr
side = docking->dock_at_left
extension = 500.
create object editor
exporting parent = docking.
perform set_text.
start-of-selection.
perform write_text.
************************************************************************
* FORM write_text *
************************************************************************
form write_text.
data: modified type i.
* Retrieve text from container
call method editor->get_text_as_r3table
exporting
only_when_modified = space
importing
table = textlines
is_modified = modified
exceptions
others = 1.
* Write out contents of text editor
leave to list-processing.
loop at textlines into wa_text.
write:/ wa_text.
endloop.
endform.
************************************************************************
* FORM SET_TEXT
************************************************************************
form set_text.
lines-tdline = 'Here we are filling the text editor - Line 1'.
append lines.
lines-tdline = 'Here we are filling the text editor - Line 2'.
append lines.
loop at lines .
shift lines left deleting leading space.
append lines to textlines .
endloop.
* Fill container with text lines
call method editor->set_text_as_r3table
exporting
table = textlines
exceptions
others = 1.
endform.
Regards,
Rich Heilman
‎2006 Aug 15 7:21 PM
Refer to this text edit example program
http://help.sap.com/saphelp_nw2004s/helpdata/en/2a/755b94ca5911d299af5c9604c10e27/content.htm
Regds
Manohar