I want to import data to Table 83 Item Journal Line. I made a page action to run my xmlport. I have some code in OnBeforeInsertRecord to filter items based on the data in imported text file. I start the process, add the parameters on request page, but I get the following error message:
Phys. Inventory must be equal to ‘Yes’ in Item Journal Line: Journal Template Name=, Journal Batch Name=, Line No.=0. Current value is ‘No’.
My parameters are Journal Template Name and Journal Batch Name, so they don’t have the added value. I tried to set initial value of Phys. Inventory to yes. But after doing this, I have the following error message:
Phys. Inventory must be equal to ‘No’ in Item Journal Line: Journal Template Name=LELTAR, Journal Batch Name=LT2011_02, Line No.=1. Current value is ‘Yes’.
So, in this way I have the right data in Journal Template Name and Journal Batch Name, but Phys. Inventory is not good. In addititon to, the bulit-in Calculate Inventory function doesn’t work, too. So, it not a solution, either.
when you try to import to Qty. (Phys. Inventory) it check for Phys. Inventory to TRUE…
When exactly you are getting below error?
Phys. Inventory must be equal to ‘No’ in Item Journal Line: Journal Template Name=LELTAR, Journal Batch Name=LT2011_02, Line No.=1. Current value is ‘Yes’.
while importing only or while posting the entries?
I have this code in “ItemJournalLine - Import::OnBeforeInsertRecord()”. NaploSablonInput and NaploLapInput are the parameters from request page. LineNo is set to 0 in OnPreXMLport() trigger.
i’ve used this - it’s a dataport not an xmlport. but I find the order in which you import & validate is key!
OnAfterImportRecord()
“Item Journal Line”.VALIDATE(“Journal Template Name”,‘PHYS. INVE’);
“Item Journal Line”.VALIDATE(“Journal Batch Name”,‘CYCLE’); //change cycle to your code
“Item Journal Line”.VALIDATE(“Posting No. Series”,‘IJ-CC’); //change IJ-CC to your code
INIT;
“Line No.” := “Line No.” + 10000;
VALIDATE(“Posting Date”,WORKDATE);
VALIDATE(“Entry Type”,“Entry Type”::“Positive Adjmt.”);
VALIDATE(“Document No.”,‘10212011’); //If you have a doc # you would like to use add it here
VALIDATE(“Item No.”,ItemNo);
VALIDATE(“Location Code”,‘NY’); //change NY to your location code if using location codes
VALIDATE(“Source Code”,‘PHYSINVJNL’);
“Qty. (Phys. Inventory)” := 0;
“Phys. Inventory” := TRUE;
VALIDATE(“Qty. (Calculated)”,0);
VALIDATE(“Unit Amount”,0);
I will make the asumption if you follow the chain of fields as above you could fix your port.
you need to rfigure out which fields do & do not require validation
I tried my own code, and the code suggested by Savatage as well. They work properly in dataport, but the same code in xmlport gives the usual error message:
Phys. Inventory must be equal to ‘Yes’ in Item Journal Line: Journal Template Name=, Journal Batch Name=, Line No.=0. Current value is ‘No’.
In dataport the code is in OnAfterImportRecord(), in xmlport I have the code in InBeforeInsertRecord(). Is it good?
I think there is something important difference in operations of dataport and xmlport in such cases, but I can not figure out what it can be…
Unfortunately, my client has NAV 2009, so I have to use an xmlport in any case.