Item Journal Line - Dataport issue.

Aravindh_NavisionAravindh_Navision Member Posts: 258
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

  • rhpntrhpnt Member Posts: 688
    ...Item A is only 10 nos.
    What do you mean by "nos"?
  • chengalasettyvsraochengalasettyvsrao Member Posts: 711

    Can any please help me how to solve this?

    Look for Stock out warning message functionality in Sales & Receivable Setup . Its simmilar to your requirement.
  • chengalasettyvsraochengalasettyvsrao Member Posts: 711
    rhpnt wrote:
    ...Item A is only 10 nos.
    What do you mean by "nos"?

    Probably nos unit of measure code is Numbers.
  • Aravindh_NavisionAravindh_Navision Member Posts: 258
    Thank you rhpnt and chengalasettysvrao,

    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.
  • rhpntrhpnt Member Posts: 688
    As far as I can see you're not validating the Quantity field.
  • Aravindh_NavisionAravindh_Navision Member Posts: 258
    Could you please tell me, where to validate the quantity field?
  • rhpntrhpnt Member Posts: 688
    If you knew how to validate the item number then...
  • Aravindh_NavisionAravindh_Navision Member Posts: 258
    Please see the above coding fully. Where should I place the VALIDATE(Quantity)?
  • SavatageSavatage Member Posts: 7,142
    Why would you calculate the Amount (Amount := (StandardCost * Quantity);)

    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.
Sign In or Register to comment.