Hello Mattias,
welcome in the Scripting Language forum.
As I understand you correct, you want to use SAP GUI Scripting inside an RFC module. This means, you want to control the frontend server via SAP GUI Scripting in an executed RFC backend module.
Mhm, in my opinion tt is not really possible and not really recommended to use SAP GUI Scripting in RFC calls.
RFC (Remorte Function Call) is designed as a machine to machine (M2M) interface. So it is possible to use it without any UI. So you must check at first in the RFC the using of an UI, otherwise the module could have problems.
The using of the SAP GUI Scripting control in the backend server is generally forbidden in the SAP GUI for Windows security options. so you must disable the standard SAP Logon security options, if you want to use it directly.
![001.JPG]()
In my opinion is it from the architecture perspective with the separation from the front- and backend components better to renounce this scenario. You can use RFCs in SAP GUI Scripting on different ways - via SAP ActiveX control or via CCo (COM Connector) - easily, and you can use the results of the RFCs in your SAP GUI Script processing. It is not really necessary to mix these different components and their approaches, based on thereasons set out here.
If you really want to use SAP GUI Scripting from the ABAP backend I developed Background Light. This is a server application which allows to use COM libraries with ABAP background processes and without the SAP GUI for Windows. You can find more Information here.
You see it is interesting topic with many facets. Let us know your results.
Cheers
Stefan