I am trying to use the Call statement to invoke a function that displays information in a popup window. How can I avoid getting the error message
'GuiXT Call RFC Error' with the description 'Screen output without connection to user'?

Put a statement

Call Function "SYSTEM_ATTACH_GUI".

into your function module. This, by the way, also enables normal ABAP debugging of the called function (via a BREAK-POINT).