通过changecompany 在别的帐套生成数据
今天在QQ群里有朋友问能不能在销售订单保存时在其他帐套也同样保存一份。想了很多种思路,最后觉得还是用AX自带保留字changecompany 做最为方便。 由于本人太懒,没有去直接解决这位朋友的问题。写了一个JOB,希望对这位朋友有所帮助。
static void change_company(Args _args)
{
CustTable cust,custDAN;
DataAreaId DataAreaId;
AxCustTable _AxCustTable;
;
DataAreaId = 'dan';
while select cust where cust like 'AA%'
// 要写入另一个帐套的数据筛选
{
changecompany(DataAreaId)
{
_AxCustTable = new AxCustTable();
_AxCustTable.parmAccountNum(cust.AccountNum);
_AxCustTable.parmName(cust.Name);
_AxCustTable.save(); //调用AX系统类写入
}
}
}



浙公网安备 33010602011771号