Sales Order - Import of customer + sales order

mickeee
Member Posts: 2
Hi all, im trying to import a XML document containing one Customer and one Sales Order from another system. I have tried to do the "Walkthrough: Inserting Data from XML Documents to Multiple Tables" and have added some functionality. The import works, but it's missing the Sales Order Lines.
The system throws an error and i have a few questions:
1) Error msg i getting: Unable to compare operands of type NavCode with NavOption. What does this mean? And how do i fix it?
2) Even if I have specified the exact file to import, when i hit Run, it opens a "choose your xml file" window. Why?
3) Why is the Sales Order Lines missing after the import?
This is my XML file layout:
<Root>
<Customer>
<NewCustomerNo>1931370</NewCustomerNo>
<BillToNamea>Marielle Karlsson</BillToNamea>
<GenBusPost>NATIONELL</GenBusPost>
<VatPost>NATIONELL</VatPost>
<CustPost>INRIKES</CustPost>
</Customer>
<Header>
<DocumentType>Order</DocumentType>
<SellToCustomerNo>10000</SellToCustomerNo>
<No>12007</No>
<BillToName>Marille Karlsson</BillToName>
<BillToAddress>vägen 22</BillToAddress>
<BillToCity>STOCKHOLM</BillToCity>
<BillToContact>Mr. Andy Teal</BillToContact>
<BillToCountryRegion />
<BillToPostCode>100 05</BillToPostCode>
<Line>
<DocumentType>Order</DocumentType>
<Type>Item</Type>
<ItemNo>1000</ItemNo>
<DocumentNo>12007</DocumentNo>
<LineNo>20000</LineNo>
<Description>Kablar för hagtalare</Description>
<UnitOfMeasure>STYCK</UnitOfMeasure>
<Quantity>100</Quantity>
<UnitPrice>1340.00</UnitPrice>
<LocationCode>VIT</LocationCode>
</Line>
</Header>
</Root>
This is my Codeunit:
Documentation()
OnRun()
SalesOrderXmlFile := 'C:\Users\Public\Downloads\temp01.xml';
UPLOADINTOSTREAM('Import','',' Xml Files (*.xml)|*.xml',SalesOrderXmlFile,XmlStream);
IsImported := XMLPORT.IMPORT(XMLPORT::MultipleTables, XmlStream);
IF (IsImported = TRUE) THEN
MESSAGE('The import from XML is complete.')
ELSE
MESSAGE( 'FEL!' + GETLASTERRORTEXT);
And here is a Printscreen from my XMLPort

The system throws an error and i have a few questions:
1) Error msg i getting: Unable to compare operands of type NavCode with NavOption. What does this mean? And how do i fix it?
2) Even if I have specified the exact file to import, when i hit Run, it opens a "choose your xml file" window. Why?
3) Why is the Sales Order Lines missing after the import?
This is my XML file layout:
<Root>
<Customer>
<NewCustomerNo>1931370</NewCustomerNo>
<BillToNamea>Marielle Karlsson</BillToNamea>
<GenBusPost>NATIONELL</GenBusPost>
<VatPost>NATIONELL</VatPost>
<CustPost>INRIKES</CustPost>
</Customer>
<Header>
<DocumentType>Order</DocumentType>
<SellToCustomerNo>10000</SellToCustomerNo>
<No>12007</No>
<BillToName>Marille Karlsson</BillToName>
<BillToAddress>vägen 22</BillToAddress>
<BillToCity>STOCKHOLM</BillToCity>
<BillToContact>Mr. Andy Teal</BillToContact>
<BillToCountryRegion />
<BillToPostCode>100 05</BillToPostCode>
<Line>
<DocumentType>Order</DocumentType>
<Type>Item</Type>
<ItemNo>1000</ItemNo>
<DocumentNo>12007</DocumentNo>
<LineNo>20000</LineNo>
<Description>Kablar för hagtalare</Description>
<UnitOfMeasure>STYCK</UnitOfMeasure>
<Quantity>100</Quantity>
<UnitPrice>1340.00</UnitPrice>
<LocationCode>VIT</LocationCode>
</Line>
</Header>
</Root>
This is my Codeunit:
Documentation()
OnRun()
SalesOrderXmlFile := 'C:\Users\Public\Downloads\temp01.xml';
UPLOADINTOSTREAM('Import','',' Xml Files (*.xml)|*.xml',SalesOrderXmlFile,XmlStream);
IsImported := XMLPORT.IMPORT(XMLPORT::MultipleTables, XmlStream);
IF (IsImported = TRUE) THEN
MESSAGE('The import from XML is complete.')
ELSE
MESSAGE( 'FEL!' + GETLASTERRORTEXT);
And here is a Printscreen from my XMLPort

0
Answers
-
I found the issue!
I had a wrong LinkFields under the Line element!
This solved the import..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