Search in sources :

Example 1 with JCoStructure

use of com.sap.conn.jco.JCoStructure in project iaf by ibissource.

the class SapFunctionFacade method message2FunctionCall.

public void message2FunctionCall(JCoFunction function, String request, String correlationId, ParameterValueList pvl) throws SapException {
    JCoParameterList input = function.getImportParameterList();
    int requestFieldIndex = findFieldIndex(input, getRequestFieldIndex(), getRequestFieldName());
    setParameters(input, function.getTableParameterList(), request, requestFieldIndex);
    if (pvl != null) {
        for (int i = 0; i < pvl.size(); i++) {
            ParameterValue pv = pvl.getParameterValue(i);
            String name = pv.getDefinition().getName();
            String value = pv.asStringValue("");
            int slashPos = name.indexOf('/');
            if (slashPos < 0) {
                input.setValue(name, value);
            } else {
                String structName = name.substring(0, slashPos);
                String elemName = name.substring(slashPos + 1);
                JCoStructure struct = input.getStructure(structName);
                struct.setValue(elemName, value);
            }
        }
    }
    int correlationIdFieldIndex = findFieldIndex(input, getCorrelationIdFieldIndex(), getCorrelationIdFieldName());
    if (correlationIdFieldIndex > 0 && input != null) {
        input.setValue(correlationIdFieldIndex - 1, correlationId);
    }
}
Also used : ParameterValue(nl.nn.adapterframework.parameters.ParameterValue) JCoStructure(com.sap.conn.jco.JCoStructure) JCoParameterList(com.sap.conn.jco.JCoParameterList)

Aggregations

JCoParameterList (com.sap.conn.jco.JCoParameterList)1 JCoStructure (com.sap.conn.jco.JCoStructure)1 ParameterValue (nl.nn.adapterframework.parameters.ParameterValue)1