Updated value of line is not getting inserted in the table
Markandey_Pandey
Member Posts: 178
Hi all,
I have created a table which will store purchase header and line data when order is received, so i have written the following code for that:
RecPurchaseLine->Record->Purchase Line
RecRcDetail->Record->Challan (Table i have created)
RecPurchaseLine.RESET;
RecPurchaseLine.SETRANGE("Document No.","No.");
IF RecPurchaseLine.FINDSET THEN
REPEAT
RecRcDetail.INIT;
RecRcDetail."Rc. No.":="Vendor Invoice No.";
RecRcDetail."Customer No.":="Pay-to Vendor No.";
RecRcDetail."Customer Name":="Pay-to Name";
RecRcDetail."Item No.":=RecPurchaseLine."No.";
RecRcDetail."Item Description":=RecPurchaseLine.Description;
RecRcDetail."Received Qty":=RecPurchaseLine."Qty. to Receive";
RecRcDetail.INSERT;
UNTIL (RecPurchaseLine.NEXT=0);
here even if i am changing the received qty on line but it is not affected and the old value from the line table is saved in the challan table.
can anybody suggest me what i should do so that when the qty is changed on the line on purchase order it should insert the changed value to challan table.
I have created a table which will store purchase header and line data when order is received, so i have written the following code for that:
RecPurchaseLine->Record->Purchase Line
RecRcDetail->Record->Challan (Table i have created)
RecPurchaseLine.RESET;
RecPurchaseLine.SETRANGE("Document No.","No.");
IF RecPurchaseLine.FINDSET THEN
REPEAT
RecRcDetail.INIT;
RecRcDetail."Rc. No.":="Vendor Invoice No.";
RecRcDetail."Customer No.":="Pay-to Vendor No.";
RecRcDetail."Customer Name":="Pay-to Name";
RecRcDetail."Item No.":=RecPurchaseLine."No.";
RecRcDetail."Item Description":=RecPurchaseLine.Description;
RecRcDetail."Received Qty":=RecPurchaseLine."Qty. to Receive";
RecRcDetail.INSERT;
UNTIL (RecPurchaseLine.NEXT=0);
here even if i am changing the received qty on line but it is not affected and the old value from the line table is saved in the challan table.
can anybody suggest me what i should do so that when the qty is changed on the line on purchase order it should insert the changed value to challan table.
Markandey Pandey
0
Comments
-
Hi Markandey,
Two issues that I can see
1. Where are you calling the code from - has the Purchase Line been updated yet
2. What is the Key on RecRcDetail? - you may have a problem on if the same item is used more that once on the document.0 -
DaveT wrote:Hi Markandey,
Two issues that I can see
1. Where are you calling the code from - has the Purchase Line been updated yet
2. What is the Key on RecRcDetail? - you may have a problem on if the same item is used more that once on the document.
Hi,
1.
I am aware of the issue 1. but not aware where i should call this code so that it will get the updated line.
2. I have used Challan No and Item No as a composite key so its not a problem if same item is used more than once.
need ur help on case 1.Markandey Pandey0 -
In the 90 codeunit
TempVATAmountLineRemainder.DELETEALL; PurchLine.CalcVATAmountLines(1,PurchHeader,PurchLine,TempVATAmountLine); IF PurchLine.FIND('-') THEN REPEAT ItemJnlRollRndg := FALSE; LineCount := LineCount + 1; .......ENTER YOUR CODE HERE........ IF GUIALLOWED THEN
Use only the INIT..INSERT block. Your don't have to repeat purchase lines.Cem Karaer @ Pargesoft
Dynamics NAV Developer since 20050 -
Set a break point and step through the debugger. Quickest and easiest way to see when a value is changing. Often it will be changed, but then changed back later on in code, or not saved to the database. Could be anything. When modifying posting routines the code needs to be evaluated as a whole, and only you can do that. Debugger is the way to go. If you can't determine the problem from there let us know.0
-
Hi thanx for your support,
i have one more problem, actually when i am invoicing i want to update the "Qty to Ship" from Sales line to the Challan table that i have created, so i have written the following code
in CodeUnit 80 (Sales-Post) after the following lines:-
////NAV CODE
IF ABS(SalesLine."Quantity Invoiced" + SalesLine."Qty. to Invoice") >
ABS(SalesLine."Return Qty. Received")
THEN BEGIN
SalesLine.VALIDATE("Qty. to Invoice",
SalesLine."Return Qty. Received" - SalesLine."Quantity Invoiced");
SalesLine."Qty. to Invoice (Base)" :=
SalesLine."Return Qty. Received (Base)" - SalesLine."Qty. Invoiced (Base)";
END;
////NAV CODE
/////MY CODE
RecRcDetail->Record->Challan
IF(RecRcDetail.FINDSET )THEN
BEGIN
RecRcDetail."Supplied Qty":=ABS(RecRcDetail."Supplied Qty"+SalesLine."Qty. to Ship");
RecRcDetail."Balance Qty":=ABS(RecRcDetail."Balance Qty"-SalesLine."Qty. to Ship");
RecRcDetail.MODIFY;
END
ELSE
ERROR('Record Does not Exist');
//////MY CODE
Suppose if there are two lines then the "Qty To Ship" from Sales Line is getting added and is upadated in the first line of Challan Table and second line remain blank.
I want to upadte the "QTY to SHIP" from sales line to Challan's "Supplied Qty"
I had tried to use
IF(RecRcDetail.GET("Rc. No","No.") ) instead of IF(RecRcDetail.FINDSET)) but the code is going in ELSE block in this case.
Can u plz guide meMarkandey Pandey0 -
Hi all
The issue is resolved.Markandey Pandey0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 333 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

