Start of Content Area

 CONVERT_TEXT_R2   Locate the document in its SAP Library structure

The function module converts texts from SAP R/2 text format to SAPscript format of the SAP system.

Apart form converting the format structure of the text lines, the function module considers the following attributes of R/2 texts:

        line attributes

        control statements

        symbols

During the conversion, several incompatibilities can occur. These incompatibilities are grouped into levels. The parameter ERRORLEVEL returns the level number of the most serious incompatibility.

 

Line format

The line format of R/2 texts is similar to that of SAPscript texts. Both lines consist of a field that contains the line format and a field with the actual line contents. Conversion of line formats is described under 'Line attributes'.

A text line in R/2 can consist of up to 220 characters; in SAPscript, the line contents is limited to 132 characters. If an R/2 text line consists of more than 132 characters, the system transfers the remainder into a subsequent line with no paragraph format.

Line attributes

SAPscript does not distinguish between fixed and variable lines, but knows only what R/2 calls variable lines. To convert the R/2 line formats, the following rules apply:

        At lines with the attributes A and F always a new SAPscript paragraph starts.

        Adjacent lines with the attribute V are considered as one paragraph. If before the first V line a line with attribute F appears, then the first V line is the beginning of a new SAPscript paragraph. If the line before the V block has the attribute A, the V lines are considered as continuation of the A line and no new paragraph is started.

        By default, all paragraphs receive the SAPscript standard paragraph format '*'. To specify a different paragraph format, use the parameters PARAGRAPH_AV and PARAGRAPH_F.

Control statements

The system does not convert the following control statements, since they have no equivalents in SAPscript:

.nlf        print the next two lines on top of each other

.psz      set the number of lines per page

.lpi        define line distance

.prn output control statement for printer

.off        set left margin for lines with V attribute

.nam     determine name of spool file

.set       define value for number and chapter variable

The other R/2 control statements are converted to SAPscript statements as follows:

.ifi &symbol

/: I'F &symbol(I)& EQ ' 

.ifn &symbol

I/:  'F &symbol& NE '

.abs <n>

 /:PROTECT

contents of the next <n> lines from R/2 text

/: ENDPROTECT

.def &symbol=<value>

/: DEFINE &symbol& = '<value>

.pct=<value>

/: DEFINE &pct& = '<value>'

.top <text no>

/: TOP

/: INCLUDE <text no>

/: ENDTOP

.bot <text no>

/: BOTTOM

/: INCLUDE <text no>

/: ENDBOTTOM

 

Symbols

On one hand, symbols are converted to the different syntax of SAPscript; on the other hand, the names of R/2 database symbols that consist of table name/segment ID and field name must be converted to the different table and field names of the SAP system.

As for the syntax, you can use SAPscript for all formatting options (offset, length, prefix text), except converting a symbol value using a table.

To assign the symbol names of R/2 database symbols to the corresponding SAP names, use the function module RS3L_CONVERT_FIELDNAME. For more information, see the documentation of this function module.

The system passes the parameters SOURCE_SYSTEM, SOURCE_RELEASE, SOURCE_OBJECT, DESTINATION_TABLE, and IGNORE_ALIASNAMES without further interpretation to this function module.

The R/2 symbols for chapter variables (p0..p3) are not transferred to SAPscript.

 

Function call:

 

CALL FUNCTION  'CONVERT_TEXT_R2'

     EXPORTING  HEADER_R2         = ?...

                HEADER            = ?...

                DIRECTION         = 'IMPORT'

                PARAGRAPH_AV      = '* '

                PARAGRAPH_F       = '* '

                INCLUDE_ID        = 'ST  '

                INCLUDE_ZEROS     = 'X'

                INCLUDE_PREFIX    = SPACE

                COMMENT_LINES     = 'X'

                SOURCE_SYSTEM     = 'SAP'

                SOURCE_RELEASE    = SPACE

                SOURCE_OBJECT     = SPACE

                DESTINATION_TABLE = SPACE

                IGNORE_ALIASNAMES = SPACE

                ERROR_COMMENTS    = SPACE

     IMPORTING  NEWHEADER_R2      =

                NEWHEADER         =

                NEWSTYLE          =

                ERRORLEVEL        =

     TABLES     LINES_R2          = ?...

                LINES           = ?...

 

