The function module IMPORT_TEXT uploads a local file into the SAP system and then executes one of the following conversions, depending on the file format FORMAT_TYPE:
· Local ITF file FILE → ITF text in table ITF_LINES
· Local RTF file FILE → ITF text in table ITF_LINES
· Local ASCII file FILE → ITF text in table ITF_LINES
You must enter the following specifications:
Here, you can use ITF files with header information (for more information on this file type, see documentation of the report RSTXLITF) as well as ITF texts without a preface. If header information exists, it is written to the export parameter NEWHEADER and the system formats the text: The line width is set to the value defined in table TTXOB for the current text object. The parameters HEADER, FORMATWIDTH, CODEPAGE, WORD_LANGU, SSHEET, and WITH_TAB have no effect.
In WORD_LANGU, specify the language of the MS Word version used to enable the system to interpret language-dependent elements in the RTF file. The default is the SAP system language. The parameters FORMATWIDTH and CODEPAGE have no effect, for a description of SSHEET and WITH_TAB, see "Format conversion" below. HEADER is used only in connection with a format conversion ( WITH_TAB = 'X'), when the system fills the parameter NEWHEADER with new, current values.
The system converts carriage return (x0D) and line feed (x0A) into newline ('/ ') and matches form feed (x0c) with the statement '/: NEW-PAGE' and the ASCII tab with the ITF tab (',,').
In CODEPAGE, you must specify the character set of
the source file (that is, its number in the spool administration); the
system then converts the characters into the system character set. If you
specify no value in CODEPAGE, no character set conversion occurs.
The system does not evaluate the parameters FORMATWIDTH, SSHEET, WITH_TAB, WORD_LANGU, and HEADER.
If the parameter WITH_TAB = 'X', the system starts a format conversion, provided that FORMAT_TYPE = 'RTF'. Beforehand, you must use transaction SE74 (Format conversion) to specify which Word templates to match with which character and paragraph formats of different names. The system converts
|
|
HEADER-TDSTYLE |
SS |
i |
or |
HE |
n |
HEADER-TDFORM |
ET |
|
|
CALL FUNCTION 'IMPORT_TEXT'
EXPORTING CODEPAGE = ?...
FILE = ?...
FORMAT_TYPE = 'ITF'
HEADER = SPACE
SSHEET = SPACE
WITH_TAB = SPACE
WORD_LANGU = SY-LANGU
IMPORTING NEWHEADER =
TABLES ITF_LINES = ?...
EXCEPTIONS FILE_OPEN_ERROR =
FILE_READ_ERROR =
UPLOAD_ERROR =
CODEPAGE |
Character set of the source file. You must enter the character set numbers from the spool administration. Reference field: TCP02-CPCODEPAGE |
FILE |
Name of the file to be uploaded. If this file does not exist or is unreadable, the system triggers the respective exceptions.
Make sure to
use the correct case for the file name. Reference field: RLGRAP-FILENAME |
FORMAT_TYPE |
File format ('ITF', 'RTF', or 'ASCII') Default value: 'ITF' |
HEADER |
Structure: THEAD Default value: SPACE |
SSHEET |
Name of a template (*.dfv or *.dot). To trigger a format conversion, you must enter the symbolic name for which you maintained a conversion to the respective SAPscript style or form in transaction SE74. In addition, you must set the parameter WITH_TAB to 'X'. Default value: SPACE |
WITH_TAB |
If WITH_TAB = 'X' and the parameter SSHEET is filled, the system converts character and paragraph formats. Source and target formats can be a SAPscript style, a SAPscript form, or an MS Word template. Using transaction SE74 (Format conversion), you must specify which character or paragraph names or Word templates match. Default value: SPACE |
WORD_LANGU |
Only for RTF conversion: language of the word processing program that created the RTF file. Default value: SY-LANGU |
NEWHEADER |
Text header of the SAPscript result text. The text header contains a description of a text module, such as short text, creator, and so on. The structure is determined in table THEAD. Structure: THEAD |
ITF_LINES |
Text table of the result text. Structure: TLINE |
FILE_OPEN_ERROR |
File cannot be opened. |
FILE_READ_ERROR |
File cannot be read (completely). Possible reason: · Read error of the operating system (no SAP error) or upload incomplete due to incorrect GUI installation (work directory write-protected). |
UPLOAD_ERROR |
Other errors when uploading the file. |