SAPscript texts are stored in Interchange Text Format (ITF). As interface to other word processing programs, SAPscript offers conversion programs to the text file formats Rich Text Format (RTF) and ASCII as well as migration for R/2 texts.
RTF files contain the entire formatting information of a text and can be interpreted as well as created by all common word processing programs.
RTF files created from SAPscript texts largely contain the character and paragraph formats from the style or form of the original text. They can easily be read into modern word processing programs; however, for using older DOS programs you must make some preparations first: For Microsoft Word (starting with version 5.0), for example, you must convert the RTF file on operating system level into a Word text file and a template using the following commands:
rtf_dos file1.rtf file2.txt file3.dfv /o/c
rtf_dos file1.rtf file2.txt file3.dfv /o/m
rtf_os2 file1.rtf file2.txt file3.dfv /o/c
rtf_os2 file1.rtf file2.txt file3.dfv /o/m
/o If file2.txt exists, it is overwritten without notice.
/c Creates the new template file3.dfv.
/m The template file3.dfv exists and will be modified if necessary.
If you want the names of paragraph and character formats to be different in Word or if you want to adapt them to an existing Word template, you must execute a format conversion.
When importing RTF files into SAPscript, you should create the source text with a template and store it as RTF file. Paragraphs and characters formatted with templates can receive formats again in SAPscript. So make sure not to format texts using Word buttons. In SAPscript, a style or form should exist whose character and paragraph formats correspond to those of the template and have the same keys. If this is not possible because the template has other keys, you can start a format conversion.
In ASCII files, the text is stored unformatted. The only formatting element is the line feed. Character set conversions into and from all character sets defined in the spool administration are supported.
From within the SAPscript editor, you can
· export SAPscript texts into a local file in the formats ITF, RTF, or ASCII,
· import local files of the formats ITF, RTF, or ASCII and insert them at the cursor position as ITF text.
To find these functions in the text editor, choose Text → Upload... / Text → Download..., Documentation → Upload... / Documentation → Download... or Clipboard→ Upload... / Clipboard → Download....
From within application programs, you can call these and further functions using a set of function modules.
Convert a SAPscript standard text in system language into an RTF file and write it into a local directory. You can choose the text name and the name of the target file at will; default values are "SAPSCRIPT-DRUCKERTEST" and as local directory "C:\temp\". The system does not check whether the file name ends with ".rtf"; you must check this yourself.
REPORT YCMTESTE LINE-SIZE 255 MESSAGE-ID TD.
TEXTNAME LIKE THEAD-TDNAME DEFAULT 'SAPSCRIPT-DRUCKERTEST',
FILE LIKE RLGRAP-FILENAME DEFAULT 'C:\temp\'.
DATA: TEXTHEADER LIKE THEAD.
DATA: TEXTLINES LIKE TLINE OCCURS 100 WITH HEADER LINE.
CALL FUNCTION 'READ_TEXT'
EXPORTING NAME = TEXTNAME
LANGUAGE = SY-LANGU
OBJECT = 'TEXT'
ID = 'ST '
IMPORTING HEADER = TEXTHEADER
TABLES LINES = TEXTLINES
EXCEPTIONS OTHERS = 1.
CHECK SY-SUBRC = 0.
CALL FUNCTION 'EXPORT_TEXT'
EXPORTING CODEPAGE = '1133'
FILE = FILE
FORMATWIDTH = 132
FORMAT_TYPE = 'RTF'
HEADER = TEXTHEADER
SSHEET = ' '
WITH_TAB = ' '
TABLES ITF_LINES = TEXTLINES
EXCEPTIONS DOWNLOAD_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_WRITE_ERROR = 3.
WHEN 0. MESSAGE S807 WITH FILE.
WHEN 1. MESSAGE E815 WITH FILE.
WHEN 2. MESSAGE E811 WITH FILE.
WHEN 3. MESSAGE E814 WITH FILE.