02-28-2008 7:34 AM
Can any one give a sample code how to work in save_text function module..Wht purpose it is used
02-28-2008 7:37 AM
02-28-2008 7:37 AM
02-28-2008 7:42 AM
Saving Texts
To re-transfer texts from the internal work areas to the text file, use the function module SAVE_TEXT.
The application program does not know whether the text is new or a changed version of an existing text. To be able to find this out, the program must read the text file first.
If a text exists, the transferred text lines overwrite the old version. If it does not exist, the system creates it. If you know from the beginning that the text is new, you can suppress this read process using the parameter INSERT and thus improve performance.
A text you want to store in the text file must consist of at least one line whose paragraph format or line contents is unequal to SPACE. Otherwise the system automatically deletes this text from the text file.
Changes to the text file are valid at once if the text object of the text is set to direct storage. If it is set to storage in update task, the text changes are temporarily stored in the text memory. The function module COMMIT_WORK then transfers them to the log file, from where they are updated with the next COMMIT WORK.
The function module SAVE_TEXT can handle only texts that are eventually stored in the text file, that is, text with storage mode 'D' or 'V'.
Also check this thread for sample code.
Sample:
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = HEADER
INSERT = ' I '
SAVEMODE_DIRECT = ' X '
OWNER_SPECIFIED = ' SAPUSER '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER = HEADER
TABLES
LINES = 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.