Skip to Content
0
Jun 14, 2021 at 06:55 AM

SAP Workflow API Error: No matching records found (ODBC -2028)

121 Views

I am trying to create a script task which will automatically generate approved return request documents then guide the user through the rest of the process.

I believe I am having an issue trying to give context to the draft service. There doesn't seem to be a way to give context that I can find, I can't pass anything into the method, so I have tried calling update() and passing through the object as well as calling getByParams() to see if either method would give context to the service.

No matter what I try the result I get when I call saveDraftToDocument is :

2021-06-14 13:12:16 [ERROR] [WorkflowEngine-akka.actor.default-dispatcher-4090] [WFException]    : Error during invoke DI service, service: DraftsService, command code: SaveDraftToDocument, param count: 0, error message: Client received SOAP Fault from server: No matching records found (ODBC -2028) Please see the server log to find more detail regarding exact cause of the failure.
2021-06-14 13:12:16 [DEBUG] [WorkflowEngine-akka.actor.default-dispatcher-4090] [ScriptActor]    : com.sap.sbo.wf.engine.exception.WFException Error during invoke DI service, service: DraftsService, command code: SaveDraftToDocument, param count: 0, error message: Client received SOAP Fault from server: No matching records found (ODBC -2028) Please see the server log to find more detail regarding exact cause of the failure.
2021-06-14 13:12:16 [ERROR] [WorkflowEngine-akka.actor.default-dispatcher-4090] [WFException]    : Exception raised during script execution, Error during invoke DI service, service: DraftsService, command code: SaveDraftToDocument, param count: 0, error message: Client received SOAP Fault from server: No matching records found (ODBC -2028) Please see the server log to find more detail regarding exact cause of the failure.

var param = company.getRecordsetParams();
var query = "SELECT WddCode FROM OWDD WHERE Status = \'Y\' AND ObjType = \'234000031\' AND DocEntry IS NULL"
print(query);
param.setQuery(query);
var recordset=company.getRecordset();
recordset.doQuery(param);
if (recordset.read()) {
    var field = recordset.getField(0); 
    var wddCode = field.getColumnValue();     
    print("wddCode =" +wddCode); 

//generate document from draft
    wdd = company.getBusinessObject("122", wddCode);
    var draftService = company.getBusinessService("112");
    var draftEntry = wdd.getDraftEntry();
    print("Draft entry: " + draftEntry);
    var draft = company.getBusinessObject("112", draftEntry);
    var draftParams = company.createDIObject("DocumentParams");
    draftParams.setDocEntry(draftEntry);
    var another = draftService.getByParams(draftParams);
    draftService.saveDraftToDocument();
}