Options

XML Import

Sankaran_BalasubramonianSankaran_Balasubramonian Member Posts: 20
Hi All,

Scenario:

I am trying to do a purchase order import using the XMLPort functionality of NAV. Everything works fine, until a point where the data, that comes in through XMLPort does not match with what exists in NAV.

For Ex : Lets say, my PO has dimension for each line item in the PO. One of the dimension or over the dimension value does not exist in NAV. In this scenario, the XMLPort fails. Pretty obvious, that is fails.
In order to overcome this situation, I have written a piece of code that would automatically insert the dimension data, if it is missing. I am still having issues with the PO getting imported.

Problem:

Is there a way we can get the error of the place where which NAV fails to import. i.e. is there a way to get to the statement / function which resulted in this error. I did search in the group and found something called GETLASTERRORTEXT. I am not sure which post it is. But when I try to use that keyword, I am getting a message saying that no such keyword exists (The message I get is "You have specified an unknown variable, which is NAV default behaviour.

Experiments:

I tried using the Debugger / Code Coverage, but I am not able to reach the place where it breaks.

Thanks in advance for all your help.

Update :

It works well. All I had to do was ignore the boolean return value when I Import. Take a look at the code, that would tell more info.

Original Code (Which was giving issue)
        IF XMLPORT.IMPORT(50005,POInStrm) = TRUE THEN
        BEGIN
          FlPrvdr.CLOSE;
          // Archive The Original Document
          NVNAVConn.ArchiveFile(sOrgFlNm,sArchPth,TRUE,'PurchaseOrderXMLImport');
        END
        ELSE
        BEGIN
          NVLogPrvdr.TraceError(STRSUBSTNO(Err0005,sFileName),TRUE,2,3);
        END;

Modified Code (Which fixed the issue)
        XMLPORT.IMPORT(50005,POInStrm);

Solution:

The modified code threw a message saying that the Dimension Code does not exists. This give more insight into the problem, where I can focus on getting the dimension inserted before it processes.

Thanks & Best Regards
Balaji
--
Thanks & Best Regards

Sankaran Balasubramonian
Sign In or Register to comment.