‎2008 Mar 12 10:39 AM
Hi All
what are the uses of the various functiona modules like
READ_TEXT,
SAVE_TEXT,
PRINT_TEXT,
COMMIT_TEXT
in SAP SCRIPTS, please give me an explanation with an working example
Thanks in Advance
‎2008 Mar 12 10:52 AM
hi,
read_text
You can process texts only if they are stored in the internal work areas of the program. Therefore, you must first transfer a text into the work areas.
To transfer the text header of a text into the specified structure and the text lines into the specified lines table, use the function module READ_TEXT.
Usually, the system reads a text from the text file. However, for texts with storage in the update task, the system first looks into the text memory to see whether it contains a currently processed version. If so, the system reads this version of the text into the work area, otherwise the text version from the text file.
To read a text version stored in the archive, use the parameter ARCHIVE_HANDLE.
If the desired text does not exist, READ_TEXT ends with the exception NOT_FOUND. The contents of the work areas for text header and text lines are then undefined. To be able to use these work areas for another text, you must first initialize them with INIT_TEXT.
The function module READ_TEXT also handles text references. It reads the reference chain to its end and supplies the text lines of this text in the lines table as well.
Save_text
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'.
Printing Texts
To print a text, you can use the function module PRINT_TEXT. However, you can format only one text with this function module. Formatting occurs according to the formatting information specified in the text header (style and form). If no form is defined for a text, the system implicitly underlays the form SYSTEM.
During formatting, the system
formats the individual text paragraphs according to the definitions in the style or form,
replaces variables with their current values,
interprets and executes the control statements contained in the text,
automatically triggers page breaks according to the page layout specified in the form.
The function module automatically opens the form and closes it after formatting the text lines. All text lines transferred appear in the main window of the form (MAIN).
COMMIT_TEXT
The system keeps all text modules for which you defined 'storage in update task' in the corresponding text object in the text memory. As soon as it updates the corresponding application object, it must also place the text modules into the log file.
The function module COMMIT_TEXT generates for the text modules in the text object a CALL FUNCTION... IN UPDATE TASK statement in accordance with the action to be executed (delete, create, change).
Hope this helps, Do reward.
‎2008 Mar 12 10:43 AM
‎2008 Mar 12 10:44 AM
READ_TEXT is used for reading the standard text in a transaction.
for eg : Header text and Item text for sales order billing etc.
SAVE_TEXT is used for creating the heaader text and item txt.
‎2008 Mar 12 10:44 AM
Hi,
[Pls Refer This File|http://help.sap.com/saphelp_nw04/helpdata/en/d6/0db8bb494511d182b70000e829fbfe/frameset.htm]
HTH
Regards,
Dhruv Shah
‎2008 Mar 12 10:44 AM
‎2008 Mar 12 10:52 AM
hi,
read_text
You can process texts only if they are stored in the internal work areas of the program. Therefore, you must first transfer a text into the work areas.
To transfer the text header of a text into the specified structure and the text lines into the specified lines table, use the function module READ_TEXT.
Usually, the system reads a text from the text file. However, for texts with storage in the update task, the system first looks into the text memory to see whether it contains a currently processed version. If so, the system reads this version of the text into the work area, otherwise the text version from the text file.
To read a text version stored in the archive, use the parameter ARCHIVE_HANDLE.
If the desired text does not exist, READ_TEXT ends with the exception NOT_FOUND. The contents of the work areas for text header and text lines are then undefined. To be able to use these work areas for another text, you must first initialize them with INIT_TEXT.
The function module READ_TEXT also handles text references. It reads the reference chain to its end and supplies the text lines of this text in the lines table as well.
Save_text
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'.
Printing Texts
To print a text, you can use the function module PRINT_TEXT. However, you can format only one text with this function module. Formatting occurs according to the formatting information specified in the text header (style and form). If no form is defined for a text, the system implicitly underlays the form SYSTEM.
During formatting, the system
formats the individual text paragraphs according to the definitions in the style or form,
replaces variables with their current values,
interprets and executes the control statements contained in the text,
automatically triggers page breaks according to the page layout specified in the form.
The function module automatically opens the form and closes it after formatting the text lines. All text lines transferred appear in the main window of the form (MAIN).
COMMIT_TEXT
The system keeps all text modules for which you defined 'storage in update task' in the corresponding text object in the text memory. As soon as it updates the corresponding application object, it must also place the text modules into the log file.
The function module COMMIT_TEXT generates for the text modules in the text object a CALL FUNCTION... IN UPDATE TASK statement in accordance with the action to be executed (delete, create, change).
Hope this helps, Do reward.