Text Editor on modulepool Screen
Hi,
my requirement is to have two input fields on the screen where the user can input some text. when the user comes to the end of one field the cursor should automatically to the next input field.
How to do this one.
I thought of placing an text editor on the screen, can anybody give some sample code to place the text editor on the screen and at the desired position in my case it is in the middle of the screen...
Thanks and Regards,
Kiran Kumar
To put text editor on moudule pool screen,
1. Add 'custom control' element on Screen : name it as TEXTEDITOR1.
2. Declare the variable in TOP include as
DATA :
g_editor TYPE REF TO cl_gui_textedit, " Text Editor
g_editor_container TYPE REF TO cl_gui_custom_container, "Container For Text Editor
"Variables to Get the Content of the Text Box Editor
DATA: line TYPE solisti1.
DATA : it_editor TYPE STANDARD TABLE OF line.
3. Put following code in PBO as
IF g_editor IS INITIAL.
CREATE OBJECT g_editor_container
EXPORTING
container_name = 'TEXTEDITOR1'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
ENDIF.
" TextEdit Control
CREATE OBJECT g_editor
EXPORTING
parent = g_editor_container
wordwrap_mode =
" cl_gui_textedit=>wordwrap_off
cl_gui_textedit=>wordwrap_at_fixed_position
" cl_gui_textedit=>WORDWRAP_AT_WINDOWBORDER
wordwrap_position = 128
wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
ENDIF.
4. Now to Retireve data from Editor in PAI write:
CLEAR it_editor.
"Method to retrieve table from control (Text From Editor in IT_EDITOR)
CALL METHOD g_editor->get_text_as_r3table
" EXPORTING
" ONLY_WHEN_MODIFIED = FALSE
IMPORTING
table = it_editor
" IS_MODIFIED =
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
error_dp_create = 3
potential_data_loss = 4
OTHERS = 5
Similar Messages
-
OBJECT_OBJREF_NOT_ASSIGNED for Text editor
We tried to use Text editor on a Screen which is RF enabled. It is working fine when we work in SAP. When this is being connected from LM01 the below error message is coming.
Runtime error: OBJECT_OBJREF_NOT_ASSIGNED
Exception: CX_SY_REF_INITIAL
The code:
IF g_editor IS INITIAL.
*-- Create custom Container
CREATE OBJECT g_editor_container
EXPORTING
container_name = 'EDITOR'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
IF sy-subrc <> 0.
ENDIF.
*-- Create Text Editor
CREATE OBJECT g_editor
EXPORTING
style = 0
max_number_chars = 28
wordwrap_mode = 2
wordwrap_position = 14
wordwrap_to_linebreak_mode = cl_gui_textedit=>false
parent = g_editor_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
gui_type_not_supported = 5
OTHERS = 6
IF sy-subrc <> 0.
ENDIF.
*-- Remove text editor toolbar
CALL METHOD g_editor->set_toolbar_mode
EXPORTING
toolbar_mode = cl_gui_textedit=>false
EXCEPTIONS
error_cntl_call_method = 1
invalid_parameter = 2
OTHERS = 3.
*--Remove text editor status bar
CALL METHOD g_editor->set_statusbar_mode
EXPORTING
statusbar_mode = cl_gui_textedit=>false
EXCEPTIONS
error_cntl_call_method = 1
invalid_parameter = 2
OTHERS = 3.
ENDIF.
Can someone please suggest what is missing here.
Thanks,
NKumarHi,
Looking at the code the problem seems to be at:
==============
IF g_editor IS INITIAL.
Create custom Container
CREATE OBJECT g_editor_container
EXPORTING
container_name = 'EDITOR'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
IF sy-subrc 0.
ENDIF.
Create Text Editor
CREATE OBJECT g_editor
EXPORTING
style = 0
max_number_chars = 28
wordwrap_mode = 2
wordwrap_position = 14
wordwrap_to_linebreak_mode = cl_gui_textedit=>false
parent = g_editor_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
gui_type_not_supported = 5
OTHERS = 6
IF sy-subrc 0.
ENDIF.
Remove text editor toolbar
CALL METHOD g_editor->set_toolbar_mode " This point
EXPORTING
toolbar_mode = cl_gui_textedit=>false
EXCEPTIONS
error_cntl_call_method = 1
invalid_parameter = 2
OTHERS = 3.
*--Remove text editor status bar
CALL METHOD g_editor->set_statusbar_mode " This point
EXPORTING
statusbar_mode = cl_gui_textedit=>false
EXCEPTIONS
error_cntl_call_method = 1
invalid_parameter = 2
OTHERS = 3.
ENDIF.
===============
You are creating the object "g_editor" and catching the exception. I think create object for g_editor is failing and since you are not checking this it is causing the problem.
You can fix the code as follows:
=====
IF g_editor IS INITIAL.
Create custom Container
CREATE OBJECT g_editor_container
EXPORTING
container_name = 'EDITOR'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
IF sy-subrc 0.
ENDIF.
Create Text Editor
CREATE OBJECT g_editor
EXPORTING
style = 0
max_number_chars = 28
wordwrap_mode = 2
wordwrap_position = 14
wordwrap_to_linebreak_mode = cl_gui_textedit=>false
parent = g_editor_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
gui_type_not_supported = 5
OTHERS = 6
IF sy-subrc 0. -
> put the below code under this if. That means the code is executed only
if g_editor is created.
Remove text editor toolbar
CALL METHOD g_editor->set_toolbar_mode " This point
EXPORTING
toolbar_mode = cl_gui_textedit=>false
EXCEPTIONS
error_cntl_call_method = 1
invalid_parameter = 2
OTHERS = 3.
*--Remove text editor status bar
CALL METHOD g_editor->set_statusbar_mode " This point
EXPORTING
statusbar_mode = cl_gui_textedit=>false
EXCEPTIONS
error_cntl_call_method = 1
invalid_parameter = 2
OTHERS = 3.
ENDIF.
ENDIF.
===== -
Clear the Text in text editors
Hi all,
I had an requirement like 5 subscreens in a main screen.
There i am maintaining text editors into 5 screens.
where i am creating the one editor and using the same for all the 5 screens.
But the problem is when i am changing the tabs for subscreens the text in the Text editor
is visible from the previous screen because i am not clearing the text editor.
I dont know how to handle this scenario.
will anybody let mek now how to handle to clear the text editors.
Regards,
MadhaviHi,
when you are calling new subscreen (choosing different tabstrip), the PBO is executed. So just clear the content in the PBO. It is just enough to remember the OK_code(from PAI of previous tabstrip/subscreen) performed when you click on different tabstrip and check then in PBO this saved ok_code.
If you don't know how to obtain ok_code value when you click on different tabstrip, just execute code "/h" in the input parameter where you put down tcodes before you click on the tabstrip. Tcode "/h" turn on debugging mode. Then you can get the value of ok_code in the debugger.
Regards,
Karol
Edited by: Karol Seman on Nov 22, 2008 1:50 PM -
My requirement is to show a text editor on the screen.allow the user to type in it. (Example he type n lines). Store the content in D/B table. Next time i display the screen, all n lines should be displayed.Now if he enters m lines in addition to n lines ... then i should display n+m lines in the text editor.
How can i do that.Hi Karthik,
Go through program <b>RSDEMO_DRAG_DROP_EDIT_TREE</b>.
Reward if this helps,
Satish -
is there any class available for displaying text in the text editor on the screen.
found my self
<b>
call method text_editor->set_text_as_r3table
</b> -
Options -> Text Editor -> C/C++ missing intellisense entry. Intellisense not working. Solutions to turn options for the editor off and on are not working. The intellisense entry is present for other languages,
such as C#, but not C/C++.
By not working, I mean the intellisense right click menu items are grayed out, and intellisense files are not produced.Hi JerroldBrody,
Thank you for posting in MSDN forum.
>>I mean the intellisense right click menu items are grayed out, and intellisense files are not produced.
Based on your issue, could you please share me a screen shot about the intellisense right click menu items are grayed out?
Generally, I know that it is default that we can enable the intellisense for C/C++ by going to the TOOLS->Options -> Text Editor -> C/C++ ->Advanced-> IntelliSense like the following screen shot.
So please try to check if you set Disable Intellisense property as False in the VS IDE.
Best Regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Text editor in Score module agonizingly clunky! Fix?
When creating scores from midi regions, the text editor drives me nuts when adding lyrics: The word/character positioning is different between text edit/create mode and what appears on the screen after editing, and different again between that and what appears in print preview mode or actual print-out. This is absolutely crazy-making when trying to line words/syllables up with their corresponding notations!
Also the cut & paste functions don't work as in any other text editor I've seen.
Also-also I can't get it to accept a new default font and size.
Suggestions? Dr. Kevorkian's phone number?
Thanks!Hi,
it looks like you have some problem with RFC. It stopped on the following line:
* Communication error in RFC-Call
message x628(ke) with 'RFC_ERROR' subrc msg_text.
Ask your basis guy to check it. The job on application server tried to connect to the central instance and it failed. The job run on central instance does not need to make any RFC call. Hence there is no problem in this case.
Regards -
Text Editor using cl_gui_textedit
Hi,
I need a text editor box on selection screen in display mode. and I'm using cl_gui_textedit class to get it.. but for some reason its not working.
Here is the code below -
report YLTEST1
no standard page heading line-size 255.
DATA: g_text_editor TYPE REF TO cl_gui_textedit,
g_text_container TYPE REF TO cl_gui_custom_container,
g_gen_text_editor TYPE REF TO cl_gui_textedit,
g_gen_text_container TYPE REF TO cl_gui_custom_container.
DATA: WORDWRAP_POSITION LIKE CL_GUI_TEXTEDIT=>M_WORDWRAP_POSITION.
data: g_gen_txt_container TYPE scrfname VALUE 'GENERAL_TEXT_FOR_REPS'.
DATA: TEXT_TAB TYPE STANDARD TABLE OF LINE.
parameters: p_check.
at selection-screen output.
Create sales Text container
WORDWRAP_POSITION = 100.
IF G_GEN_TEXT_CONTAINER IS INITIAL.
CREATE OBJECT:
G_GEN_TEXT_CONTAINER EXPORTING CONTAINER_NAME = G_GEN_TXT_CONTAINER,
G_GEN_TEXT_EDITOR EXPORTING PARENT = G_GEN_TEXT_CONTAINER
WORDWRAP_MODE = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION
WORDWRAP_POSITION = WORDWRAP_POSITION
WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>TRUE.
ENDIF.
IF not G_GEN_TEXT_CONTAINER IS INITIAL.
Set container options
CALL METHOD: G_GEN_TEXT_EDITOR->SET_TOOLBAR_MODE
EXPORTING TOOLBAR_MODE = 0,
G_GEN_TEXT_EDITOR->SET_READONLY_MODE
EXPORTING READONLY_MODE = 1,
G_GEN_TEXT_EDITOR->SET_STATUSBAR_MODE
EXPORTING STATUSBAR_MODE = 0,
G_GEN_TEXT_EDITOR->SET_AUTOINDENT_MODE
EXPORTING AUTO_INDENT = 1.
Pass the text to the sales text container
CALL METHOD G_GEN_TEXT_EDITOR->SET_TEXT_AS_STREAM
EXPORTING
TEXT = TEXT_TAB.
endif.Try this way:
DATA: lo_dock TYPE REF TO cl_gui_docking_container.
DATA: lo_text_editor TYPE REF TO cl_gui_textedit.
DATA: lt_tab TYPE STANDARD TABLE OF char80.
DATA: la_tab LIKE LINE OF lt_tab.
DATA: w_carrid TYPE sflight-carrid.
** Selection Screen
SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME TITLE aaa.
SELECT-OPTIONS: s_carrid FOR w_carrid.
SELECTION-SCREEN: END OF BLOCK blk1.
INITIALIZATION.
* Docking container
CHECK lo_dock IS INITIAL.
CREATE OBJECT lo_dock
EXPORTING
repid = sy-cprog
dynnr = sy-dynnr
ratio = 80
side = cl_gui_docking_container=>dock_at_bottom
name = 'DOCK_CONT'.
IF sy-subrc <> 0.
MESSAGE 'Error in the Docking control' TYPE 'S'.
ENDIF.
* Text Editor
CREATE OBJECT lo_text_editor
EXPORTING
parent = lo_dock
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
gui_type_not_supported = 5
OTHERS = 6
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set text
la_tab = 'This is test'.
APPEND la_tab TO lt_tab.
CALL METHOD lo_text_editor->set_text_as_r3table
EXPORTING
table = lt_tab
EXCEPTIONS
error_dp = 1
error_dp_create = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Naimesh Patel -
How to clear the text in the Text Editor
Hi all,
I created a Text editor and also i am having language field in the screen.
whenever i change the language auomatically the text has to change when the text exists for that
language.
this is working fine, but when the Text exist , the text editor should be blank.
But it is carrying the Previous editor text itself into it .
How to clear the text in the Editor.
Regards,
MadhaviHello Madhavi
The simple report ZUS_SDN_TEXTEDIT_CONTROL shows how to switch the texteditor contents when changing the language.
*& Report ZUS_SDN_TEXTEDIT_CONTROL
*& Thread: how to clear the text in the Text Editor
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1145272"></a>
*& By default the itab GT_OUTTAB contains texts in DE and EN.
*& To switch the language directly enter into the command window:
*& LANGU=DE, LANGU=EN or LANGU=FR
REPORT zus_sdn_textedit_control.
TYPE-POOLS: abap.
TYPES: ty_t_text TYPE TABLE OF as4text
WITH DEFAULT KEY.
TYPES: BEGIN OF ty_s_outtab.
TYPES: language TYPE spras.
TYPES: text TYPE ty_t_text.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab
WITH DEFAULT KEY.
DATA: gt_outtab TYPE ty_t_outtab,
gs_outtab TYPE ty_s_outtab.
DATA: gd_language TYPE spras.
DATA: go_docking TYPE REF TO cl_gui_docking_container,
go_textedit TYPE REF TO cl_gui_textedit.
DATA: gd_okcode TYPE ui_func,
gd_repid TYPE syst-repid.
START-OF-SELECTION.
PERFORM fill_texts.
gd_language = syst-langu.
PERFORM init_controls.
* Link the docking container to the target dynpro
gd_repid = syst-repid.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM set_text_editor.
* NOTE: dynpro does not contain any elements
" ok-code => GD_OKCODE
CALL SCREEN '0100'.
* Flow logic of dynpro (does not contain any dynpro elements):
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
TRANSLATE gd_okcode TO UPPER CASE.
CASE gd_okcode.
WHEN 'BACK' OR
'EXIT' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'LANGU=DE' OR
'LANGU=EN' OR
'LANGU=FR'.
PERFORM get_text_editor.
SPLIT gd_okcode AT '=' INTO gd_okcode gd_language.
PERFORM set_text_editor.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form FILL_TEXTS
* text
* --> p1 text
* <-- p2 text
FORM fill_texts .
* define local data
DATA: ld_string TYPE string.
gs_outtab-language = 'EN'. REFRESH: gs_outtab-text.
ld_string = 'Good morning'.
APPEND ld_string TO gs_outtab-text.
APPEND gs_outtab TO gt_outtab.
gs_outtab-language = 'DE'. REFRESH: gs_outtab-text.
ld_string = 'Guten Morgen'.
APPEND ld_string TO gs_outtab-text.
APPEND gs_outtab TO gt_outtab.
gs_outtab-language = 'FR'. REFRESH: gs_outtab-text.
ld_string = space.
APPEND ld_string TO gs_outtab-text.
APPEND gs_outtab TO gt_outtab.
ENDFORM. " FILL_TEXTS
*& Form INIT_CONTROLS
* text
* --> p1 text
* <-- p2 text
FORM init_controls .
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
* repid =
* dynnr =
* side = dock_at_left
* extension = 50
* style =
* lifetime = lifetime_default
* caption =
* metric = 0
ratio = 90
* no_autodef_progid_dynnr =
* name =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_textedit
EXPORTING
* max_number_chars =
* style = 0
* wordwrap_mode = wordwrap_at_windowborder
* wordwrap_position = -1
* wordwrap_to_linebreak_mode = false
* filedrop_mode = dropfile_event_off
parent = go_docking
* lifetime =
* name =
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
gui_type_not_supported = 5
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " INIT_CONTROLS
*& Form SET_TEXT_EDITOR
* text
* --> p1 text
* <-- p2 text
FORM set_text_editor .
BREAK-POINT.
CLEAR: gs_outtab.
READ TABLE gt_outtab INTO gs_outtab
WITH KEY language = gd_language.
CALL METHOD go_textedit->set_text_as_stream
EXPORTING
text = gs_outtab-text
EXCEPTIONS
error_dp = 1
error_dp_create = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " SET_TEXT_EDITOR
*& Form GET_TEXT_EDITOR
* text
* --> p1 text
* <-- p2 text
FORM get_text_editor .
CLEAR: gs_outtab.
CALL METHOD go_textedit->get_text_as_stream
EXPORTING
only_when_modified = cl_gui_textedit=>true
IMPORTING
text = gs_outtab-text
* is_modified =
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
MODIFY gt_outtab FROM gs_outtab
TRANSPORTING text
WHERE ( language = gd_language ).
ENDFORM. " GET_TEXT_EDITOR
Regards
Uwe -
How to call a text editor from a module pool program
Hi All,
I want to call the text editor from my modulepool program. Enter my text in it and save it.This text needs to be saved in a Z-program with 2 fields as primary keys. The next time while I call this same record from this z table, I need to fetch the existing text and display it.
The user now can put in additional text and can again save it. This process thus goes on..
If anyone has worked in this type of scenario, then please help me in doing this.
Useful answers will surely be rewarded.
Thanks,
Susanth.Hi Sushanth,
We save the text not as fields in a ztable directly but as a text.Please check the format below since it is based on a working code....
first you need to create a text in s010 transaction...
there should be some key based on which you plan to save the text..imagine it is Purchase order then..PO+item numner is always unique.eg:0090010(900PO/item10).so in the code you can append these two and they will be unique..so you can always retrieve them,overwrite,save them anytime you need
**************data declarations
TYPES: BEGIN OF TY_EDITOR,
EDIT(254) TYPE C,
END OF TY_EDITOR.
data: int_line type table of tline with header line.
data: gw_thead like thead.
data: int_table type standard table of ty_editor.
****************fill header..from SO10 t-code..when you save you need the unique key..youfill it here and pass it in save_text function module
GW_THEAD-TDNAME = loc_nam. " unique key for the text -> our unique key to identify the text
GW_THEAD-TDID = 'ST'. " Text ID from SO10
GW_THEAD-TDSPRAS = SY-LANGU. "current language
GW_THEAD-TDOBJECT = 'ZXXX'. "name of the text object created in SO10
*To Read from Container and get data to int_table
CALL METHOD EDITOR ->GET_TEXT_AS_R3TABLE
IMPORTING
TABLE = int_table
EXCEPTIONS
ERROR_DP = 1
ERROR_CNTL_CALL_METHOD = 2
ERROR_DP_CREATE = 3
POTENTIAL_DATA_LOSS = 4
others = 5.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop data from int_table and save to int_line-tdline appending it.
*save the text
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
HEADER = GW_THEAD
TABLES
LINES = InT_LINE
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5.
IF SY-SUBRC 0.
ENDIF.
*To pass to Container
CALL METHOD EDITOR ->SET_TEXT
hope that the above sample with helps you solve the problem
Please check and revert,
Reward if helpful
Regards
Byju -
How to create a text editor, the one like header text in PO
Dear Ones,
My requirement is that I want to create a text editor for storing terms and condition plant wise.
The editor should be the one like header text in PO. It can take end number of lines.
I created the text object ('TERMS') in table ttxob and text for it in table ttxot.
Also created text id ('L000' and 'L001') in table ttxid and text for it in table ttxit.
Now using FM read_text, save_text and edit_text, I have written a program but it does not save the data.
When I run the program initially it displays me blank, then I enter some data into it. Again when I come back it displays the data and also saves the edition. But if I close my session the data is gone.
It means it is not actually saving the data in database. My code is as below:
*& Report ZAK_TEXT_EDITOR
REPORT zak_text_editor.
DATA : head TYPE STANDARD TABLE OF thead WITH HEADER LINE,
line TYPE STANDARD TABLE OF tline WITH HEADER LINE.
DATA : tdname TYPE thead-tdname.
SELECTION-SCREEN : BEGIN OF BLOCK blk WITH FRAME TITLE text-001.
SELECTION-SCREEN : SKIP 1.
PARAMETERS : id TYPE thead-tdid OBLIGATORY
MATCHCODE OBJECT zak_textid.
SELECTION-SCREEN : SKIP 1.
SELECTION-SCREEN : END OF BLOCK blk.
START-OF-SELECTION.
CONCATENATE 'TERMS' id INTO tdname.
head-tdobject = 'TERMS'.
head-tdname = tdname.
head-tdid = id.
head-tdspras = sy-langu.
head-tdlinesize = 132.
APPEND head.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = id
language = sy-langu
name = tdname
object = 'TERMS'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
TABLES
lines = line
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = head
INSERT = ' '
SAVEMODE_DIRECT = ' '
OWNER_SPECIFIED = ' '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
TABLES
lines = line
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5.
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.
CALL FUNCTION 'EDIT_TEXT'
EXPORTING
DISPLAY = ' '
EDITOR_TITLE = ' '
header = head
PAGE = ' '
WINDOW = ' '
save = 'X'
LINE_EDITOR = ' '
CONTROL = ' '
PROGRAM = ' '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
RESULT =
TABLES
lines = line
EXCEPTIONS
id = 1
language = 2
linesize = 3
name = 4
object = 5
textformat = 6
communication = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.CONSTANTS:
line_length TYPE i VALUE 254.
DATA: ok_code LIKE sy-ucomm.
DATA:
Create reference to the custom container
custom_container TYPE REF TO cl_gui_custom_container,
Create reference to the TextEdit control
editor TYPE REF TO cl_gui_textedit,
repid LIKE sy-repid.
START-OF-SELECTION.
SET SCREEN '100'.
MODULE USER_COMMAND_0100 INPUT *
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
The TextEdit control should only be initialized the first time the
PBO module executes
IF editor IS INITIAL.
repid = sy-repid.
Create obejct for custom container
CREATE OBJECT custom_container
EXPORTING
container_name = 'MYCONTAINER1'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Create obejct for the TextEditor control
CREATE OBJECT editor
EXPORTING
wordwrap_mode =
cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_position = line_length
wordwrap_to_linebreak_mode = cl_gui_textedit=>true
parent = custom_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
gui_type_not_supported = 5
others = 6
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT -
How to get information from a text editor in the SAP standard transactions
Hi SAP gurus I have a requirement in which it is required to gte the information from a text editor(which is not a field) in mm02 (click on) goto Purchase Order Text in this view there is a text editor there is some text in te the text editor i have to get that information in a table can it be done if so please give example and steps
Points will be given to useful informationAh yes, excellent question, and not really a clear cut answer. In my experience, the easiest way to find this information is to simply create the text using the standard transaction, in this case MM02. Then go to transaction SE16, using table STXH, do a query on this table, entering your user name, and today's date as the creation date. The results should show the text that you just created, now you can see the object, id, and the way the name is being used here.
I also understand that in some cases, there is a button next to the editor in the screen which gives you some idea of these values, but this is not implemented everywhere, and I believe that I've only seen this in one place, can't remember where, but the first solution above will always work for you.
Regards,
Rich Heilman -
CL_GUI_TEXTEDIT - Text Editor is having old text..
Hello Experts,
I have created a text editor using the standard class CL_GUI_TEXTEDIT and invoking the same in two different places.
In-order to use the text editor screen it in two places i have used FREE <obj> foor clearing the object.
My problem is, whenever i am using the texteditor screen in both a places for the first time, the data is populated perfectly and if i come to the same screen again the text editor populated with old entries...
I am clearing the object using the keyword FREE.
I fould lot of threads for this issue, but still i am not able to figure out the issue.
I need all your suggestions to fix this.
Thanks in advance!
Rgds,
BenuHi,
I have the same problem and did call the FREE Method and the FREE object.
The Problem is that my textedit control does not appear any more after those statements...
do I have to re-init the control? and how? this code i do after the FREE statements in the PBO of a dynpro
* Container anlegen
CREATE OBJECT go_custom_container
EXPORTING
container_name = 'CONTAINER_1'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
RAISE general_fault.
ENDIF.
* Textedit anlegen
CREATE OBJECT go_textedit_control
EXPORTING
parent = go_custom_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
gui_type_not_supported = 5
OTHERS = 6.
IF sy-subrc <> 0.
RAISE general_fault.
ENDIF.
* Eingabemodus auf "read-only" setzen
CALL METHOD go_textedit_control->set_readonly_mode
EXPORTING
readonly_mode = 1.
* Toolbarmodus setzen (1 = an, 0 = aus)
CALL METHOD go_textedit_control->set_toolbar_mode
EXPORTING
toolbar_mode = 1.
Thanks and regards,
Daniel -
Is it possible to call the TEXT EDITOR in a program?
Hi,
I want a function module which will popup a text editor where the user can write some text and then i can use this text for further processing.
do we have any such function modules or text editor which i can call from the program to take long text inputs from the user?
thanks in advanceYou can use the Class CL_GUI_TEXTEDIT
REPORT YTEST.
*module create_container_pbo_2000 output.
DATA:
obj_cust_cont_credential TYPE REF TO cl_gui_custom_container,
* obj_cust_cont_character TYPE REF TO cl_gui_custom_container,
* obj_cust_cont_preempmnt TYPE REF TO cl_gui_custom_container,
obj_text_cred TYPE REF TO cl_gui_textedit,
* obj_text_char TYPE REF TO cl_gui_textedit,
* obj_text_pemp TYPE REF TO cl_gui_textedit,
* Internal table to hold text for container reason1
BEGIN OF i_table_text OCCURS 0,
line(132) TYPE c, " Line text
END OF i_table_text,
* Internal table to hold text for container reason2
BEGIN OF i_table_text1 OCCURS 0,
line(132) TYPE c, " Line text
END OF i_table_text1,
* Internal table to hold text for container looking for another job
beGIN OF i_table_text2 OCCURS 0,
line(132) TYPE c, " Line text
END OF i_table_text2.
* Subroutine to create text container for remarks on credentials
PERFORM get_container_credential.
* Subroutine to create text container for remarks on character
* PERFORM get_container_character.
* Subroutine to create text container for remarks on preemployeement
* PERFORM get_container_preempmnt.
call screen 100.
*endmodule. " create_container_pbo_2000 OUTPUT
form get_container_credential .
IF obj_cust_cont_credential IS INITIAL.
* To create the object custom container and link to the container on
* screen
CREATE OBJECT obj_cust_cont_credential
EXPORTING
container_name = 'CCREDENTIALS'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
* To create the a TextEdit Control and link to the custom container
CREATE OBJECT obj_text_CRED
EXPORTING
parent = obj_cust_cont_credential
wordwrap_mode = cl_gui_textedit=>WORDWRAP_AT_WINDOWBORDER
wordwrap_to_linebreak_mode = cl_gui_textedit=>true
EXCEPTIONS
others = 1.
IF sy-subrc EQ 0.
* To remove the toolbar
CALL METHOD obj_text_CRED->set_toolbar_mode
EXPORTING
toolbar_mode = 0
EXCEPTIONS
error_cntl_call_method = 1
invalid_parameter = 2
OTHERS = 3.
* To remove the status bar
CALL METHOD obj_text_CRED->set_statusbar_mode
EXPORTING
statusbar_mode = 0
EXCEPTIONS
error_cntl_call_method = 1
invalid_parameter = 2
OTHERS = 3
ENDIF. " IF sy-subrc EQ 0
ENDIF. " IF obj_cust_cont_credential
endform. " get_container_credential
module STATUS_0100 output.
SET PF-STATUS 'ZYH454_TEST1'.
SET TITLEBAR 'xxx'.
endmodule. " STATUS_0100 OUTPUT
module USER_COMMAND_0100 input.
if sy-ucomm EQ 'BACK'.
leave to screen 0.
endif.
endmodule. " USER_COMMAND_0100 INPUT -
Hello Experts,
I have an ALV Grid where the last column is displayed as push buttons. When i click on a pushbutton, a text editor is opened up using ABAP OO. Now, I enter the text and SAve it. A standard text is created against the selected row in ALV Grid. Then I come back to the alv grid and click on another button of some different row. Again the text editor opens up with the previous text. I nter the new text and click on save. However, this time the standard text is not created. I have am making the container and text editor free as i click on 'back'. Still the data is not getting refreshed.
Please, let me know where m i going wrong.
Regards,
SonalHi Sonal,
I have faced similar issue with respect to module pool with container on the screen.
Try using the following on back action....
call method wf_init_edit->delete_text. (wf_init_edit -> editor reference - type ref to cl_gui_textedit )
Also we can free the container using
call method wf_init_cont->free. (wf_init_cont -> container reference - type ref to cl_gui_custom_container )
Hope it helps.
Regards,
Byju
Maybe you are looking for
-
ITunes' C drive access 'times out' / Recreating iTunes on a new drive
I'm not sure exactly what to search for, so if this situation has been discussed before, I'd be grateful if someone can point me in the right direction. But I'm thinking my situation may be a unique one. My circumstances are that I'm running a six- (
-
Windows 8 Pro Final (9200) BitLocker in UEFI mode not working, Element not found
Hi, with the latest bios (either 1.37a (for Windows 8 Beta Driver test (June 2012) or 1.39 (Current) of the W520 and final release of Windows 8 Pro (Build 9200) BitLocker comes up with "Element not found" when trying to activate for the system drive
-
Our application is getting the following error... SQL> select * from cmd where CC0034_CMD_NRI = 111 for update nowait; select * from cmd where CC0034_CMD_NRI = 111 for update nowait ERROR at line 1: ORA-00054: resource busy and acquire with NOWAIT sp
-
Http ClusterServlet/SSL woes
Heya, I tried posting this in the clustering newsgroup to no avail, so I thought I'd try here, too. My problem's kind of confusing, so I'll try and break it down. I'm hoping someone recognizes the pattern of my errors! I am using Weblogic 8.1sp5. I h
-
TS1702 I cannot purchase online.
I have put all the details of the payment mode. When I try to purchase. I does not allow me.