Supported by
Supported by Inetum

Call RFC functions AS SEPARATE UNIT

images/thumbnail.jpg - Thumbnail

Imagine that you are calling an RFC function module several times in a row. Maybe you think that each call is completely independent from the others. It is not. The remote function group remains in memory and so does its global data. That global data will be reused on every call.

This is probably irrelevant in most cases. But there will be scenarios in which, for some reason, the function module being called is storing data in global variables which will negatively affect the outcome of the subsequent calls.

If you want to make sure you’ll have a clear slate every time the remote function module is called, just add AS SEPARATE UNIT to its call. It’s that simple.

CALL FUNCTION 'Z_DO_BUT_WITH_GLOBAL_VARIABLES'
DESTINATION rfcdest
AS SEPARATE UNIT.

Greetings from Abapinho.