Question: We are having a BAPI that uploads the specified document to SAP.

The BAPI accept three parameters:
ID, FILE\_LOC and FOLDER\_NAME.
And I'm setting the values as follows in the JCo code:

```
JCO.ParameterList paramList = function.getImportParameterList();
paramList.setValue("101XS1", "EXTERNAL_ID");
paramList.setValue("tmp", "FOLDER_NAME");
paramList.setValue("D:/upload/foo.txt", "FILE_LOCATION");

```

But when I'm trying to execute the BAPI, am getting the following exception:

```
com.sap.mw.jco.JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: Exception condition "NOT_SUPPORTED_BY_GUI" raised.
    at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeExecute(Native Method)
    at com.sap.mw.jco.rfc.MiddlewareRFC$Client.execute(MiddlewareRFC.java:1242)
    at com.sap.mw.jco.JCO$Client.execute(JCO.java:3816)
    at com.sap.mw.jco.JCO$Client.execute(JCO.java:3261)

```

The same BAPI is working fine if I execute through thick client(SAP Logon). But through JCo, its giving this error.

Answer: 
This error in itself does not tell you more than "the ABAP program (function module) raised an exception named NOT\_SUPPORTED\_BY\_GUI". What this really means is probably that the function module tried to access some GUI-related function - which is illegal for BAPIs, so either this is a custom-made RFC function module or you have found a programming error in the SAP standard coding and should open a SAPnet support ticket.
You can't use GUI services in non-gui operations, as RFC or background JOBs. In general avoid use of class cl\_gui\_frontend\_services and functions GUI\_\*. Alternatively use OPEN\_DATASET FOR INPUT/OUTPUT isntruction in your RFC enabled function.

Regards