Show TOC

IMPORT_TEXTLocate this document in the navigation structure

Use

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 Start of the navigation path FILE Next navigation step ITF Text End of the navigation path in table ITF_LINES.

  • Local RTF file Start of the navigation path FILE Next navigation step ITF Text End of the navigation path in table ITF_LINES.

  • Local ASCII file Start of the navigation path FILE Next navigation step ITF Text End of the navigation path in table ITF_LINES.

The following specifications must be made:

The following specifications must be made:

FORMAT_TYPE = 'ITF'

ITF files with header information (for more information about the form of this file, see the documentation for report RSTXLITF) but also ITF texts without this lead text can be dealt with here. If they are preceded by header information, it is written in the export parameter NEWHEADER. In this case formatting also takes place: the line width is based on the entries made in table TTXOB for the specific text object. The parameters HEADER, FORMATWIDTH, CODEPAGE, WORD_LANGU, SSHEET, and WITH_TAB are ineffective.

FORMAT_TYPE = 'RTF'

Under WORD_LANGU, you should specify the language of the MS Word version used, so that language-dependent elements can be interpreted 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.

FORMAT_TYPE = 'ASCII'

Carriage return (x0D) and Linefeed (x0A) are converted to New line ('/'), Formfeed (x0c) is mapped to the command '/: NEW-PAGE' and the ASCII tab is to the ITF tab (',,').

The character set of the source file (i.e. its number in the spool administration) must be specified under CODEPAGE; the characters are then converted to the system character set. If a value has not been entered for CODEPAGE, character set conversion is not carried out.

The parameters FORMATWIDTH, SSHEET, WITH_TAB, WORD_LANGU, and HEADER are not evaluated. Format conversion

Format conversion

Format conversion

Format conversion If the parameter WITH_TAB = 'X' is set, format conversion is initiated if FORMAT_TYPE = 'RTF'. First the Word key codes which are to be mapped to other paragraph and character markers must be specified in transaction SE74 (format conversion). The following are converted:

HEADER-TDSTYLE

SS

i

or

HE

n

HEADER-TDFORM

ET

Function call:

Function call:
CALL FUNCTION 'IMPORT_TEXT'
        EXPORTING
                CODEPAGE        = ?...
                FILE            = ?...
                FORMAT_TYPE     = 'ITF'
                HEADER          = SPACE
                SSHEET          = SPACE
                WITH_TAB        = SPACE
                WORD_LANGU      = SY-LANGU
        IMPORTING
                NEWHEADER       =
                TABLESITF_LINES = ?...
        EXCEPTIONS
                FILE_OPEN_ERROR =
                FILE_READ_ERROR =
                UPLOAD_ERROR    =
            

Export parameters:

Export parameters:

CODEPAGE

Character set of the source file. Enter the character set numbers from the spool administration.

Reference field: TCP02-CPCODEPAGE

FILE

The name of the file which should be uploaded.

If this file does not exist or is not readable, then corresponding exceptions are generated.

Note

Upper and lower cases are relevant for the file name. Fully specify the file directory.

Reference field: RLGRAP-FILENAME

FORMAT_TYPE

Format of file ('ITF', 'RTF' oder 'ASCII')

Default value: 'ITF'

HEADER

Structure: THEAD

Default value: SPACE

SSHEET

Name of a document template (*.dfv or *.dot).

If a format conversion is to be effective, the symbolic name for which a conversion with the relevant SAPscript style or layout set was maintained in the transaction "Format conversion" (SE74) must be specified here.

In addition, you must set the WITH_TAB paramenter to 'X'.

Default value: SPACE

WITH_TAB

Possible entries are 'X' (Yes) or ' ' (No).

If WITH_TAB = 'X' is set, and the parameter SSHEET is also maintained, a conversion of paragraph and character formats is performed. Source and target formats can be a SAPscript style, a SAPscript form, or an MS Word template. Transaction SE74 (format conversion) should be used to specify the assignment between the respective paragraph and character markers and/or Word styles.

Default value: SPACE

WORD_LANGU

Only for RTF conversion:

System language of Word

This parameter is presently not supported.

Default value: SY-LANGU

Import parameter:

Import parameter:

NEWHEADER

Text header of the SAPscript result text.

The text header contains information which describes a text module, for example short text, user who created the text, user who last changed it, etc. The structure of the header is defined in table THEAD.

Structure: THEAD

Table parameters:

Table parameters:

ITF_LINES

Text table of the result text.

Structure: TLINE

Exceptions:

Exceptions:

FILE_OPEN_ERROR

File cannot be opened

FILE_READ_ERROR

File cannot be read (completely).

Possible cause:

Operating system read error (not SAP error) or incomplete upload due to incorrect GUI installation (working directory is write protected).

UPLOAD_ERROR

Other errors when uploading the file.