Passing SY-REPID not allowed

In ABAP Objects, you cannot pass the system field SY-REPID as an actual parameter to an external procedure.

In ABAP Objects, an error message occurs on:

CALL FUNCTION func EXPORTING p = sy-repid.

Correct syntax:

DATA repname TYPE sy-repid.

repname = sy-repid.
CALL FUNCTION func EXPORTING p = repname.

Reason:

When the parameters are passed to the formal parameters, SY-REPID already contains the name of the main program of the procedure you have called, even though you intended to pass the name of the calling program.

Overview:

Replacement for Obsolete Statements ABAP Objects