Data Directive not updating PO summary fields

,

BPM Functions? I’ll have to look into that, we are on 10.2.500

Good news though, I decided to give up on the singular Data Directive, tried using a Method Directive and it works perfectly!!

Here’s the working code I pieced together for QuickJobEntry.GenerateJob, I’m sure with a little editing it will work on the other 2 methods as well.

Erp.Tables.JobOper JobOper;
Erp.Tables.JobAsmbl JobAsmbl;

Erp.Contracts.POSvcContract hPOApproveHandle = null;

if (hPOApproveHandle == null) 
{
  hPOApproveHandle = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.POSvcContract>(Db);
} 

foreach (var ttQuickJob_iterator in (from ttQuickJob_Row in ttQuickJob
                                    select ttQuickJob_Row))
{
    var ttQuickJobRow = ttQuickJob_iterator;
    JobOper = (from JobOper_Row in Db.JobOper
               where string.Compare(JobOper_Row.JobNum, ttQuickJobRow.JobNum, true) == 0
               select JobOper_Row).FirstOrDefault();
               
if(JobOper == null)
{
this.PublishInfoMessage("No job information!!", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
}

if(JobOper != null)
  {

var PODataSet = new Erp.Tablesets.POTableset();

string JobNum = JobOper.JobNum;
int AssemblySeq = JobOper.AssemblySeq;
int OprSeq = JobOper.OprSeq;
string PartNum = JobOper.PartNum;

hPOApproveHandle.GetNewPOHeader(ref PODataSet);
var poHeader = PODataSet.POHeader[0];

poHeader.OrderDate = DateTime.Today;

poHeader.BuyerID = "JPOWELL";

hPOApproveHandle.ChangeVendor("REACT1", ref PODataSet);

hPOApproveHandle.Update(ref PODataSet);

int intPONum = poHeader.PONum;

hPOApproveHandle.GetNewPODetail(ref PODataSet, intPONum);
hPOApproveHandle.ChangeDetailTranType("PUR-SUB", ref PODataSet);
hPOApproveHandle.ChangeDetailJobNum(JobNum, ref PODataSet);
hPOApproveHandle.ChangeDetailAssemblySeq(AssemblySeq, ref PODataSet);
hPOApproveHandle.ChangeDetailJobSeq(OprSeq, ref PODataSet);
hPOApproveHandle.CheckBeforeUpdate(out str2, out str3, out str4, "PODetail", PODataSet);
hPOApproveHandle.Update(ref PODataSet);

if (PODataSet != null) {

  PODataSet.POHeader[0].RowMod= "U";
  
  hPOApproveHandle.ValidateAcctForGLControl(intPONum, out str1);
  
  hPOApproveHandle.ChangeApproveSwitch(true,out ViolationMsg, ref PODataSet);
      
  hPOApproveHandle.CheckBeforeUpdate(out str2, out str3, out str4, "POHeader", PODataSet);
  
  hPOApproveHandle.Update(ref PODataSet);

  
}
}
}

Thanks @Arul, sorry I didn’t take your advice sooner. Just had to learn the hard way and let me suffer for a week or 2. :sweat_smile:

1 Like