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: 

FM--Save_text

Former Member
0 Kudos

Can any one give a sample code how to work in save_text function module..Wht purpose it is used

1 ACCEPTED SOLUTION

Former Member
0 Kudos

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

header = theader

  • INSERT = 'X'

  • SAVEMODE_DIRECT = 'X'

  • OWNER_SPECIFIED = ' '

  • LOCAL_CAT = ' '

IMPORTING

FUNCTION = lv_func

NEWHEADER = nheader

tables

lines = tline

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5

points will be rewarded if problem sovled

2 REPLIES 2

Former Member
0 Kudos

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

header = theader

  • INSERT = 'X'

  • SAVEMODE_DIRECT = 'X'

  • OWNER_SPECIFIED = ' '

  • LOCAL_CAT = ' '

IMPORTING

FUNCTION = lv_func

NEWHEADER = nheader

tables

lines = tline

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5

points will be rewarded if problem sovled

Former Member
0 Kudos

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.