sapdev logo background
sapdev logo sapdev logo
Comments

ABAP GENERATE SUBR ERROR HANDLING Statement syntax, information and example SAP source code



Return to Statement index



GENERATE SUBROUTINE POOL - error_handling

Short Reference

ABAP Syntax ... [MESSAGE mess]
[INCLUDE incl]
[LINE lin]
[WORD wrd]
[OFFSET off]
[MESSAGE-ID mid]
[SHORTDUMP-ID sid] ... .

ABAP_ADDITIONS:
1 ... MESSAGE mess
2 ... INCLUDE incl
3 ... LINE lin
4 ... WORD wrd
5 ... OFFSET off
6 ... MESSAGE-ID mid
7 ... SHORTDUMP-ID sid

What does it do? These additions can be used to analyze syntax and generation errors of the GENERATE SUBROUTINE POOL statement. Syntax errors can either arise in the source code specified in itab , or in the include programs integrated using the
INCLUDE statement. Generation errors can occur, for example, if the program contains errors in declaration statements that are not identified in the static syntax check.
The following can be specified in all operand positions behind these additions:
An existing variable that matches the operand type.
An inline declaration DATA(var) , where a variable that matches the operand type is declared.

ABAP_ADDITION_1 ... MESSAGE mess

What does it do? If the subroutine pool contains one or more syntax errors, the text of the error message for the first syntax error is assigned to the variable mess . A character-like variable or an inline declaration that creates a variable of type string can both be specified for mess .
If a generation error occurs (see the addition SHORTDUMP-ID ), mess is also populated with the corresponding error message. If the subroutine pool can be generated, the content of mess remains unchanged.

ABAP_ADDITION_2 ... INCLUDE incl

What does it do? If one or more include programs are included in the subroutine pool and one of these contains the first syntax error of the subroutine pool, the name of this include program is assigned to the variable incl . A character-like variable or an inline declaration that creates a variable of type PROGNAME can both be specified for incl .
If the first syntax error in the source code occurs in itab , incl is assigned the internal name that would have been returned if generation in prog had been successful. This name always begins with "%_".
If a generation error occurs (see the addition SHORTDUMP-ID ), incl is also populated with the name of the corresponding include program . If the subroutine pool can be generated, the content of incl is not changed.

ABAP_ADDITION_3 ... LINE lin

What does it do? If the subroutine pool contains one or more syntax errors, the line number of the first syntax error, with reference to the program in which it occurs (either the source code in itab or an integrated include program), is assigned to the variable lin . A variable of type i or an inline declaration
that creates a variable of this type can both be specified for
lin .
If a generation error occurs (see the addition SHORTDUMP-ID ), lin is also populated with the corresponding line number. If the subroutine pool can be generated, the content of lin is not changed.

ABAP_ADDITION_4 ... WORD wrd

What does it do? If the subroutine pool contains one or more syntax errors, the first token with an error is assigned to the variable
wrd . A character-like variable or an inline declaration that creates a variable of type string can both be specified for wrd .
If a generation error occurs (see the addition SHORTDUMP-ID ), wrd is also populated with the corresponding token. If the subroutine pool can be generated, the content of wrd is not changed.

ABAP_ADDITION_5 ... OFFSET off

What does it do? If the subroutine pool contains one or more syntax errors, the offset of the first token with errors, with reference to the line in the source code, is assigned to the variable off . A variable of type i or an inline declaration
that creates a variable of this type can both be specified for
off .
If a generation error occurs (see the addition SHORTDUMP-ID ), off is also populated with the corresponding offset. If the subroutine pool can be generated, the content of off is not changed.

ABAP_ADDITION_6 ... MESSAGE-ID mid

What does it do? If the subroutine pool contains one or more syntax errors, the key under which the first error message is stored in the database table TRMSG is assigned to the variable mid .
If a generation error occurs (see the addition SHORTDUMP-ID ), mid is also populated with the corresponding key. If the subroutine pool can be generated, the content of mid is not changed.
The key of the database table TRMSG is made up of the components SPRAS of length 1, KEYWORD of length 20, and MSGNUMBER of length 4. The component MSGNUMBER is used for a three-character ID. The fourth position can contain a blank character or a letter. For error messages with multiple parts that fill more than one row in the database table TRMSG , all parts have the same three-character ID. The fourth character indicates the part of the message.
In Unicode programs , mid must have the data type TRMSG_KEY from ABAP Dictionary, constructed from the components SPRAS with length 1, KEYWORD with length 20, and MSGNUMBER with length 3. An inline declaration creates a structure like this. In non-Unicode programs , an appropriate structure or a flat character-like data object can be specified.

Latest notes: The return value in mid only contains the three-character ID of a syntax error message. For example, in order to use SELECT to read all parts of an error message from table
TRMSG , the key component MSGNUMBER must be specified generically in the WHERE condition, for example, by using LIKE and the wildcard character "%".

ABAP_ADDITION_7 ... SHORTDUMP-ID sid

What does it do? If the subroutine pool does not contains any statically identifiable syntax errors, but an exception is raised during generation, the ID of the runtime error that is assigned to the exception is assigned to the variable sid . A character-like variable or an inline declaration that creates a variable of type string can both be specified for sid .
If the subroutine pool can be generated, the content of sid is not changed.

Latest notes: An exception during generation interrupts the generation, but does not terminate the program. The runtime error is handled internally, but still causes a database rollback and the short dump to be saved.
The IDs of runtime errors are contained in the key column ERRID
of the database table SNAPT . Texts are assigned to the errors here.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




GENERATE_SUBROUTINE_POOL
GENERATE_SUBR_POOL_INTERNAL




comments powered by Disqus