Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SAVE_TEXT function module for text editor

Former Member
0 Kudos

I come across the SAVE_TEXT is a function that allow us to save what is inside the text editor.

May I know if you got any codes example to implement this SAVE_TEXT?

Am I suppose to make any changes to my text editor codes as below?

-


MODULE STATUS_9000 OUTPUT.

SET PF-STATUS 'SCREEN_9000'.

SET TITLEBAR 'TITLE_9000'.

IF CODE_EDITOR IS INITIAL.

CREATE OBJECT CODE_EDITOR_CONTAINER

EXPORTING

CONTAINER_NAME = 'GEN_CODE'

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

LIFETIME_DYNPRO_DYNPRO_LINK = 5.

CREATE OBJECT CODE_EDITOR

EXPORTING

PARENT = CODE_EDITOR_CONTAINER

WORDWRAP_MODE =

  • CL_GUI_TEXTEDIT=>WORDWRAP_OFF

CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION

  • CL_GUI_TEXTEDIT=>WORDWRAP_AT_WINDOWBORDER

WORDWRAP_POSITION = G_EDITOR_LENGTH

WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>TRUE.

ENDIF.

ENDMODULE. "STATUS_9002 OUTPUT

-


6 REPLIES 6

Former Member
0 Kudos

Former Member
0 Kudos

Hi,

U can do the changes for ur text. before that u should know ur text ID, text object name, language, then all the parameters u have to pass to the FM.

for getting text ,text object name, language u have to doule click on ur text then u will get all the details.

reward me a points if it is use full answer.

praveen

Former Member
0 Kudos

hi

good

structure ->

Function call:

CALL FUNCTION 'SAVE_TEXT'

EXPORTING CLIENT = SY-MANDT

HEADER = ?...

INSERT = SPACE

SAVEMODE_DIRECT = SPACE

OWNER_SPECIFIED = SPACE

IMPORTING FUNCTION =

NEWHEADER =

TABLES LINES = ?...

EXCEPTIONS ID =

LANGUAGE =

NAME =

OBJECT =

check this link

http://help.sap.com/saphelp_40b/helpdata/en/d6/0db8ef494511d182b70000e829fbfe/content.htm

thanks

mrutyun^

Former Member
0 Kudos

hi juzme,

yes you can do the changes.please go for the details i give to you and dont forget to reward me the points

Usually, the system implicitly calls the function module SAVE_TEXT if you leave the editor choosing Save, provided the text is stored in the text file according to the allocated text object. To deactivate this call, use the parameter SAVE.

I have used fm commit_text too after that.

Here is the sample code.

move '000103169498' to head1-tdname." Its hard coded for current use

move 'EN' to head1-tdspras.

move 'LTXT' to head1-tdid.

move 'QMEL' to head1-tdobject.

call function 'SAVE_TEXT'

exporting

client = sy-mandt

header = head1

  • INSERT = ' '

  • SAVEMODE_DIRECT = ' '

  • OWNER_SPECIFIED = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • FUNCTION* NEWHEADER tables

lines = lines " lines have single entry as some text.

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

[or] try this...........

Please refer to the important parameters that are discussed in the previous question of reading texts. We will need the same parameters for saving the text as well. The function modules that you can use for this will be SAVE_TEXT followed by COMMIT_TEXT. The parameters play a very important roles as you might not see the saved text in the standard transaction if you give wrong parameter values.

CALL FUNCTION 'SAVE_TEXT' EXPORTING* CLIENT = SY-MANDT HEADER =* INSERT = ' '* SAVEMODE_DIRECT = ' '* OWNER_SPECIFIED = ' '* LOCAL_CAT = ' '* IMPORTING* FUNCTION =* NEWHEADER = TABLES LINES =* 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.CALL FUNCTION 'COMMIT_TEXT'* EXPORTING* OBJECT = '' NAME = '' ID = '' LANGUAGE = '' SAVEMODE_DIRECT = ' '* KEEP = ' '* LOCAL_CAT = ' '* IMPORTING* COMMIT_COUNT =* TABLES* T_OBJECT =* T_NAME =* T_ID =* T_LANGUAGE =

Former Member
0 Kudos

Hi,

before saving the text,check the save mode in table TTXOB for the TDOBJECT u have used.If it is D,then u have to use

FMs- SAVE_TEXT to save

COMMIT_TEXT to update in DB.

If save mode is V,u have to use

INTTAB_SAVE_TEXT and

INTTAB_COMMIT_TEXT .

For both to read u can use the FM- READ_TEXT to read the saved text later

Former Member
0 Kudos

Then may I know where should I put the SAVE_TEXT function? I still don't really understand how are the parameters used in this function. Can someone explain it more clearly to me?