Hi,
I am not that experienced in Navision so I need some advise from you EXPERTS.
I have th following task:
I have to develope a .NET application that can retrieve Items, Contacts from NAvision and deliver Sales order to Navision, I did managed the first part but I have problem with delivering sales orders.
I have the following XML( just a example but the format is right )
<SalesOrder>
- <SalesHeader>
<OrderDate>14-02-08</OrderDate>
- <BillTo>
<CustomerNo>43687129</CustomerNo>
<Name>nasser tester</Name>
<City>Bergen</City>
<PostCode>5232</PostCode>
</BillTo>
- <ShipTo>
<Name>nasser tester</Name>
<Address>Kloppedalsveien 5</Address>
<City>Bergen</City>
<PostCode>5232</PostCode>
</ShipTo>
</SalesHeader>
- <SalesLines>
- <Line>
<ItemID>1900</ItemID>
<Description>Ramme</Description>
<UnitPrice>50</UnitPrice>
<Quantity>2</Quantity>
</Line>
</SalesLines>
</SalesOrder>
I did made a XMLPORT the maches this XML-hierachy which will try to insert data into SalesHeader and SalesLine tables, I did compiled my XMLPORT, no problem.
I did create a code unit to test this XMLPORT:
iFile.OPEN('c:\XMLTest\NEttsalg\SaleOrderTest.xml');
iFile.CREATEINSTREAM(iStream);
XMLPORT.IMPORT(50002,iStream);
iFile.CLOSE;
But when I try to run this CODEUNIT so I get the following error message alert
the following C/AL functions can be used only to a limited degree during write transactions
(because one or more tables will be locked)
Form.RunModal() is not allowed in write transactions.
CodeUnit.Run() is allowed in write transactions only if the return value is not used. For example, 'OK :=CodeUnit.RUn()' is not allowed.
Report.RunModal() is allowed in write transactions only if 'RequestForm = FALSE'.
For example,'Report.RunModal(...,FALSE)' is allowed.
DataPort.RunModal() is allowed in write transactions only if 'RequestForm = FALSE'.
For example, 'DataPort.RunModal(...,FALSE)' is allowed.
Use the COMMIT function to save the changes before this call, or structure the code differently.
Any Idea about what I do wrong!?
best regards nara
0
Comments
Instead of writing your own XML port, have you considered using the standard CG Sales Header XMLPort?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I can't find the XMLPORT that you mentined!
I did turned on debugging, problem was in mismatch between postcode and City, but I do get this message( the original message is Norwegian ) but here is the translation
Standard text code 1900 dose'nt exists!
Any Idea?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Thanks again, I will try .
Now I get this error message, translated to english:
There is no Foreign exchange quotation in filter.
Filter: ExchangeCode: EUR, StartDate: "..".
Her is my XML and I am trying to add some rows to Sales Header and Sales Line Tables
- <SalesOrder>
- <SalesHeader>
<DocType>1</DocType>
<OrderDate>18-02-08</OrderDate>
<SellTo>43687129</SellTo>
- <BillTo>
<CustomerNo>43687129</CustomerNo>
<Name>Designstudio Gmunden</Name>
<City>Gmunden</City>
<PostCode>AT-4810</PostCode>
</BillTo>
- <ShipTo>
<Name>Designstudio Gmunden</Name>
<Address>Seepromenade 1b</Address>
<City>Gmunden</City>
</ShipTo>
</SalesHeader>
- <SalesLines>
- <Line>
<Type>2</Type>
<ItemID>1924-W</ItemID>
<Description>CHAMONIX basisreol</Description>
<UnitPrice>1330</UnitPrice>
<Quantity>7</Quantity>
</Line>
</SalesLines>
</SalesOrder>
Last friday I did managed to make this XML to work but I did changed some thing in my XML and now nothing work!!!! :oops: :? ](*,) #-o