2009 Jan 13 9:18 AM
hi all!
I nead a sample fm /program for text editor with save button and cancek\l buttons ??
thanks in advance
2009 Jan 13 9:22 AM
hi all!
I nead a sample fm /program for text editor with save button and cancek\l buttons ??
thanks in advance
2009 Jan 13 9:22 AM
2009 Jan 13 9:51 AM
hai dharma raj
i am posting the sample program for text editor ..you have to create a custom control in your screen
and you have to modify the program for where ever necessary for your requirement .
REPORT ZCUSTOMCONTROL.
CLASS event_handler DEFINITION. " Definition for a class
PUBLIC SECTION.
METHODS: handle_f1 FOR EVENT f1 OF cl_gui_textedit IMPORTING sender,
handle_f4 FOR EVENT f4 OF cl_gui_textedit IMPORTING sender.
ENDCLASS.
DATA: ok_code LIKE sy-ucomm,
save_ok LIKE sy-ucomm.
DATA: init,
container TYPE REF TO cl_gui_custom_container, " custom container
editor TYPE REF TO cl_gui_textedit.
DATA: event_tab TYPE cntl_simple_events, " type groups
event TYPE cntl_simple_event.
DATA: line(256),
text_tab LIKE STANDARD TABLE OF line,
field LIKE line.
DATA handle TYPE REF TO event_handler. " class
START-OF-SELECTION.
line = 'First line in TextEditControl'.
APPEND line TO text_tab.
line = 'i am a abaper'.
APPEND line TO text_tab.
line = 'hai'.
append line TO text_tab.
CALL SCREEN 100." in the screen create a custom control .
----
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
module STATUS_0100 output.
SET PF-STATUS 'STATUS'.
SET TITLEBAR 'xxx'.
data : ok like sy-ucomm.
case ok .
when 'BACK'.
leave program .
when 'SAVE'.
INSERT operation . " perform insert operation using insert key word
when 'EXIT'.
leave program .
ENDCASE.
IF init is initial.
init = 'X'.
CREATE OBJECT :container EXPORTING container_name = 'TEXTEDIT',
editor EXPORTING parent = container,
handle.
event-eventid = cl_gui_textedit=>event_f1.
event-appl_event = ' '. "system event
APPEND event TO event_tab.
event-eventid = cl_gui_textedit=>event_f4.
event-appl_event = 'X'. "applicationevent.
APPEND event TO event_tab.
CALL METHOD: editor->set_registered_events EXPORTING events = event_tab.
SET HANDLER handle->handle_f1
handle->handle_f4 FOR editor.
ENDIF.
CALL METHOD editor->set_text_as_stream EXPORTING text = text_tab.
endmodule. " STATUS_0100 OUTPUT
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
----
***INCLUDE ZCUSTOMCONTROL_USER_I01 .
----
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
module USER_COMMAND_0100 input.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'INSERT'. " THIS IS THE ICON IN THE TEXT EDITOR
SO IF YOU WANT INSERT CODE HERE
YOU CAN DO IT SO
CALL METHOD editor->get_text_as_stream IMPORTING text = text_tab.
WHEN 'F1'.
MESSAGE i888(sabapdocu) WITH text-001.
WHEN OTHERS.
MESSAGE i888(sabapdocu) WITH text-002.
CALL METHOD cl_gui_cfw=>dispatch.
ENDCASE.
SET SCREEN 100.
ENDMODULE.
CLASS event_handler IMPLEMENTATION.
METHOD handle_f1.
DATA row TYPE i.
MESSAGE i888(sabapdocu) WITH text-003.
CALL METHOD sender->get_selection_pos IMPORTING from_line = row.
CALL METHOD sender->get_line_text
EXPORTING line_number = row IMPORTING text = field.
CALL METHOD cl_gui_cfw=>set_new_ok_code EXPORTING new_code = 'F1'.
CALL METHOD cl_gui_cfw=>flush.
ENDMETHOD.
METHOD handle_f4.
DATA row TYPE i.
MESSAGE i888(sabapdocu) WITH text-004.
CALL METHOD sender->get_selection_pos IMPORTING from_line = row.
CALL METHOD sender->get_line_text EXPORTING line_number = row IMPORTING text = field.
CALL METHOD cl_gui_cfw=>flush.
ENDMETHOD.
ENDCLASS.
" USER_COMMAND_0100 INPUT
REGARDS
CHINNAIYA
2009 Jan 13 10:03 AM
Hi,
U can use the class
data g_text_editor type ref to cl_gui_textedit.
CREATE OBJECT g_text_editor
EXPORTING
parent = g_text_container
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
CALL METHOD g_text_editor->set_toolbar_mode
EXPORTING
toolbar_mode = 0.
CALL METHOD g_text_editor->set_statusbar_mode
EXPORTING
statusbar_mode = 0.
I think it may helpful to you.
Thanks,
2009 Jan 14 4:38 AM
hi,
Try out FM TERM_CONTROL_EDIT.
TYPES: BEGIN OF mytable_line,
line(72) TYPE c,
END OF mytable_line.
data: mytable TYPE TABLE OF mytable_line.
CALL FUNCTION 'TERM_CONTROL_EDIT'
EXPORTING
TITEL = 'ABC'
LANGU = sy-langu
TABLES
textlines = mytable
EXCEPTIONS
USER_CANCELLED = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endif.
2009 Jan 14 5:07 AM
Hi,
Have a look @:-
DATA: objtxt like SOLISTI1 occurs 0 with header line.
start-of-selection.
editor-call for objtxt.
Regards
Raju chitale