tags:

views:

164

answers:

2

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.

+2  A: 

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.

vwegert
+1  A: 

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

franblay