Hi Friends,
I have designed a dataport to import Item No., Entry Type, Quantity, Location Code from CSV file. After importing the following fields will get imported in the Item Journals. While posting, say for example, Item A is only 10 nos. in the inventory. But when I try to post 15 nos., normally it pops up with a screen saying the warning that only 10 is there, but you are posting 15. Do you want to post it now? But after importing the records from CSV file, this warning screen is not popping up. Can any please help me how to solve this?
I know that, I need to use the VALIDATE function. but still it is not working.
I wrote the below coding in Item journal Line - OnAfterImportRecord()
"Line No." := LastLineNo + 10000;
LastLineNo := "Line No.";
"Journal Template Name" := 'ITEM';
"Journal Batch Name" := 'DEFAULT';
"Source Code" := 'ITEMJNL';
// "Document No." := '1';
"Document No." := FORMAT(Date1,0,'<month,2><day,2><year>') + DocumentNo;
"Document Date" := "Posting Date";
// "Entry Type" := "User Define Entry Type";
"Posting Date" := Date1;
"Document Date" := Date1;
recItem.RESET;
recItem.SETRANGE(recItem."No.", "Item Journal Line"."Item No.");
IF recItem.FINDFIRST THEN
StandardCost := recItem."Unit Cost";
VALIDATE("Item No.");
"Unit Cost" := StandardCost;
"Unit Amount" := StandardCost;
Amount := (StandardCost * Quantity);
"Invoiced Quantity" := 0;
Comments
Look for Stock out warning message functionality in Sales & Receivable Setup . Its simmilar to your requirement.
Probably nos unit of measure code is Numbers.
10 nos. is quantity. UOM is pieces.
When I directly, enter the recrds in Item Journal and posting means, it is working. When I import through dataport and post means, it is not working.
Is this what you would do normally if manually entering the line?
That's what you want to do with your dataport.
That's why I like to import all values into variables first, then OnAfterImportRecord() map it back to the standard Nav fields. Basically in the same order as you would if manually entering. And to control when & where validation happens.
http://www.BiloBeauty.com
http://www.autismspeaks.org