One of the functions we implemented in SAP system is not working correctly. In SAP system all functions are working correctly and return the right values, however, when called in Java JCo the Client wants a structure rather than a String or int.
When extracting the structure from the Parameter it gives a Structure that has two unnamed columns each with no lengths of Bytes to be filled in.
Metadata:
{[],[]}
0,0
We tried different datatypes in SAP system for the Input Parameter "I_REZEPT" like int8 and char12
private String sollwerte(JSONObject jsonin) throws JSONException, JCoException {
String id = String.valueOf(jsonin.getInt("rezeptid"));
JCoStructure in = input.getStructure("I_REZEPT");
System.out.println("Fieldcount:"+in.getFieldCount());
input.setValue("I_REZEPT", id);
e.printStackTrace();
function.execute(destination);
...
Stacktrace:
com.sap.conn.jco.ConversionException: (122) JCO_ERROR_CONVERSION: Cannot convert a value of '1' from type java.lang.String to STRUCTURE at field I_REZEPT at com.sap.conn.jco.rt.AbstractRecord.createConversionException(AbstractRecord.java:436) at com.sap.conn.jco.rt.AbstractRecord.createConversionException(AbstractRecord.java:430) at com.sap.conn.jco.rt.AbstractRecord.setValue(AbstractRecord.java:2824) at com.sap.conn.jco.rt.AbstractRecord.setValue(AbstractRecord.java:3933) at edu.hsalbsig.intellifarm.connector.sap.IntellifarmSapFunction.sollwerte(IntellifarmSapFunction.java:226) at edu.hsalbsig.intellifarm.connector.sap.IntellifarmSapFunction.execute(IntellifarmSapFunction.java:61) at edu.hsalbsig.intellifarm.connector.mqtt.IntellifarmMqttClient.messageArrived(IntellifarmMqttClient.java:98) at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage(CommsCallback.java:513) at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:416) at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:213) at java.base/java.lang.Thread.run(Thread.java:834)
While debugging the function from SAP system, it looks like this
Input:
|--------|
| PARAMETERS 'INPUT'
|--------|
|I_REZEPT|
|--------|
| |
|--------|
|I_REZEPT|
|--------|
expected was something like this
Input:
|------------------|
| PARAMETERS 'INPUT'
|------------------|
|I_REZEPT |
|------------------|
|012345678901234567|
|------------------|
| |
|------------------|