cancel
Showing results for 
Search instead for 
Did you mean: 

GRPO Approval - Workflow using SAP B1 Studio

Former Member
0 Kudos

I have created GRPO workflow. Whenever the GRPO is created with special item (inspection required), it has to go for approval.  The workflow diagram is below

The Script in conditional event is below

var param = company.getRecordsetParams();

var inspection = 0;

var query = "select itemcode from pdn1 T0 inner join OPDN T1 on T0.DocEntry = T1.DocEntry  inner join OITM T2 on T0.itemcode = T2.itemcode and U_inspection='Y'  Where T1.DocNum = '" + CurrentProcess.DataObject('id').getItem('DocNum') +"'";

print(query);

param.setQuery(query);

var recordset = company.getRecordset();

recordset.doQuery(param);

while(0 < recordset.read()) {

  inspection = 1;

  break;

}

inspection = 1;

In the GRPO approved script Task, I have the below code

var udoKey = CurrentProcess.DataObject('GRPO_Submit').getItem('Key');

var udoType = CurrentProcess.DataObject('GRPO_Submit').getItem('ObjType');

var udoSvc = company.getGeneralService(udoType);

var udoSvcParam = udoSvc.getGeneralDataParam();

udoSvcParam.put("DocEntry", udoKey);

var udo = udoSvc.getByParams(udoSvcParam);

udo.put("RequestStatus", "Y");

udoSvc.update(udo);

FYI: GRPO_Submit id is nothing but "PurchaseDeliveryNotes" business object.

I am getting the below error in workflow log also the document is not in draft stage.  I have followed the steps mentioned the SAP B1 workflow configuration guide. I do not know what steps i have missed. I am using SAP B1 PL10 - 64bit client

2016-02-12 03:06:57 [ERROR] [MessageQueueThread] [WFScriptEngineSchedular] : Error Evaluate java script:var udoKey = CurrentProcess.DataObject('GRPO_Submit').getItem('Key');

var udoType = CurrentProcess.DataObject('GRPO_Submit').getItem('ObjType');

var udoSvc = company.getGeneralService(udoType);

var udoSvcParam = udoSvc.getGeneralDataParam();

udoSvcParam.put("DocEntry", udoKey);

var udo = udoSvc.getByParams(udoSvcParam);

udo.put("RequestStatus", "Y");

udoSvc.update(udo);

2016-02-12 03:06:57 [ERROR] [MessageQueueThread] [Exception] : Got exception(thread=MessageQueueThread)=>javax.script.ScriptException: javax.script.ScriptException: lu.flier.script.TypeError: TypeError: Cannot call method 'put' of null (  @ 7 : 4 )  -> udo.put("RequestStatus", "Y");

at lu.flier.script.V8ScriptEngine.eval(null:-1)

at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)

at sap.b1workflow.engine.script.WFScriptEngineSchedular.doRequest(WFScriptEngineSchedular.java:186)

at sap.b1workflow.engine.script.WFScriptEngineSchedular.access$300(WFScriptEngineSchedular.java:24)

at sap.b1workflow.engine.script.WFScriptEngineSchedular$WFScriptEngineSchedularThread.run(WFScriptEngineSchedular.java:122)

Caused by:javax.script.ScriptException

javax.script.ScriptException: lu.flier.script.TypeError: TypeError: Cannot call method 'put' of null (  @ 7 : 4 )  -> udo.put("RequestStatus", "Y");

at lu.flier.script.V8CompiledScript.eval(null:-1)

at lu.flier.script.V8ScriptEngine.eval(null:-1)

at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)

at sap.b1workflow.engine.script.WFScriptEngineSchedular.doRequest(WFScriptEngineSchedular.java:186)

at sap.b1workflow.engine.script.WFScriptEngineSchedular.access$300(WFScriptEngineSchedular.java:24)

at sap.b1workflow.engine.script.WFScriptEngineSchedular$WFScriptEngineSchedularThread.run(WFScriptEngineSchedular.java:122)

Caused by:lu.flier.script.TypeError

lu.flier.script.TypeError: TypeError: Cannot call method 'put' of null (  @ 7 : 4 )  -> udo.put("RequestStatus", "Y");

at lu.flier.script.V8CompiledScript.internalExecute(null:-2)

at lu.flier.script.V8CompiledScript.eval(null:-1)

at lu.flier.script.V8ScriptEngine.eval(null:-1)

at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)

at sap.b1workflow.engine.script.WFScriptEngineSchedular.doRequest(WFScriptEngineSchedular.java:186)

at sap.b1workflow.engine.script.WFScriptEngineSchedular.access$300(WFScriptEngineSchedular.java:24)

at sap.b1workflow.engine.script.WFScriptEngineSchedular$WFScriptEngineSchedularThread.run(WFScriptEngineSchedular.java:122)

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Please help me.