SAP ABAP SUBROUTINES

Get Example source ABAP code based on a different SAP table
  


ARTICLE

Subroutines
Before the introduction of ABAP Objects, subroutines were mainly used for the local modularization of programs, however, they can also be called externally. Their functionality is implemented between the statements FORM and ENDFORM . A subroutine is declared either directly when implemented or by using the statement FORM ... DEFINITION .
Subroutines should no longer be created in new programs for the following reasons:
The parameter interface has clear weaknesses when compared with the parameter interface of methods, such as:
positional parameters instead of keyword parameters
no genuine input parameters in pass by reference
typing is optional
no optional parameters
Every subroutine implicitly belongs to the public interface of its program. Generally this is not desirable.
Calling subroutines externally is critical with regard to the assignment of the container program to a program group in the internal session. This assignment cannot generally be defined as static.
In those places where subroutines cannot yet be replaced by methods ( PERFORM ON COMMIT|ROLLBACK, GENERATE SUBROUTINE POOL), they should be used purely as wrappers for method calls and must not contain any other functional coding.