Item Master Data Import

mfox
Member Posts: 4
Version Nav 6.0
I am trying to create a dataport to import update Items into the system. To keep it simple, I am uploading the "No.", "Description" and "Sales Unit Of Measure" Field.
To ensure validation on the Sales Unit of Measure, I have written the following code in the "onAfterImportRecord" Event:
VALIDATE("Sales Unit of Measure");
MODIFY;
Once I run this routine, I get the following error:
"The Item Unit of Measure Does Not Exist"
Now if I go into the Item Master Card, under the Invoicing Tab, The Sales Unit Of Measure shows "EACH", but when I click on the drop down the "Code Field" is empty. I have to click on that drop down key and select "EACH" from that menu.
What am I missing here????
I am trying to create a dataport to import update Items into the system. To keep it simple, I am uploading the "No.", "Description" and "Sales Unit Of Measure" Field.
To ensure validation on the Sales Unit of Measure, I have written the following code in the "onAfterImportRecord" Event:
VALIDATE("Sales Unit of Measure");
MODIFY;
Once I run this routine, I get the following error:
"The Item Unit of Measure Does Not Exist"
Now if I go into the Item Master Card, under the Invoicing Tab, The Sales Unit Of Measure shows "EACH", but when I click on the drop down the "Code Field" is empty. I have to click on that drop down key and select "EACH" from that menu.
What am I missing here????
0
Comments
-
The UOM is a lookup from another table - Item Unit Of Measure.
So one thing you can do is check if the code exist and if it doesn't then INSERT it.
Something Like Below.
OnAfterImportRecord()IF "Item Unit Of Measure".GET(Item."No.", Item."Base Unit of Measure") THEN BEGIN MESSAGE('Item UOM Already Exists'); END ELSE BEGIN "Item Unit Of Measure".Code := Item."Base Unit of Measure"; "Item Unit Of Measure"."Item No." := Item."No."; "Item Unit Of Measure"."Qty. per Unit of Measure" := 1; "Item Unit Of Measure".INSERT(TRUE); Item."Purch. Unit of Measure" := Item."Base Unit of Measure"; Item."Sales Unit of Measure" := Item."Base Unit of Measure"; END;
0 -
Thank you for your response I am new at this,
Will I have to add the "Item Unit Of Measure" table to the dataport for the Variable Reference?0 -
View->Globals
Add
Variable Name->ItemUOM ->Type "Record"->Subtype "Item Unit Of Measure"IF ItemUOM.GET(Item."No.", Item."Base Unit of Measure") <<or insert your vaiable names if you're using variables THEN BEGIN MESSAGE('Item UOM Already Exists'); END ELSE BEGIN ItemUOM.Code := Item."Base Unit of Measure"; ItemUOM."Item No." := Item."No."; ItemUOM."Qty. per Unit of Measure" := 1; ItemUOM.INSERT(TRUE); //I see your first post - you're omly paying attention to "Sales Unit Of Measure" //All three are important. In fact I think Base is the most important. Item."Purch. Unit of Measure" := Item."Base Unit of Measure"; Item."Sales Unit of Measure" := Item."Base Unit of Measure"; END;
0 -
Excellent, worked like a charm.
Thank you very much.0 -
-
[Topic moved from 'NAV 2009' forum to 'NAV/Navision' forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
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