Export parameters:

 

HEADER_R2

You must enter the text header of the R/2 text.

Structure:    TEXTH

HEADER

You must enter the text header of the SAPscript text.

Structure:    THEAD

DIRECTION

Specify the conversion direction. At present, the SAP system supports only conversions from R/2 texts to the SAPscript format, that is, the value IMPORT.

Default value:     'IMPORT'

PARAGRAPH_AV

Enter the paragraph format you want to use at the beginning of an R/2 line block with the attributes A or V. If you leave the field empty or if it contains blanks, the system uses the standard paragraph format '*'.

Reference field:  TLINE-TDFORMAT

Default value:     '*'

PARAGRAPH_F

Enter the paragraph format you want to use for each R/2 line with the line attribute F. If you leave the field empty or if it contains blanks, the system uses the standard paragraph format '*'.

Reference field:  TLINE-TDFORMAT

Default value:     '*'

INCLUDE_ID

If the R/2 texts include standard texts, the system converts them into a SAPscript INCLUDE statement. Use this parameter to specify the ID of the SAPscript text.

Reference field:  THEAD-TDID

Defaultwert 'ST'

INCLUDE_ZEROS

When converting texts from the SAP R/2 system, the system transfers the numbers of the included standard texts with a length of eight digits, thus including leading zeroes.

Use the parameter to influence the conversion of the leading zeroes in the standard text number.

Possible values:

'X'   include leading zeroes

'  '         delete leading zeroes

Default value:     'X'

Example

The R/2 text includes the standard text 33. The respective text line looks like this:

S   00000033

In SAPscript, this text line is represented by the INCLUDE statement:

/: INCLUDE '00000033' OBJECT 'TEXT' ID 'ST'

If the parameter INCLUDE_ZEROS contains SPACE, the generated INCLUDE statement looks like this:

/: INCLUDE '33' OBJECT 'TEXT' ID 'ST'

INCLUDE_PREFIX

If the R/2 text modules you want to convert include standard texts, you can enter a prefix here, which the system will place before the text number in the INCLUDE statement:

Default value:     SPACE

Example

INCLUDE_PREFIX = 'R2_'

R/2 line:    S  00001234
SAPscript line:       /:  INCLUDE 'R2_00001234'....

COMMENT_LINES

The parameter determines how to treat R/2 command lines that SAPscript no longer supports.

Possible values:

'X'   include lines as comment lines

'  '         leave out lines

Default value:     'X'

SOURCE_SYSTEM

Enter the name of the system from which the text module originates. Usually, it is 'SAP'.

Default value:     'SAP'

 

The function module CONVERT_TEXT_R2 directly passes this parameter to the parameter SOURCE_SYSTEM of the internally called function module RS3L_CONVERT_FIELDNAME, which converts the field name. For more information, see the parameter documentation of that function module.

SOURCE_RELEASE

Enter the release of the R/2 text module. The system needs the entry to convert the database symbols of the R/2 text.

Default value:     SPACE

The function module CONVERT_TEXT_R2 directly passes this parameter to the parameter with the same name of the internally called function module RS3L_CONVERT_FIELDNAME, which converts the field name. For more information, see the parameter documentation of that function module.

SOURCE_OBJECT

Enter the migration object within which the field name is converted.

Default value:     SPACE

The function module CONVERT_TEXT_R2 directly passes this parameter to the parameter BMIG_OBJECT of the internally called function module RS3L_CONVERT_FIELDNAME, which converts the field name. For more information, see the parameter documentation of that function module.

DESTINATION_TABLE

Enter the table to which the converted text belongs.

Default value:     SPACE

The function module CONVERT_TEXT_R2 directly passes this parameter to the parameter R3_TABLE of the internally called function module RS3L_CONVERT_FIELDNAME, which converts the field name. For more information, see the parameter documentation of that function module.

