on 08-28-2014 7:47 AM
Hi,
I am trying to update the Custom Data of Shop Order through Routing script , but it is not happening.
do we need some setting ( like security or other) ? Please suggest?
FYI - when I am doing the same through MII query it is happening successfully
Thanks
Hi!
I wounder how you are doing this. Please share your script.
Regards,
Sergiy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
importClass(Packages.com.sap.me.frame.BasicBOBeanException);
importClass(Packages.com.sap.me.frame.Data);
throw new BasicBOBeanException(101, new Data("ERROR","Error1"));
sfcHandle=COMPLETE_DATA.getHandle("SFC_BO");
operationHandle=COMPLETE_DATA.getHandle("OPERATION_BO");
//get shoporderBO
getRouterSQL = "select shop_order_bo from sfc where sfc= '" + SFC + "'" ;
SFCRouterData=executeQuery(getRouterSQL);
SFCRouter=SFCRouterData.get("SHOP_ORDER_BO");
throw new BasicBOBeanException(101, new Data("ERROR","Error1"+SFCRouter));
//check for a Parametric measure LABELTEST_PASS_FAIL
Sql1="SELECT TOP(1)";
Sql1=sql1+" t1.max_measure_actual";
Sql1=sql1+" FROM";
Sql1=sql1+" (";
Sql1=sql1+" SELECT MAX(pm.actual) as max_measure_actual";
Sql1=sql1+" FROM parametric p";
Sql1=sql1+" inner join parametric_measure pm";
Sql1=sql1+" on pm.parametric_bo = p.handle";
Sql1=sql1+" WHERE p.para_context_gbo = '"+sfcHandle+"' and";
Sql1=sql1+" p.operation_bo = '"+operationHandle+"' and";
Sql1=sql1+" pm.measure_name = ' LABELTEST_PASS_FAIL ' ";
Sql1=sql1+" GROUP BY p.handle";
Sql1=sql1+" HAVING MAX(pm.actual) = 'PASS'";
Sql1=sql1+" ) t1";
res1=executeQuery(sql1);
if (res1 == null)
{
throw new BasicBOBeanException(101, new Data("ERROR","Label verification has failed, please log a Non Conformance before you continue."));
}
else
{
Sql2=" update custom_fields";
Sql2=sql2+" set value = 'Y'";
Sql2=sql2+" where attribute = 'LABEL_VERIFIED’ and";
Sql2=sql2+" handle = '"+ SFCRouter +"'";
executeUpdate(sql2);
exit(false);
}
I guess that executeUpdate() could have been banned in the last releases, though it worked in old ones. And I would agree with that. The reason, at least, is that routing scripts do not guarantee transactional mechanism: if anything fails during script execution, it will not be rolled back. And the second reason is that originally the routing scripts were designed only for decision-making of choosing the next step - no collection/update of production data was planned.
User | Count |
---|---|
92 | |
11 | |
10 | |
6 | |
5 | |
5 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.