Show TOC

CONVERT_TEXTLocate this document in the navigation structure

Use

The function module CONVERT_TEXT provides the following format conversions:

  • ITF text in table Start of the navigation path ITF_LINES Next navigation step RTF text End of the navigation path in table FOREIGN.

  • ITF text in table Start of the navigation path ITF_LINES Next navigation step ASCII text End of the navigation path in table FOREIGN.

  • ITF text in table Start of the navigation path FOREIGN Next navigation step ITF text End of the navigation path in table ITF_LINES.

  • ITF text in table Start of the navigation path FOREIGN Next navigation step ITF text End of the navigation path in table ITF_LINES.

The function module EXCHANGE_ITF is available for conversions within the SAPscript format ITF.

The following specifications must be made:

DIRECTION = 'EXPORT' FORMAT_TYPE = 'RTF'

DIRECTION = 'EXPORT' FORMAT_TYPE = 'RTF'

As the resulting file is preceded by information on author, creation date etc., the parameter HEADER should be filled. In any case, you must specify style and form of the text (HEADER-TDSTYLE and HEADER-TDFORM).

The line width of the resulting text can be set in FORMATWIDTH.

The character set numbers from the spool administration must be specified in CODEPAGE. The character sets 1103, 1110, or 1133 can be specified for the RTF conversion. All other specifications are ignored; the character set 1133 is used instead. If the RTF text created is to be read by WinWord, character set 1133 is recommended.

The parameter TABLETYPE describes the type of the table FOREIGN. If this table is to be compressed to create a folder type structure with the use of the full of width of 134 characters and the division of the individual logical lines through carriage return and line feed, TABLETYPE = 'BIN' must be chosen. If TABLETYPE = 'ASC' is chosen, a normal line table results.

WORD_LANGU is ineffective, SSHEET and WITH_TAB are explained below.

DIRECTION = 'EXPORT' FORMAT_TYPE = 'ASCII'

DIRECTION = 'EXPORT' FORMAT_TYPE = 'ASCII'

All ITF information is lost in this conversion; in principle the only formatting is New line and Tab. Some page formatting is possible by selecting a line width FORMATWIDTH. The ITF text can be converted to an ASCII text with any character set CODEPAGE (number from the spool administration).

The parameter TABLETYPE describes the type of the table FOREIGN. If this table is to be compressed to create a folder type structure with the use of the full of width of 134 characters and the division of the individual logical lines through carriage return and line feed, TABLETYPE = 'BIN' must be chosen. If TABLETYPE = 'ASC' is chosen, a normal line table results.

In conclusion, with import parameters only CODEPAGE, FORMATWIDTH, and TABLETYPE make sense; DIRECTION and FORMAT_TYPE are necessary.

DIRECTION = 'IMPORT' FORMAT_TYPE = 'RTF'

DIRECTION = 'IMPORT' 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 text. The default is the SAP system language.

The parameter TABLETYPE describes the type of the table FOREIGN. If this table was obtained for example by uploading a local file in binary format, that is if all lines except the last are full to the end and possibly carriage returns or line feeds contained, TABLETYPE = 'BIN' must be chosen. If this table is a normal line table, TABLETYPE = 'ASC' should be set.

The parameters FORMATWIDTH and CODEPAGE are ineffective, SSHEET and WITH_TAB are explained below.

HEADER is only interesting in combination with a print format conversion ( WITH_TAB = 'X'). In this case, new current values are entered in the parameter NEWHEADER.

DIRECTION = 'IMPORT' FORMAT_TYPE = 'ASCII'

DIRECTION = 'IMPORT' FORMAT_TYPE = 'ASCII'

The table with the ASCII text is converted by line. The individual ITF lines are separated from each other in the ITF target text by New line. The ASCII tab is mapped to the ITF tab ('').

