SAP NetWeaver AS ABAP Release 751, ©Copyright 2017 SAP AG. All rights reserved.ABAP - Keyword Documentation → ABAP - Reference → Obsolete Language Elements → Obsolete modularization → Subroutines →
The statement FORM defines a subroutine subr and its interface. Naming conventions apply to the subr name. The functions of the subroutine subr are implemented between the statements FORM and ENDFORM. The additions define the formal parameters of the subroutine and declare the propagation of the class-based exceptions to the caller.
Local data types and data objects can be declared within the subroutine. Furthermore, the formal parameters of the subroutine and the global data types and data objects of the master program can be accessed.
Subroutines are called using the statement PERFORM.
Subroutines are obsolete. In new programs, methods must be used instead.
... TABLES table_parameters
TABLES is used to declare table parameters table_parameters. Table parameters are obsolete formal parameters that are typed as internal standard tables with header lines. The addition TABLES can be specified only before USING or CHANGING.
If an internal table without header line or a table body is passed as an actual parameter to this type of formal parameter, an empty local header line is generated in the subroutine. If an internal table with header line is used as the actual parameter, both the table body and the header line are passed to the subroutine. Pass by value is not possible in formal parameters defined using TABLES.
... USING parameters
... CHANGING parameters
These additions define formal parameters parameters. Formal parameters can be used in the subroutine as data objects in all operand positions that match their typing and their modifiability defined by USING or CHANGING.
When the formal parameters parameter are defined, either pass by reference or pass by value can be defined. The effect of this definition for formal parameters defined with USING and CHANGING is as follows:
In a subroutine, the formal parameter ptab can be used in an operand position that expects an index table, since it is typed accordingly. The formal parameter wa is completely generic and the system waits until runtime to check whether it is suitable for the row type of the internal table.
FORM fill_table USING wa TYPE any
CHANGING ptab TYPE INDEX TABLE.
APPEND wa TO ptab.
... RAISING exc1|RESUMABLE(exc1) exc2|RESUMABLE(exc2) ...
The addition RAISING can be used to pass class-based exceptions exc1 exc2 ..., which are triggered in or propagated to the subroutine by the ABAP runtime environment or using the statement RAISE EXCEPTION or the addition THROW in a conditional expression, but are not handled in a TRY block. Subclasses of CX_STATIC_CHECK and CX_DYNAMIC_CHECK can be declared explicitly. Subclasses of CX_NO_CHECK are always declared implicitly with the addition RESUMABLE.
For exc1 exc2 ..., all exception classes that are visible at this point that are subclasses of CX_STATIC_CHECK CX_DYNAMIC_CHECK can be specified here. The exception classes must be specified in ascending order with respect to their inheritance hierarchy. Each exception class may only be specified once.
If an exception for this superclass is raised that cannot be handled and cannot be passed on, this produces either a syntax error or an exception that must be handled by the caller CX_SY_NO_HANDLER.
The addition RESUMABLE declares an exception that can be propagated as a resumable exception. This means:
If a superclass is declared as resumable, any subclasses must also be declared as resumable.