‎2005 Nov 27 9:20 AM
Hi All,
Can you suggest me if there is any function module which is going to open SCRIPT editor. On passing the THEAD the contents for that object should be displayed in the editor. The user should be able to edit it and SAVE it.
Thanks & Regards,
Rahul.
‎2005 Nov 27 11:10 AM
Hi Sri,
Thank you for your response.
After calling the EDIT_TEXT function module do we need to call any other function module as the modified text is not getting reflected.
Thanks & Regards,
Rahul.
‎2005 Nov 27 9:36 AM
Hi,
You can use EDIT_TEXT fm. Do a where-used list on the fm to understand how it can be called.
Also take a look at the following sample code,
DATA: ls_thead LIKE thead,
lt_lines LIKE TABLE OF tline.
ls_thead-tdname = 'ZTESTTEXT'.
ls_thead-tdobject = 'TEXT'.
ls_thead-tdid = 'ST'.
ls_thead-tdspras = sy-langu.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = ls_thead-tdid
language = sy-langu
name = ls_thead-tdname
object = ls_thead-tdobject
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
header = ls_thead
TABLES
lines = lt_lines
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 NE 0.
****Create New Text
****Initialize Text - Get TTXOB settings like line size
CALL FUNCTION 'INIT_TEXT'
EXPORTING
id = ls_thead-tdid
language = sy-langu
name = ls_thead-tdname
object = ls_thead-tdobject
IMPORTING
header = ls_thead
TABLES
lines = lt_lines
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5.
ENDIF.
CALL FUNCTION 'EDIT_TEXT'
EXPORTING
display = space
EDITOR_TITLE = ' '
header = ls_thead
PAGE = ' '
window = ' '
save = 'X'
LINE_EDITOR = ' '
CONTROL = ' '
PROGRAM = ' '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
newheader = ls_thead
RESULT =
TABLES
lines = lt_lines
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 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
Hope this helps..
Sri
Message was edited by: Srikanth Pinnamaneni
‎2005 Nov 27 9:55 AM
Hi Sri,
We can use EDIT_TEXT if we want to do it programatically. I want to lauch the SCRIPT editor on clicking on a button so that the user can type his text and SAVE it.
Thanks & Regards,
Rahul.
‎2005 Nov 27 10:10 AM
Hi Rahul,
Purpose of Function module EDIT_TEXT is to call SCRIPT Editor only. The only prerequisite is to give a name to the text that will be entered by user. User can still type his text once the editor appears and then save it too.
So I think on clicking your button, you can prompt user for a text name (this TDNAME you have to save some where if user can also change it afterwards) and then call EDIT_TEXT to take him to the script editor.
The sample code I gave you works for both create case and then change case (if user wants to change the text that is saved already).
Hope this helps..
Sri
Message was edited by: Srikanth Pinnamaneni
‎2005 Nov 27 11:10 AM
Hi Sri,
Thank you for your response.
After calling the EDIT_TEXT function module do we need to call any other function module as the modified text is not getting reflected.
Thanks & Regards,
Rahul.
‎2005 Nov 27 11:48 AM
‎2005 Nov 27 11:50 AM
Hi Rahul,
I think you have to use COMMIT_TEXT to save the texts but normally but EDIT_TEXT call with SAVE = 'X' parameter it should save automatically.
Hope this helps..
Please reward points and close the post if this helps..
Sri
‎2005 Nov 27 12:02 PM
Hi
I agree with Sri, I forgot those parameter, if you set SAVE, fm EDIT_TEXT call directly fm SAVE_TEXT, the problem is this fm is called without to set the parameter SAVEMODE_DIRECT, so probably you need a commit.
You can try to do this code:
CALL FUNCTION 'EDIT_TEXT'
............
SAVE = SPACE
.............
CALL FUNCTION 'SAVE_TEXT'
...........
SAVEMODE_DIRECT = 'X'
.......
Max