SYNTAX-CHECK



Basic form

SYNTAX-CHECK FOR itab ...MESSAGE f ...LINE g ...WORD h.

Additions




1. ... PROGRAM f1
2. ... INCLUDE f2
3. ... OFFSET f3
4. ... TRACE-TABLE t1
5. ... DIRECTORY ENTRY f4
6. ... REPLACING f5
7. ... FRAME ENTRY f6
8. ... MESSAGE-ID f7
9. ... ID tabid TABLE itab

Effect

Syntax check for programs

The program code is taken from the internal table itab . If a syntax error is detected during the check, the fields f , g and h are filled as follows: - f contains the error message text - g contains the program line where the error occurred - h contains the incorrect word in the program

Example

f and h are declared as text fields and g as a whole number (integer).
DATA: f(240), g TYPE I, h(72).

The return code value is set as follows:

SY-SUBRC = 0 The program contains no syntax errors.
SY_SUBRC = 4 The program contains syntax errors.
SY-SUBRC = 8 Other errors hav occurred.

Addition 1

... PROGRAM f1

Effect

Specifies a program name

If the addition DIRECTORY ENTRY is missing, the program name is used to determine the program attributes required for the check, e.g.:
- include or program - the logical database
The field f1 is meant to contain the field attributes of SY-REPID .

Addition 2

... INCLUDE f2

Effect

If there is a syntax error, this field contains the name of the include program where the error occurred.
The field f2 is meant to contain the field attributes of SY-REPID .

Addition 3

... OFFSET f3

Effect

If there is a syntax error, this field contains the position of the incorrect word in the incorrect line.
The field f3 should be declared as a whole number (integer).

Addition 4

... TRACE-TABLE t1

Effect

Trace output is stored in this table. To switch trace output on or off during program checks, you use the SYNTAX-TRACE ON and SYNTAX-TRACE OFF statements.

Addition 5

... DIRECTORY ENTRY f4

Effect

The program attributes required for the check are taken from the field f4 which must correspond to the structure of the table TRDIR .

Addition 6

... REPLACING f5
The field f5 is meant to contain the field attributes of SY-REPID .

Effect

The program code placed in the internal table is an include, not the main program. Therefore, it is the main program specified under PROGRAM which is to be checked. If this program contains an include name f5 , the contents of the internal table should be taken into account instead.
You should use this addition only with PROGRAM .

Addition 7

... FRAME ENTRY f6

Effect

The main program attributes required for the check (e.g. logical database, program type) are taken from the field f6 . f6 should have the structure of the table TRDIR .

Addition 8

... MESSAGE-ID f7

Effect

If a syntax error occurs, the field f7 contains the relevant message key which has a structure similar to the table TRMSG .

Addition 9

... ID tabid TABLE itab

Effect

Returns syntax check information. tabid contains the type of information written to the internal table itab .
For correction proposals ( ID 'CORR' ), the type group SLIN must be included, for other information the tyep group SYNT . Both these type groups contain the necessary type specifications.
Please do not use this addition. It is intended only for internal use!
tabid outputs the following information from the program code: ID 'MSG ' ... warning messages ID 'CORR' ... correction proposals ID 'SYMB' ... technical symbol table dump ID 'DATA' ... data objects from the program ID 'DPAR' ... data object parameters ID 'TYPE' ... type objects from the program ID 'FOTY' ... type objects used by FORM routines ID 'FUTY' ... type objects used by function modules ID 'TYCH' ... components of type objects ID 'CROS' ... referenced data objects ID 'STR ' ... identifiers ID 'FORM' ... FORM routines ID 'FPAR' ... FORM parameters ID 'PERF' ... PERFORM calls ID 'APAR' ... PERFORM parameters ID 'FUNC' ... function modules ID 'FFPA' ... function module parameters ID 'CALL' ... CALL FUNCTION calls ID 'FAPA' ... CALL FUNCTION parameters ID 'HYPH' ... data objects with a hyphen in the name ID 'INCL' ... includes in the program

Index
© SAP AG 1996