SAP PERFORM FORM ABAP Statements



Get Example source ABAP code based on a different SAP table
  


ID PERFORM
• IN PROGRAM PERFORM
• IF FOUND PERFORM
• OF PERFORM

PERFORM, subr_identifier
Short Reference

ABAP_SYNTAX
... subr
$| ${subr$|(sname) IN PROGRAM $[prog$|(pname)$] $[IF FOUND$]$}
$| ${n OF subr1 subr2 ...$} ...

ABAP_ALTERNATIVES:
1 ... subr ...
2 ... subr$|(sname) IN PROGRAM $[prog$|(pname)$] $[IF FOUND$] ...
3 ... n OF subr1 subr2 ...

What does it do?
These names are used in the statement PERFORM to specify the called program and the ABAP program in which it is defined.



Latest notes:

NON_V5_HINTS
In addition to the alternatives shown here, there is another obsolete form of the external subroutine call.
ABAP_HINT_END

ABAP Alternative 1 ... subr ...

What does it do?
When specified directly, subr calls any subroutine of the current program using its name declared in the statement FORM . The subroutine must exist.



Example ABAP Coding

Call of a directly specified subroutine without parameters.
ABEXA 00492
ABAP_EXAMPLE_END

ABAP Alternative 2 ... subr$|(sname) IN PROGRAM $[prog$|(pname)$]$[IF FOUND$] ...

ABAP Addition
... IF FOUND
BEGIN_SECTION ID PERFORM-EXTERN

What does it do?
The specification is used to call any subroutine of the current program or of another program. The subroutine and the program can be specified as follows:
subr Direct static specification as subr.
(sname) Specification of the subroutine as the content of a character-like data object sname. The data object sname must contain the name of the subroutine in uppercase letters.
prog Direct specification of the program as prog (static external subroutine call).
(pname) Specification of the program as the content of a character-like data object pname (dynamic external subroutine call). The data object pname must contain the name of the program in uppercase letters. The following can be specified for pname:
Literal or constant
If the data object pname is specified as a character literal or as a constant, it can be evaluated statically, and the specified program is recognized as the used object.
Variable
BEGIN_SECTION ID PERFORM-DYNAMIC-PROGRAM
If the data object pname is specified as a variable, it is specified only dynamically, and the content is not evaluated statically.
END_SECTION ID PERFORM-DYNAMIC-PROGRAM When the statement is executed, pname is not evaluated until runtime (in both cases).
Valid programs for external subroutine calls are executable programs, module pools, function pools, and subroutine pools. If an external subroutine is specified statically, the syntax check does not check whether the specified program and subroutine exist, and nor does it check the type of the program. If the addition IF FOUND is not specified, the extended program check reports any invalid or nonexistent programs or subroutines as errors. This also applies to names specified as constants or literals.
If the statically or dynamically specified subroutine or program does not exist at runtime and the addition IS FOUND is not specified, a catchable exception of the class CX_SY_DYN_CALL_ILLEGAL_FORM or CX_SY_PROGRAM_NOT_FOUND is raised.
If the specified program exists, it is loaded, if required, into the ABAP_ISESS , raising the event LOAD-OF-PROGRAM, and is searched for the specified subroutine.



Latest notes:

External calls of subroutines are almost completely obsolete. Instead of subroutines, methods and function modules can be used as explicit functional interfaces of a program.
If no further addition is specified except IN PROGRAM (no IF FOUND, no parameter list), the program name can be omitted and is added implicitly with the name of the current program.