javabapijco

Getting error Field UCLASS is not a member of BAPIUCLASS while updating through JCo


I am trying to update UCLASS field value using BAPI_USER_CHANGE through JCo, but getting below error:

com.sap.conn.jco.JCoRuntimeException: Field UCLASS is not a member of BAPIUCLASS

Here is my code to set the value:

    JCoStructure license = params.getStructure("UCLASS");
    license.setValue("UCLASS", changes.get(0).getCurrent());
    JCoStructure licenseX = params.getStructure("UCLASSX");
    licenseX.setValue("UCLASS", 'X');

Can you please tell me this comes under which Structure? tried also with LOGONDATA and ADDRESS?


Solution

  • Logon with a SAP GUI and use transaction SE37 to display the parameters and structures of the RFM BAPI_USER_CHANGE. The ABAP workbench offers forward navigation. So if you would like to see how this UCLASS structure looks like, go to the Import tab of the RFM BAPI_USER_CHANGE and double-click on the Associated Type BAPIUCLASS.

    You are correctly getting the error message because there is no field with name UCLASS in the RFM parameter UCLASS (which is a JCoStructure).
    Instead of this, license.setValue("LIC_TYPE", "XY"); would be valid here, for example.

    If you want to set another structure as a whole, you would have to use
    params.setValue("UCLASS", myJCoStructure);.