sapdev logo background
sapdev logo sapdev logo
Comments

ABAP PERFORM PARAMETERS Statement syntax, information and example SAP source code



Return to Statement index



PERFORM - parameter_list

Short Reference

ABAP Syntax ... [TABLES itab1 itab2 ...]
[USING a1 a2 ...]
[CHANGING a1 a2 ...].

ABAP_ADDITIONS:
1 ... TABLES itab1 itab2 ...
2 ... USING a1 a2 ...
3 ... CHANGING a1 a2 ...

What does it do? These additions assign actual parameters to the formal parameters from the parameter interface for the subroutine subr . All data objects whose data type matches the
typing of the corresponding formal parameter can be specified (see Check Typing ) as actual parameters. Each formal parameter assumes all the properties of the actual parameter assigned to it when it is called. The order of the additions is fixed.

ABAP_ADDITION_1 ... TABLES itab1 itab2 ...

What does it do? If the addition TABLES is specified, each table parameter t1 t2 ... for the subroutine called that is defined with the addition TABLES of the FORM statement must be assigned an internal table itab as the actual parameter. The assignment of the actual parameters to the formal parameters takes place using their positions in the lists t1 t2 ...
and itab1 itab2 ... .
Only standard tables can be specified for itab . The data is passed using a reference. If a specified table itab has a header line , this is also passed; otherwise, the header line in the corresponding table parameter t is blank when it is called.

Latest notes: The use of table parameters in the interface for subroutines is obsolete but a large number of subroutines have not yet been converted to appropriately typed USING or CHANGING parameters, so that they must still be supplied with data by the
TABLES addition of the PERFORM statement.

Example ABAP Coding Static call of the internal subroutine
select_sflight while passing a table parameter.
PARAMETERS: p_carr TYPE sflight-carrid,
p_conn TYPE sflight-connid.

DATA sflight_tab TYPE STANDARD TABLE OF sflight.

...

PERFORM select_sflight TABLES sflight_tab
USING p_carr p_conn.

...

FORM select_sflight TABLES flight_tab LIKE sflight_tab
USING f_carr TYPE sflight-carrid
f_conn TYPE sflight-connid.
SELECT *
FROM sflight
INTO TABLE flight_tab
WHERE carrid = f_carr AND
connid = f_conn.
ENDFORM.

ABAP_ADDITION_2 ... USING a1 a2 ...

ABAP_ADDITION_3 ... CHANGING a1 a2 ...

What does it do? If the additions USING and CHANGING are specified, an actual parameter a1 a2 ... of the appropriate type must be assigned to each of the formal parameters u1 u2 ... and c1 c2 ... defined with the same additions of the
FORM statement. The actual parameters specified after
USING and CHANGING form a single shared list. They are assigned to the formal parameters after the position in the shared list. The type of parameter pass is defined by the additions USING and CHANGING of the FORM statement. The addition USING must be before CHANGING . Otherwise, the assignment of the actual parameters to the additions USING and CHANGING is irrelevant to the PERFORM statement. It is also irrelevant whether only one or both of the additions is specified.

Latest notes: For program documentation purposes, it is best to specify the additions USING and CHANGING in the FORM statement in accordance with the definition of the parameter interface.
In non- Unicode programs , memory area can be addressed outside an actual parameter if offsets/lengths are specified for an actual parameter a1 a2 ... . In non -Unicode programs , the length is set to the length of the current parameter if an offset is specified without a length. Both of these produce warnings in the syntax check and syntax errors in
Unicode programs . The rules for the ASSIGN
statement apply to the addressable memory area in non -Unicode programs as well.
No substring access is possible after an actual parameter of type string or xstring specified after
USING or CHANGING .

Example ABAP Coding The following five PERFORM statements mean the same but only the fourth is recommended, since it is the only one that documents the interface of the subroutine called.
DATA: a1 TYPE string,
a2 TYPE string,
a3 TYPE string,
a4 TYPE string.

PERFORM test USING a1 a2 a3 a4.
PERFORM test CHANGING a1 a2 a3 a4.
PERFORM test USING a1 CHANGING a2 a3 a4.
PERFORM test USING a1 a2 CHANGING a3 a4.
PERFORM test USING a1 a2 a3 CHANGING a4.

...

FORM test USING p1 TYPE string
p2 TYPE string
CHANGING value(p3) TYPE string
value(p4) TYPE string.
...
ENDFORM.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




PERFORM_OBSOLETE
PERFORM_SUBR




comments powered by Disqus