1

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?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Ram
  • 423
  • 4
  • 26
  • `UCLASS` and `UCLASSX` are the names of two parameters of `BAPI_USER_CHANGE`, they are structures (of types `BAPIUCLASS` and `BAPIUCLASSX` respectively) which both contain many fields. The method `setValue` must be used to fill the value of each field of that structure, e.g. `license.setValue("LIC_TYPE","any value")` will set the field `LIC_TYPE` of the structured parameter `UCLASS`. – Sandra Rossi May 03 '23 at 09:54

1 Answers1

0

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);.

Trixx
  • 1,796
  • 1
  • 15
  • 18
  • Thanks again for the detailed response and making me understand. I tried with **LIC_TYPE**, it worked. – Ram Sep 06 '18 at 19:07