Sales Order - Import of customer + sales order

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
zru1n1kz43r4.png

Answers

  • mickeeemickeee Member Posts: 2
    I found the issue!

    I had a wrong LinkFields under the Line element! :)

    This solved the import..
Sign In or Register to comment.