use of com.sap.conn.jco.JCoField in project JavaClasses by genexuslabs.
the class EnterpriseConnect method getValue.
/* --- Get Return Values --- */
public void getValue(String parameterName, GXSimpleCollection[] value) {
if (value.length != 0) {
GXSimpleCollection col = value[0];
col.clear();
JCoTable tbl = function.getTableParameterList().getTable(parameterName);
JSONArray jCol = new JSONArray();
try {
for (int i = 0; i < tbl.getNumRows(); i++) {
JSONObject jRow = new JSONObject();
tbl.setRow(i);
for (JCoField field : tbl) {
if (field.getType() == JCoMetaData.TYPE_INT || (field.getType() == JCoMetaData.TYPE_NUM && field.getDecimals() == 0)) {
jRow.put(field.getName(), field.getLong());
} else if (field.getType() == JCoMetaData.TYPE_INT2 || field.getType() == JCoMetaData.TYPE_INT1 || field.getType() == JCoMetaData.TYPE_BYTE) {
jRow.put(field.getName(), field.getInt());
} else if (field.getType() == JCoMetaData.TYPE_NUM || field.getType() == JCoMetaData.TYPE_FLOAT || field.getType() == JCoMetaData.TYPE_BCD) {
jRow.put(field.getName(), field.getDouble());
} else {
jRow.put(field.getName(), field.getString());
}
}
jCol.put(jRow);
}
col.FromJSONObject(jCol);
} catch (JSONException ex) {
throw new RuntimeException(ex.toString());
}
}
}
use of com.sap.conn.jco.JCoField in project JavaClasses by genexuslabs.
the class EnterpriseConnect method getValue.
public void getValue(String parameterName, IGxJSONAble[] value) {
try {
IGxJSONAble struct = value[0];
JCoStructure jStruct = function.getExportParameterList().getStructure(parameterName);
JSONObject jRow = new JSONObject();
for (JCoField field : jStruct) {
if (field.getType() == JCoMetaData.TYPE_NUM || field.getType() == JCoMetaData.TYPE_FLOAT || field.getType() == JCoMetaData.TYPE_BCD) {
jRow.put(field.getName(), field.getDouble());
} else {
jRow.put(field.getName(), field.getString());
}
}
struct.FromJSONObject(jRow);
} catch (JSONException ex) {
throw new RuntimeException(ex.toString());
}
}
Aggregations