10-11-2006 8:34 PM
I HAVE A CONTAINER FOR FREE TEXT.
I HAVE A CREATE BUTTON IN MY SCREEN EWHEN I PRESS CREATE IT ASKD FOR ID AND FREE TEXT THEN I SAVE AND IT GETS SAVED IN A ZTALE TABLE.
WHEN AFTER SAVING IT I GO TO INITIAL SCREEN AND PRESS CREATE AGAIN THEN IT ASKS FOR ID AND IN THE CONTAINER I SEE THE FPREVIOUS TEXT.
CAN YOU GUYS LET ME KNOW AS TO WHAT I NEED TO DO.
I TREID CLEARING AND REFRESHING MYTABLE WHICH I HAVE USED IN THE FOLLOWING CODE.
pbo
if editor is initial.
CREATE OBJECT TEXTEDIT_CUSTOM_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.
add your handling
ENDIF.
CREATE OBJECT EDITOR
EXPORTING
PARENT = TEXTEDIT_CUSTOM_CONTAINER
WORDWRAP_MODE = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION
WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>FALSE
EXCEPTIONS
OTHERS = 1.
refresh mytable.
call METHOD editor->SET_TOOLBAR_MODE
EXPORTING TOOLBAR_MODE = 0.
*call METHOD editor->SET_ENABLE
*EXPORTING ENABLE = ' '.
CALL METHOD editor->set_readonly_mode
EXPORTING
readonly_mode = 1.
ENDIF.
CLEAR MYTABLE.
FREE MYTABLE.
endif.
IF SY-SUBRC NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
TITEL = V_REPID "--> program name
TXT2 = SPACE
TXT1 = 'Error in flush'.
ENDIF.
tHANKS
let me know
swathi
10-11-2006 8:39 PM
10-11-2006 8:39 PM
Hé,
I am not sure but maybe you can try to solve it by using the life_time parameter when you create the object.
Succes,
Daisy
10-11-2006 8:42 PM
10-11-2006 9:11 PM
Hi Rich and all,
i figured it out
if not editor is initial.
CALL METHOD editor->DELETE_TEXT.
endif.
Rich,
i don't know but iam moving it to ztable.
Does this create anyproblem.
I have send you an email yesterday.
I guess i have explained issues in that email.
Let me know your valuable thoughts
Swathi
10-11-2006 9:24 PM
Well first how is your Ztable defined? How long is the field which is holding the text? Long Enough? Well its not long as it could be if you would use the long text functionality provided with text objects/ids.
I looked at your mail, you you were going about it all wrong. You should do something simular to what I have posted above here. See how it is retrieveing the text and calling SAVE_TEXT.
Regards,
Rich Heilman
10-11-2006 9:39 PM
HIS IT POSSIBLE TO CHANG THE TEXT AND SAVE IT UNDER THE SAME TEXTID/OBJECT.
I GUESS WE CAN DO THIS BY EDIT_TEXT RIGHT.
CAN YOU TELL ME EMAILID WHICH U CHECK REGULARLY.
THANKS
SWATHI
10-11-2006 9:42 PM
The one on my BC is the one I always check, you just must have gotton lost in the shuffle, sorry
You can edit them just as I have in the sample program above, here you are editing the text in the text container, which it seems that this is the way you want to go, but you should still save the text as long text and not in a custom table. The example program should show you everything you need to complete this task. I believe that I already sent you screens shots of how to create the text object/id in SE75.
Regards,
Rich Heilman
10-11-2006 9:44 PM
hI RICH,
WHAT IAM DOING IS I HAVE CREATED A ZTABLE OF FILEDS ID AND TEXT
TEXT IS 73 CHAR WHICH IS EQUALTO NUMBER OF CHARACTERS MY FREE TEXT CONTAINER CAN TAKE IN ONE LINE.
THEN IAM SAVING EACH LINE OF FREETEXT AS SINGLE RECORD OF MY ZTABLE.
EX IN FREE TEXT I HAVE
EWEWQRRREWQREWREWQREREREWRE
EWEWQEWQEWEWQEWQEWQWQWWQEEWQWQEWQ(73CHAR)
ZTABLE
ID TEXT
1 EWEWQRRREWQREWREWQREREREWRE
1 EWEWQEWQEWEWQEWQEWQWQWWQEEWQWQEWQ(73CHAR)
let me know youur suggestion
Thanks
SWATHI
10-11-2006 9:47 PM
So, really you are dupicating the long text functionality which is already there for you to use.
Suggestion:
Get rid of your ztable and use the SAVE_TEXT function module to save your long text.
You can create an object in SE75 as ZIDTEXT and an ID as Z001, then the name would be your ID Number. So you create one object/id and then all of your id numbers/text would be apart of this text object/id.
Are you following?
Regards
Rich Heilman
10-11-2006 9:50 PM
Hi Rich,
I am still in the ophase of building so i guess i can modify this and do as you suggested.
Thanks
FOR YOUR HELP Rich.
I will let you know if any issues in the process arise.
I will send you an email if i ahve any issues otherwise i would post it in here
Thanks again
Rich
10-11-2006 8:58 PM
For example, this program works really well with saving long text using the SAVE_TEXT function. Here you need to create the object/id in SE75. For this program you enter the id on the right like 999999 and enter the text on the left, execute and the text is saved, now change the id to 999998 and hit enter, notice the text is blank, now enter 999999 again, notice the text for this id has come back, this is because the program uses READ_TEXT to retrieve the text.
report zrich_0001.
data:
dockingleft type ref to cl_gui_docking_container,
text_editor type ref to cl_gui_textedit,
repid type syrepid.
data: begin of header.
include structure thead.
data: end of header.
data: begin of lines occurs 0.
include structure tline.
data: end of lines.
data: textlines type table of tline-tdline,
wa_text type tline-tdline.
data: xthead type thead.
parameters: p_id(10) type c.
at selection-screen.
if p_id is initial.
message e001(00) with 'Enter an ID'.
endif.
at selection-screen output.
repid = sy-repid.
if dockingleft is initial.
create object dockingleft
exporting repid = repid
dynnr = sy-dynnr
side = dockingleft->dock_at_left
extension = 300.
create object text_editor
exporting
parent = dockingleft.
endif.
if p_id <> space.
xthead-tdobject = 'ZPT_DET'.
xthead-tdid = 'Z001'.
xthead-tdname = p_id.
clear lines. refresh lines.
call function 'READ_TEXT'
exporting
id = xthead-tdid
language = sy-langu
name = xthead-tdname
object = xthead-tdobject
tables
lines = lines
exceptions
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
others = 8.
clear textlines.
loop at lines.
wa_text = lines-tdline.
append wa_text to textlines.
endloop.
endif.
call method text_editor->set_text_as_r3table
exporting
table = textlines
exceptions
others = 1.
start-of-selection.
call method text_editor->get_text_as_r3table
importing
table = textlines
exceptions
others = 1.
* Set SAPscript Header
clear header.
header-tdname = p_id . "Name
header-tdobject = 'ZPT_DET'. "Object
header-tdid = 'Z001'. "Id
header-tdspras = sy-langu.
* Move text from container to function module table
clear lines. refresh lines.
loop at textlines into wa_text .
lines-tdline = wa_text.
append lines .
endloop.
call function 'SAVE_TEXT'
exporting
client = sy-mandt
header = header
tables
lines = lines
exceptions
id = 1
language = 2
name = 3
object = 4
others = 5.
Yes, this is implemented using a selection screen, but the same principals apply and this can be easily converted to a dynpro application.
Regards,
Rich Heilman
10-11-2006 9:09 PM
Hi,
Check the below code.
define table type for data exchange
TYPES: BEGIN OF MYTABLE_LINE,
LINE(1024) TYPE C,
END OF MYTABLE_LINE.
table to exchange text
DATA MYTABLEDOC TYPE TABLE OF MYTABLE_LINE.
create calls constructor, which initializes, creats and links
a TextEdit Control
CREATE OBJECT EDITOR
EXPORTING
PARENT = TEXTEDIT_CUSTOM_CONTAINER
WORDWRAP_MODE =
CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION
WORDWRAP_TO_LINEBREAK_MODE =
CL_GUI_TEXTEDIT=>TRUE
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
TITEL = V_PROGRAM
TXT2 = SPACE
TXT1 = 'Error in flush'.
ENDIF.
ENDIF. " Editor is initial
finally flush
CALL METHOD CL_GUI_CFW=>FLUSH
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
TITEL = V_PROGRAM
TXT2 = SPACE
TXT1 = 'Error in flush'.
ENDIF.
*Internal table MYTABLEDOC contains previous text
CALL METHOD EDITOR->SET_TEXT_AS_R3TABLE
EXPORTING
TABLE = MYTABLEDOC
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.
ENDIF.
Message was edited by: Ramakrishna Prasad Ramisetti