The character set of the source text (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 parameter TABLETYPE describes the type of the table FOREIGN. If this table was obtained for example by uploading a local file in binary format, that is if all lines except the last are full to the end and possibly carriage returns or line feeds contained, TABLETYPE = 'BIN' must be chosen. If this table is a normal line table, TABLETYPE = 'ASC' should be set.

The parameters FORMATWIDTH, SSHEET, WITH, TAB , WORD_LANGU, and HEADER are not evaluated.

Format conversion

Format conversion

If you set the parameter WITH_TAB = 'X', the system triggers a format conversion for FORMAT_TYPE = 'ITF' and FORMAT_TYPE = 'RTF'. The paragraph and character tags or Word styles which are to be mapped to other paragraph and character tags or Word styles must be specified beforehand in transaction SE74 (format conversion).

The following are converted:

In the case ITF RTF:

HEADER-TDSTYLE or HEADER-TDFORM into SSHEET

In the case RTF ITF:

SSHEET in: HEADER-TDSTYLE or HEADER_TDFORM

In the case ITF ITF (in both directions)

In this case, an 'S' must be entered in the parameter SSHEET as a prefix for style or an 'F' for layout set.

Example

Style 'STIL1' and layout set 'FORM1' are assigned to an ITF text. However, it is only to be formatted by layout set 'FORM2'. The following therefore applies here:

HEADER-TDSTYLE = 'STIL1', HEADER-TDFORM = 'FORM1' and SSHEET = 'FFORM2'.

Function call:

CALL FUNCTION 'CONVERT_TEXT'
        EXPORTING CODEPAGE      = SPACE
                DIRECTION       = 'EXPORT'
                FORMATWIDTH     = 72
                FORMAT_TYPE     = 'RTF'
                HEADER          = SPACE
                SSHEET          = SPACE
                WITH_TAB        = SPACE
                WORD_LANGU      = SY-LANGU
                TABLETYPE       = 'ASC'
        IMPORTING NEWHEADER     =
        TABLES FOREIGN          = ?... 
                ITF_LINES       = ?...
            

Export parameters:

CODEPAGE

Character set number from the spool administration. If DIRECTION = 'EXPORT', CODEPAGE contains the target character set, if DIRECTION = 'IMPORT' the source character set.

Reference field: TCP02-CPCODEPAGE

Default value: SPACE

DIRECTION

'IMPORT' or 'EXPORT'

FORMATWIDTH

Default value: 72

FORMAT_TYPE

This parameter can have the values of the following text formats:

RTF: (RichTextFormat)

ASCII

Default value: 'RTF'

HEADER

Text header of the source text.

The text header contains a description of a text module, such as short text, creator, and so on.

Structure: THEAD

Default value: SPACE

SSHEET

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

To make a format conversion take effect, enter the symbolic name here, for which in transaction "Format Conversion" (SE74) a conversion was maintained using the relevant SAPscript style or form.

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

Default value: SPACE

WITH_TAB

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: Language of the word processing program that created the RTF file.

Default value: SY-LANGU

TABLETYPE

  • DIRECTION = 'IMPORT'

    The TABLETYPE parameter in this case describes the type of table FOREIGN. If this table was obtained for example by uploading a local file in binary format, that is if all lines except the last are full to the end and possibly carriage returns or line feeds contained, TABLETYPE = 'BIN' must be chosen. If this table is a normal line table, TABLETYPE = 'ASC' should be set.

  • DIRECTION = 'EXPORT'

    The TABLETYPE parameter describes the type of table FOREIGN. If you want to create a file-like structure that uses the entire line width in FOREIGN and separates the logical lines (line width FORMATWIDTH) by carriage return and line feed, use TABLETYPE = 'BIN'. To get a standard lines table, use TABLETYPE = 'ASC'.

Default value: 'ASC'

Import parameter:

NEWHADER

Text header of the SAPscript result text.

Structure: THEAD

Table parameters:

FOREIGN

Foreign text table

Structure: TLINE

ITF_LINES

SAPscript ITF table

Structure: TLINE

LINKS_TO_CONVERT

Not implemented