Hi,
Â
Try with the below code.
Â
for each ttJobHead:
  for each JobMtl no-lock where jobmtl.company = cur-comp and jobmtl.jobnum = ttJobHead.JobNum :
      for last PODetail where PODetail.Company = JobMtl.Company and
           PODetail.PartNum = JobMtl.PartNum no-lock .
      end.
      if available PODetail then do:
      {lib/PublishInfoMsg.i &InfoMsg = string( PODetail.UnitCost)}
       run lib\UpdateTableBuffer.p(input BUFFER JobMtl:HANDLE, 'EstUnitCost' , PODetail.UnitCost).
    end.
  end.
end.
Â
If you are on Vantage 8.03.409 or later versions, you can use direct assign statement JobMtl.EstUnitCost = PODetail.UnitCost by changing no-lock to exclusive-lock on JobMtl.
Â
Regards,
Arul
Â
________________________________
From: chunyu_jim_hou <yuyu729@...>
To: vantage@yahoogroups.com
Sent: Wednesday, 5 June 2013 7:12 AM
Subject: [Vantage] JobEntry.GetDetails Post-Processing 4GL codes
Â
Hi, Experts
I am new to BPM and was trying to write a JobEntry.GetDetails Post-Processing 4GL codes so that every time we get details, it gets the last PO cost.(all our company parts are non-inventory, costing method = average and all job material are set up as purchase direct, so the estunitcost it brings when getting details are mostly $0)
I wrote information message showing where the code is and the code below actually displays the last PO cost for each material
I have two questions,
1. I tried cur-jobnumber in "for" statement but it doesnt work..any other way to limit the jobmtl.jobnum equals to the job user is in? in my code I used jobmtl.jobnum = 'test' just to test rest of the codes.
2. I was trying to make JobMtl.EstUnitCost = PODetail.UnitCost but below code isnt working:
run lib\UpdateTableBuffer.p(input BUFFER JobMtl:HANDLE, 'JobMtl.EstUnitCost' , PODetail.UnitCost).
am I putting the parameters in correctly?
Here is the code:
for each JobMtl where jobmtl.company = cur-comp and jobmtl.jobnum = 'test' :
if available JobMtl then do:
find last PODetail where PODetail.Company = JobMtl.Company and
PODetail.PartNum = JobMtl.PartNum no-lock no-error.
if available PODetail then do:
{lib/PublishInfoMsg.i &InfoMsg = " PODetail.UnitCost"}
run lib\UpdateTableBuffer.p(input BUFFER JobMtl:HANDLE, 'JobMtl.EstUnitCost' , PODetail.UnitCost).
end.
end.
end.
Thank you in advance for any inputs.
[Non-text portions of this message have been removed]
Â
Try with the below code.
Â
for each ttJobHead:
  for each JobMtl no-lock where jobmtl.company = cur-comp and jobmtl.jobnum = ttJobHead.JobNum :
      for last PODetail where PODetail.Company = JobMtl.Company and
           PODetail.PartNum = JobMtl.PartNum no-lock .
      end.
      if available PODetail then do:
      {lib/PublishInfoMsg.i &InfoMsg = string( PODetail.UnitCost)}
       run lib\UpdateTableBuffer.p(input BUFFER JobMtl:HANDLE, 'EstUnitCost' , PODetail.UnitCost).
    end.
  end.
end.
Â
If you are on Vantage 8.03.409 or later versions, you can use direct assign statement JobMtl.EstUnitCost = PODetail.UnitCost by changing no-lock to exclusive-lock on JobMtl.
Â
Regards,
Arul
Â
________________________________
From: chunyu_jim_hou <yuyu729@...>
To: vantage@yahoogroups.com
Sent: Wednesday, 5 June 2013 7:12 AM
Subject: [Vantage] JobEntry.GetDetails Post-Processing 4GL codes
Â
Hi, Experts
I am new to BPM and was trying to write a JobEntry.GetDetails Post-Processing 4GL codes so that every time we get details, it gets the last PO cost.(all our company parts are non-inventory, costing method = average and all job material are set up as purchase direct, so the estunitcost it brings when getting details are mostly $0)
I wrote information message showing where the code is and the code below actually displays the last PO cost for each material
I have two questions,
1. I tried cur-jobnumber in "for" statement but it doesnt work..any other way to limit the jobmtl.jobnum equals to the job user is in? in my code I used jobmtl.jobnum = 'test' just to test rest of the codes.
2. I was trying to make JobMtl.EstUnitCost = PODetail.UnitCost but below code isnt working:
run lib\UpdateTableBuffer.p(input BUFFER JobMtl:HANDLE, 'JobMtl.EstUnitCost' , PODetail.UnitCost).
am I putting the parameters in correctly?
Here is the code:
for each JobMtl where jobmtl.company = cur-comp and jobmtl.jobnum = 'test' :
if available JobMtl then do:
find last PODetail where PODetail.Company = JobMtl.Company and
PODetail.PartNum = JobMtl.PartNum no-lock no-error.
if available PODetail then do:
{lib/PublishInfoMsg.i &InfoMsg = " PODetail.UnitCost"}
run lib\UpdateTableBuffer.p(input BUFFER JobMtl:HANDLE, 'JobMtl.EstUnitCost' , PODetail.UnitCost).
end.
end.
end.
Thank you in advance for any inputs.
[Non-text portions of this message have been removed]