Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

TEXT BOX

Former Member
0 Kudos

Hi guyz,

i have a requirement to create Text Editor in my screen which should save the data and display when asked according to the item. the text editor should look like the one that we have in ME21N or VA01 (in Texts Tab). How do i create this and save the data in there. Please help.

Thanks in Advance.

Regards,

Santosh Kotra.

5 REPLIES 5

Former Member
0 Kudos

First you have to create a text object and text id. (T-Code: SE75)

Then use the function modules: READ_TEXT, EDIT_TEXT and SAVE_TEXT to read from the text object, display the editor and edit the text and save the text respectively.

0 Kudos

Hi Manjoj,

thanks for the reply but the function mod. EDIT_TEXT would give me the full screen editor. But as i mentioned i need the editor to be like the one we see in ME21n or VA01.

0 Kudos

You can use the class CL_GUI_TEXTEDIT for that. Please refer to the program BC_CONTROLS_TUTORIAL.

Manoj

Former Member
0 Kudos

Hi,

Check program "DEMO_CUSTOM_CONTROL"

also check http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCITEXTEDIT/BCCITEXTEDIT.pdf

Your purpose will be solved.....

Reward if useful...

thanks

Chetan Shah

jaideeps
Advisor
Advisor
0 Kudos

hi,,

example for text edit custom controll..

cLASS event_handler DEFINITION.

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,

editor TYPE REF TO cl_gui_textedit.

DATA: event_tab TYPE cntl_simple_events,

event TYPE cntl_simple_event.

DATA: line(256) TYPE c,

text_tab LIKE STANDARD TABLE OF line,

field LIKE line.

DATA handle TYPE REF TO event_handler.

  • Reporting Events ***************************************************

START-OF-SELECTION.

line = 'First line in TextEditControl'.

APPEND line TO text_tab.

line = '----


'.

APPEND line TO text_tab.

line = '...'.

APPEND line TO text_tab.

CALL SCREEN 100.

  • Dialog Modules *****************************************************

MODULE status_0100 OUTPUT.

SET PF-STATUS 'SCREEN_100'.

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'. "application event

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.

MODULE cancel INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE user_command_0100 INPUT.

save_ok = ok_code.

CLEAR ok_code.

CASE save_ok.

WHEN 'INSERT'.

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. "for application events

MESSAGE i888(sabapdocu) WITH text-003.

ENDCASE.

SET SCREEN 100.

ENDMODULE.

  • Class Implementations **********************************************

CLASS event_handler IMPLEMENTATION.

METHOD handle_f1.

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=>set_new_ok_code "raise PAI for

EXPORTING new_code = 'F1'. "system events

CALL METHOD cl_gui_cfw=>flush.

ENDMETHOD.

METHOD handle_f4.

DATA row TYPE i.

MESSAGE i888(sabapdocu) WITH text-005.

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.

thanks

jaideep

*reward points if useful...