Start of Content Area

 CONVERT_TEXT   Locate the document in its SAP Library structure

The function module CONVERT_TEXT provides the following format conversions:

ITF text in table ITF_LINES    RTF text in table FOREIGN

ITF text in table ITF_LINES    ASCII text in table FOREIGN

RTF text in table FOREIGN     ITF text in table ITF_LINES

ASCII text in table FOREIGN        ITF text in table ITF_LINES

For conversions within the SAPscript format ITF, use the function module EXCHANGE_ITF.

 

You must enter the following specifications:

DIRECTION = 'EXPORT'            FORMAT_TYPE = 'RTF'

Since the system prefixes the result table with information on author, creation date, etc., you must fill the parameter HEADER, especially the fields specifying style and form of the text (HEADER-TDSTYLE and HEADER-TDFORM).

In FORMATWIDTH, you can enter the line width of the result text.

In CODEPAGE, enter the character set numbers from the spool administration. For RTF conversion, you can select the character sets 1103, 1110, or 1133. The system ignores any other entries and uses the default character set 1133 instead. If you want to read the RTF text into WinWord, we recommend to use character set 1133.

TABLETYPE contains the type of table FOREIGN. If you want to compress the table, that is, give it a file-like structure, use the entire width of 134 characters, and separate the individual logical lines with carriage return and line feed, you must use TABLETYPE = 'BIN'. If you use TABLETYPE = 'ASC', you get a normal lines table.

WORD_LANGU has no effect; SSHEET and WITH_TAB are explained at the 'Format conversion'.

DIRECTION = 'EXPORT'            FORMAT_TYPE = 'ASCII'

All ITF information is lost with this conversion; the only formats are Newline and Tab. By choosing the line width FORMATWIDTH accordingly, you can achieve a certain page formatting. You can convert the ITF text into an ASCII text of any character set CODEPAGE (number form spool administration).

TABLETYPE contains the type of table FOREIGN. If you want to compress the table, that is, give it a file-like structure, use the entire width of 134 characters, and separate the individual logical lines with carriage return and line feed, you must use TABLETYPE = 'BIN'. If you use TABLETYPE = 'ASC', you get a normal lines table.

In short, you must specify DIRECTION and FORMAT_TYPE; the only import parameters for which entries are useful, are CODEPAGE, FORMATWIDTH, and TABLETYPE.

DIRECTION = 'IMPORT'            FORMAT_TYPE = 'RTF'

For WORD_LANGU enter the language of the MS Word version you use to allow the system to interpret language-dependent elements in the RTF text. The default is the SAP system language.

TABLETYPE contains the type of table FOREIGN. If you created this table, for example, by uploading a local file in binary format, which means that all lines except the last are filled completely and the lines may contain carriage return and line feed, you must use TABLETYPE = 'BIN'. If the table is a normal lines table, use TABLETYPE = 'ASC'.

The parameters FORMATWIDTH and CODEPAGE have no effect; SSHEET and WITH_TAB are explained at the 'Format conversion'.

HEADER is used only in connection with a print format conversion ( WITH_TAB = 'X'). In this case, the system fills the parameter NEWHEADER with the new current values.

DIRECTION = 'IMPORT'            FORMAT_TYPE = 'ASCII'

The table containing the ASCII text is converted line by line. In the ITF target text, the system separates the individual ITF lines with NEWLINE. The ASCII tab is converted to the ITF tab (',,').

In CODEPAGE, you must enter the character set of the source text (that is, its number in the spool administration); the system then converts the characters to the system character set. If you leave CODEPAGE blank, no character conversion occurs.

TABLETYPE contains the type of table FOREIGN. If you created this table, for example, by uploading a local file in binary format, which means that all lines except the last are filled completely and the lines may contain carriage return and line feed, you must use TABLETYPE = 'BIN'. If the table is a normal lines table, use TABLETYPE = 'ASC'.

The system ignores the parameters FORMATWIDTH, SSHEET, WITH_TAB, WORD_LANGU, and HEADER.

Format conversion

If you set the parameter WITH_TAB = 'X', the system triggers a format conversion for FORMAT_TYPE = 'ITF' and FORMAT_TYPE = 'RTF'. Beforehand, you must use transaction SE74 (Format conversion) to specify which character and paragraph names or Word templates to map on other character and paragraph names or Word templates.

The system converts for

ITF RTF:

HEADER-TDSTYLE or HEADER-TDFORM into SSHEET

RTF ITF:

SSHEET into HEADER-TDSTYLE or HEADER_TDFORM

ITF  ITF (in both directions)

In this case, the parameter SSHEET must contain 'S' for style or 'F' for form as prefix.

Example

To an ITF text, the style 'STYLE1' and the form 'FORM1' are allocated. You want to format it using the form 'FORM2'. In this case:

HEADER-TDSTYLE = 'STYLE1', 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

The 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 the description of a text module, such as short text, creator, and so on.

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

TABLETYPE

DIRECTION = 'IMPORT'

TABLETYPE contains the type of table FOREIGN. If you created this table, for example, by uploading a local file in binary format, which means that all lines except the last are filled completely and the lines may contain carriage return and line feed, you must use TABLETYPE = 'BIN'. If the table is a normal lines table, use TABLETYPE = 'ASC'.

DIRECTION = 'EXPORT'

TABLETYPE contains the type of table FOREIGN. If you want to compress the table, that is, give it a file-like structure, use the entire width of 134 characters, and separate the individual logical lines with carriage return and line feed, you must use TABLETYPE = 'BIN'. If you use TABLETYPE = 'ASC', you get a normal lines table.

Default value:     'ASC'

 

Import parameters:

 

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!

 

 

 

 

End of Content Area