A replicated stored procedure is an Adaptive Server stored procedure that you have marked for replication using either sp_setrepproc or sp_setreplicate. A function replication definition describes the primary and the replicated stored procedure, its parameters, and its location.
When you create a function replication definition, Replication Server creates a function, which contains the information in the function replication definition.
When a replicated stored procedure that has its own function replication definition is invoked, its function is transferred from the source to a destination Replication Server. In most cases, the replicated stored procedure is invoked at the primary database and delivered to the replicate database. The only exception is the request function replication with a version earlier than 15.1 without subscription and with such replication definition, where the stored procedure is invoked at the replicate database and delivered to the primary database. In all cases, the primary Replication Server is always the Replication Server where the replication definition is created. This Replication Server controls the primary database. See Replication Server 15.6 Administration Guide Volume 2 > Pre-15.1 Request Function Replication.
The function passes parameters to the corresponding stored procedure that is, in turn, invoked in the destination database. A function string translates the function to a syntax that a subscribing database can interpret. When used correctly, function replication can dramatically improve performance because it can encapsulate multiple operations in a single function. Replicated stored procedures do not have to modify any data in order to be replicated.