‎2006 Aug 08 4:29 AM
Hi Experts,
Iam working on dialog program and i have created long text box using "CREATE OBJECT: container EXPORTING container_name = 'TEXTEDIT'."
Now i want to save this text(unlimited text length) into SAP.Can any one tell me how to approach.
Reward guaranteed
thanks
kaki
‎2006 Aug 08 6:03 AM
Hi Kaki,
Check this sample Module pool program.
*-- test program to display a text area thru a custom control
PROGRAM z_test_text .
DATA: txt TYPE REF TO cl_gui_textedit,
txt_con TYPE REF TO cl_gui_custom_container.
DATA: gt_text(100) OCCURS 10 WITH HEADER LINE.
DATA: BEGIN OF it_tab OCCURS 0,
LINE(100),
END OF it_tab.
start-of-selection.
*&---------------------------------------------------------------------*
*& Module STATUS_1000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_1000 OUTPUT.
SET PF-STATUS 'TEXT'.
SET TITLEBAR 'TEXT AREA'.
it_tab-line = 'aaaaaa'.
append it_tab.
it_tab-line = 'bbb'.
append it_tab.
it_tab-line = 'ccc'.
append it_tab.
it_tab-line = 'ddd'.
append it_tab.
it_tab-line = 'aaa'.
append it_tab.
it_tab-line = 'bbb'.
append it_tab.
it_tab-line = 'ccc'.
append it_tab.
it_tab-line = 'ddd'.
append it_tab.
it_tab-line = 'aaa'.
append it_tab.
it_tab-line = 'bbb'.
append it_tab.
it_tab-line = 'ccc'.
append it_tab.
it_tab-line = 'ddd'.
append it_tab.
it_tab-line = 'aaa'.
append it_tab.
it_tab-line = 'bbb'.
append it_tab.
it_tab-line = 'ccc'.
append it_tab.
it_tab-line = 'ddd'.
append it_tab.
it_tab-line = 'aaa'.
append it_tab.
it_tab-line = 'bbb'.
append it_tab.
it_tab-line = 'ccc'.
append it_tab.
it_tab-line = 'ddd'.
append it_tab.
it_tab-line = 'aaa'.
append it_tab.
it_tab-line = 'bbb'.
append it_tab.
it_tab-line = 'ccc'.
append it_tab.
it_tab-line = 'ddd'.
append it_tab.
*-- test display in text area
* gt_text = 'aaa'.
* APPEND gt_text.
*-- populating gt_text from it_tab.
loop at it_tab.
gt_text = it_tab-line.
append gt_text.
endloop.
ENDMODULE. " STATUS_1000 OUTPUT
*&---------------------------------------------------------------------*
*& Module pbo_1000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE pbo_1000 OUTPUT.
DATA: container(30).
container = 'TEXT'.
IF txt IS INITIAL.
CREATE OBJECT txt_con
EXPORTING
container_name = container
EXCEPTIONS
OTHERS = 1.
CREATE OBJECT txt
EXPORTING
parent = txt_con
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
ENDIF.
CALL METHOD txt_con->link
EXPORTING
repid = sy-repid
dynnr = '1000'
container = container.
CALL METHOD txt->set_toolbar_mode
EXPORTING
toolbar_mode = txt->true.
CALL METHOD txt->set_statusbar_mode
EXPORTING
statusbar_mode = txt->true.
CALL METHOD txt->set_wordwrap_behavior
EXPORTING
wordwrap_mode = txt->true.
*-- set text -------------------------------------------
IF gt_text[] IS INITIAL.
ENDIF.
CALL METHOD txt->set_text_as_r3table
EXPORTING
table = gt_text[].
* CALL METHOD txt->set_readonly_mode.
ENDMODULE. " pbo_1000 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_1000 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_1000 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_1000 INPUTuse this code and enter your text , and then get the text as internal table and then use SAVE_TEXT Fm to save it. pass the appropriate parameters.
Regards
vijay
‎2006 Aug 08 4:34 AM
‎2006 Aug 08 5:01 AM
You need to use a TEXT EDIT control (CL_GUI_TEXTEDIT) and place that in the container. There are GET / SET methods for this control using which you can place and get the text in the control.
Once you get the text in the control using GET_TEXT_ASR3TRABLE, pass that text to the SAVE_TEXT and follow it up by COMMIT_TEXT.
The following blog talks about this in detail.
/people/igor.barbaric/blog/2005/06/06/the-standard-text-editor-oo-abap-cfw-class
Regards,
Ravi
‎2006 Aug 08 5:34 AM
hi
good
go through the following link
http://help.sap.com/saphelp_nw04/helpdata/en/10/b44859c58c11d291c80000e8a5f6e6/content.htm
http://dev.mysql.com/doc/maxdb/en/29/13f76ebe7b11d6b2a200508b5d5c51/content.htm
thanks
mrutyun
‎2006 Aug 08 6:03 AM
Hi Kaki,
Check this sample Module pool program.
*-- test program to display a text area thru a custom control
PROGRAM z_test_text .
DATA: txt TYPE REF TO cl_gui_textedit,
txt_con TYPE REF TO cl_gui_custom_container.
DATA: gt_text(100) OCCURS 10 WITH HEADER LINE.
DATA: BEGIN OF it_tab OCCURS 0,
LINE(100),
END OF it_tab.
start-of-selection.
*&---------------------------------------------------------------------*
*& Module STATUS_1000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_1000 OUTPUT.
SET PF-STATUS 'TEXT'.
SET TITLEBAR 'TEXT AREA'.
it_tab-line = 'aaaaaa'.
append it_tab.
it_tab-line = 'bbb'.
append it_tab.
it_tab-line = 'ccc'.
append it_tab.
it_tab-line = 'ddd'.
append it_tab.
it_tab-line = 'aaa'.
append it_tab.
it_tab-line = 'bbb'.
append it_tab.
it_tab-line = 'ccc'.
append it_tab.
it_tab-line = 'ddd'.
append it_tab.
it_tab-line = 'aaa'.
append it_tab.
it_tab-line = 'bbb'.
append it_tab.
it_tab-line = 'ccc'.
append it_tab.
it_tab-line = 'ddd'.
append it_tab.
it_tab-line = 'aaa'.
append it_tab.
it_tab-line = 'bbb'.
append it_tab.
it_tab-line = 'ccc'.
append it_tab.
it_tab-line = 'ddd'.
append it_tab.
it_tab-line = 'aaa'.
append it_tab.
it_tab-line = 'bbb'.
append it_tab.
it_tab-line = 'ccc'.
append it_tab.
it_tab-line = 'ddd'.
append it_tab.
it_tab-line = 'aaa'.
append it_tab.
it_tab-line = 'bbb'.
append it_tab.
it_tab-line = 'ccc'.
append it_tab.
it_tab-line = 'ddd'.
append it_tab.
*-- test display in text area
* gt_text = 'aaa'.
* APPEND gt_text.
*-- populating gt_text from it_tab.
loop at it_tab.
gt_text = it_tab-line.
append gt_text.
endloop.
ENDMODULE. " STATUS_1000 OUTPUT
*&---------------------------------------------------------------------*
*& Module pbo_1000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE pbo_1000 OUTPUT.
DATA: container(30).
container = 'TEXT'.
IF txt IS INITIAL.
CREATE OBJECT txt_con
EXPORTING
container_name = container
EXCEPTIONS
OTHERS = 1.
CREATE OBJECT txt
EXPORTING
parent = txt_con
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
ENDIF.
CALL METHOD txt_con->link
EXPORTING
repid = sy-repid
dynnr = '1000'
container = container.
CALL METHOD txt->set_toolbar_mode
EXPORTING
toolbar_mode = txt->true.
CALL METHOD txt->set_statusbar_mode
EXPORTING
statusbar_mode = txt->true.
CALL METHOD txt->set_wordwrap_behavior
EXPORTING
wordwrap_mode = txt->true.
*-- set text -------------------------------------------
IF gt_text[] IS INITIAL.
ENDIF.
CALL METHOD txt->set_text_as_r3table
EXPORTING
table = gt_text[].
* CALL METHOD txt->set_readonly_mode.
ENDMODULE. " pbo_1000 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_1000 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_1000 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_1000 INPUTuse this code and enter your text , and then get the text as internal table and then use SAVE_TEXT Fm to save it. pass the appropriate parameters.
Regards
vijay
‎2006 Aug 08 7:17 AM
Hi Vijay,
Thanks for the good example.
Iam able to get the data into container from gt_text.
But how to get the text data(container data) into internal table? So that i can pass itab into Save text FM.
What i need to consider in PAI?
Thanks
kaki
‎2006 Aug 08 7:57 AM
Hello Kaki,
Adding to Vijay's Example
use method,
CALL METHOD txt->get_text_as_r3table
importing
table = gt_text[].
regards,
Naimesh
‎2006 Aug 08 8:01 AM
Hi Kaki,
as suggested by Naimesh you can call the method get_text_as_r3table and the internal table will have the text , use the text table and pass it to the FM save_text.
Regards
vijay D T T.
‎2006 Aug 10 3:20 AM