IGNORE_ALIASNAMES

Use the parameter to control the alias name check during the conversion.

Possible values:

'X'   ignore check

'  '         execute check

Default value:     SPACE

The function module CONVERT_TEXT_R2 directly passes this parameter to the parameter with the same name of the internally called function module RS3L_CONVERT_FIELDNAME, which converts the field name. For more information, see the parameter documentation of that function module.

ERROR_COMMENTS

Use the parameter to define whether to include certain errors, which occur during the conversion, as comments into the SAPscript text. The messages usually refer to an error that was detected when converting the subsequent text line.

Possible values:

'X'   include error message as comment

'  '         do not include error messages

For each message line, a prefix specifies where the error message originates. For more information, see the respective documentation.

CTR2    error message from text conversion routine

            -> function module CONVERT_TEXT_R2

RS3L    error message from field name conversion

            -> function module RS3L_CONVERT_FIELDNAME

If for an error no error text exists, the system displays after the prefix the character chain '?..'.

Default value:     SPACE

 

Import parameters:

 

NEWHEADER_R2

Changed header of the R/2 text.

Since at present only the conversion R/2 to SAPscript is supported, the system places the text header specified in the parameter HEADER_R2 without changes into this parameter.

Structure:    TEXTH

NEWHEADER

The parameter returns the text header with the fields changed according to the executed actions.

Structure:    THEAD

NEWSTYLE

Not filled at present.

Reference field:  THEAD-TDSTYLE

ERRORLEVEL

When converting R/2 texts to SAPscript format, several problems may occur. The parameter returns the highest level of the encountered problems.

ERRORLEVEL = 0:

No problems detected.

ERRORLEVEL = 1:

         Smaller problems detected, which concern formatting. The actual text is converted without changes.

         Character for default separator deleted.

         Words split by line feeds concatenated (only for lines with attributes A or V).

         The internal call of function module RS3L_CONVERT_FIELDNAME returned error level 1 when converting the field name.

ERRORLEVEL = 2:

         The system did convert text elements, but cannot ensure that the SAP system can interpret these texts.

         The converted text contained symbols, for which the system cannot ensure that they can be replaced by the respective values in the SAP system:

                symbols that refer to table fields *)

                symbols that refer to segment fields *)

                symbols converted using the R/2 table 164V

*) These errors can occur only if the function module RS3L_CONVERT_FIELDNAME does not exist.

         The internal call of function module RS3L_CONVERT_FIELDNAME returned error level 2 when converting a field name.

ERRORLEVEL = 3:

         The R/2 text contained functions that SAPscript no longer or not yet supports.

         R/2 commands:.nlf,.psz,.lpi,.prn,.off,.nam

         Conversion of symbol values using a table &symbol(Txxxx)

         Chapter counters: &p0... &p3

         The internal call of function module RS3L_CONVERT_FIELDNAME returned error level 3 when converting a field name.

ERRORLEVEL = 4:

         Conversion error

         Statement line truncated:

The line length of the SAPscript text module is shorter than a converted command. The system truncated the remainder of the line. SAPscript cannot or not correctly interpret the statement.

         Invalid reference to standard text:

In the R/2 text, a line with line format S occurs whose line contents is no valid text number.

         The internal call of function module RS3L_CONVERT_FIELDNAME returned error level 4 or higher when converting a field name.

         The internal call of function module RS3L_CONVERT_FIELDNAME triggered one of the exceptions DOUBLE_TUMLE, DOUBLE_TUMLA or INTERNAL_ERROR when converting a field name.

Note

The meaning of the error levels concerning function module RS3L_CONVERT_FIELDNAME is described in the documentation of that function module.

Reference field:      SY-SUBRC

 

Table parameters:

 

LINES_R2

The table contains the text lines of the text in R/2 format.

Structure:    TEXTL

LINES

The table contains the text lines of the text in the SAPscript format.

Structure:    TLINE

 

 

 

 

End of Content Area