Change quantity on a Sales Order with Drop Shipment

Boran
Member Posts: 7
Hello All,
I have a problem with a program related to order with Drop Shipment.
I want to do the following: when a quantity on a Sales order line (which has a purchase order in drop shipment) is modified, the corresponding quantity in the purchase order line must be modified.
Here is my program :
IF "Purchase Order No." <> '' THEN BEGIN
IF "Purch. Order Line No." <> 0 THEN BEGIN
IF "Quantity Shipped" > Quantity THEN
ERROR(
Text100,
Quantity,
"Quantity Shipped")
ELSE BEGIN
ConfirmationHA:=CONFIRM(Text101,FALSE);
IF ConfirmationHA THEN BEGIN
IF RecCdeAchat.GET("Document Type","Purchase Order No.","Purch. Order Line No.") THEN BEGIN
IF RecCdeAchat."Quantity Received">Quantity THEN
ERROR(
Text100,
Quantity,
RecCdeAchat."Quantity Received")
ELSE BEGIN
RecCdeAchat."MAJ quantité Liv.Directe":=TRUE;
RecCdeAchat.Quantity:=Quantity;
RecCdeAchat.VALIDATE(RecCdeAchat.Quantity);
RecCdeAchat.MODIFY(TRUE);
END;
END;
END;
END;
END;
END;
The program is executed in the « On Validate » trigger of the quantity in
the table « Sales line ».
My problem is that, when I modify the quantity on the Sales line, the quantity on the Purchase line is modified but not the quantity of the sales line. I have an error message :
« Another user has modified the record for this sales line after you
retrieved it from the database…»
If I remove the program line
«PurchaseLine.VALIDATE(PurchaseLine.Quantity);»
I don’t have any more this message but the program on the « On
Validate » of the quantity on the Purchase line will not be executed...
Thank you for your help !!!!!!!!
I have a problem with a program related to order with Drop Shipment.
I want to do the following: when a quantity on a Sales order line (which has a purchase order in drop shipment) is modified, the corresponding quantity in the purchase order line must be modified.
Here is my program :
IF "Purchase Order No." <> '' THEN BEGIN
IF "Purch. Order Line No." <> 0 THEN BEGIN
IF "Quantity Shipped" > Quantity THEN
ERROR(
Text100,
Quantity,
"Quantity Shipped")
ELSE BEGIN
ConfirmationHA:=CONFIRM(Text101,FALSE);
IF ConfirmationHA THEN BEGIN
IF RecCdeAchat.GET("Document Type","Purchase Order No.","Purch. Order Line No.") THEN BEGIN
IF RecCdeAchat."Quantity Received">Quantity THEN
ERROR(
Text100,
Quantity,
RecCdeAchat."Quantity Received")
ELSE BEGIN
RecCdeAchat."MAJ quantité Liv.Directe":=TRUE;
RecCdeAchat.Quantity:=Quantity;
RecCdeAchat.VALIDATE(RecCdeAchat.Quantity);
RecCdeAchat.MODIFY(TRUE);
END;
END;
END;
END;
END;
END;
The program is executed in the « On Validate » trigger of the quantity in
the table « Sales line ».
My problem is that, when I modify the quantity on the Sales line, the quantity on the Purchase line is modified but not the quantity of the sales line. I have an error message :
« Another user has modified the record for this sales line after you
retrieved it from the database…»
If I remove the program line
«PurchaseLine.VALIDATE(PurchaseLine.Quantity);»
I don’t have any more this message but the program on the « On
Validate » of the quantity on the Purchase line will not be executed...
Thank you for your help !!!!!!!!
0
Comments
-
You can create a boolean variable in the Purch.line.
Set this to true before you validate the Purch.line quantity and back to false after you are done.RecCdeAchat.SentFromSalesLine := TRUE; RecCdeAchat.Quantity:=Quantity; RecCdeAchat.VALIDATE(RecCdeAchat.Quantity); RecCdeAchat.SentFromSalesLine := FALSE;
In the Quantity OnValidate trigger of the Purch.line read this booleanIF NOT SentFromSalesLine THEN BEGIN //Code that tries to change the Salesline Quantity here END;
0 -
how do you handle a case where the sale & puch have different UOM's?
or do all your items have the same purch & sale UOM?0 -
Yes the items have the same UOM.
I try to change the quantity on the sales line and I expect the quantity to be changed on the associated Purchase line. It works with the purchase line, the quantity is updated, but on the sales line I initialy modified, the quantity is wrong and come back to the initial value. Then the message appears : « Another user has modified the record for this sales line after you retrieved it from the database…»0 -
I was curious about your post because I wanted to try something similar but in reverse. http://www.mibuso.com/forum/viewtopic.php?p=814870
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions