‎2008 Apr 24 4:01 PM
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.
‎2008 Apr 24 4:16 PM
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
‎2008 Apr 24 5:39 PM
Hi Byju,
Thanks for ur reply but in my case I will have to fetch the existing standard text and populate in my program container.After which the User might put in additional text and saves the text
(User can write the text in my container or in the long text editor).
Now this text will be saved in a z table which I had already created.The field type for storing this text might be of string or a raw data type.
So let me know if u have any solution for this..
Thanks,
Susanth
‎2008 Apr 24 8:44 PM
So what exactly is it you want to know:
How to create a module pool / dialog program?
Or how to create a screen with text editor?
Or how to save the data in your z-table?
Or....?
‎2008 Apr 25 6:54 AM
Hi Mickey,
Thanks for your interest in my post.My requirement is as follows:
1. I have created a custom container in my module pool
program and a pusbutton adjacent to it for entering long text.
2. Now the User can either enter text in this container or he
can press the pushbutton(which will call the long text editor)
and the enter text into it. He then saves this text entered.
3. This text needs to be saved in a z table(which I have
created). This z table has primary keys with which this text
will be identified.
4. So next time when the User opens this record the
corresponding text also needs to populated in the custom
container.He can now edit this text in the custom container
or in the text editor and save it. This modofied text again
needs to be saved again in the ztable.This process goes on..
This is what exactly my requirement is..
Let me know if u need any other clarifiactions..
Thanks,
Susanth.
‎2008 Apr 27 7:09 AM
Hi Sushanth,
Texts are usually saved as text objects in the mentioned example but if you really need to store it in a ztable won't there be a size restriction on the text?...
We cannot put an infinite text length if we are saving in a database table...because we have seen cases where user copy pastes an e-mail entirely into the text editor where the size is much bigger....
but if you really want to do it..then after calling the function module get text as r3 table ...text will be stored in int_table line by line...you can loop at int_table and use int_table-edit which contains the text values for a maximum length of 255 since we have declared it of such length in the types..if you need more size check the maximum size and put it(i am not sure of the maximum size)..then you can save it ...
Hope that answers your query...
Regards
Byju
‎2008 Apr 24 5:05 PM