hi this is my code for partial product recipt for PO
static void Job219(Args _args) { PurchFormLetter PurchFormLetter; PurchLine PurchLine,PurchLineloc; SON_AttachmentELMOInvoice attachmentELMOInvoice; str invoiceNumber; PurchTable purchTable; int i=0; purchTable = purchTable::find('00002639 '); PurchFormLetter = PurchFormLetter::construct(DocumentStatus::PackingSlip); while select PurchLine group by DeliveryDate where PurchLine.PurchId == purchtable.PurchId { ttsBegin; while select PurchLineloc where PurchLineloc.DeliveryDate == PurchLine.DeliveryDate && PurchLineloc.PurchId == purchtable.PurchId { PurchLineloc.selectForUpdate(true); PurchLineloc.InventReceivedNow = PurchLineloc.PurchQty; PurchLineloc.PurchReceivedNow = PurchLineloc.PurchQty; PurchLineloc.update(); } ttsCommit; invoiceNumber = "rdgt133fs"; PurchFormLetter.update(purchtable,invoiceNumber,attachmentELMOInvoice.DeliveryDate,PurchUpdate::ReceiveNow); } }
I am getting an error as "
Cannot edit a record in Purchase order lines (PurchLine).
An update conflict occurred due to another user process deleting the record or changing one or more fields in the record."
any help what exactly i am doing wrong
*This post is locked for comments
Hi Rohit,
You can try two things here:
- Use a direct while select forupdate instead of the call .selectForUpdate(true)
- Call the PurchFormLetter.update() method outside the PurchLine loop.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156