Xmlport Commit even if there is an Error

varankamvarankam Member Posts: 8
edited 2015-01-21 in NAV Three Tier
I fall to trouble. I have function published as Webservice and takes xmlport as argument.
If function does not throw an Error than everything in the xmlport was commited even there was an error during import.

published function
PostPurchOrder(SourceApp : Text[100];PurchOrderInfo : XMLport "Purch. Order";VAR Response : XMLport Response)
IF NOT PurchOrderInfo.IMPORT THEN BEGIN
AlertMgt.AddAlert(LogEntryNo,0,GETLASTERRORTEXT);
END;


inside xmlport:
OnPostXMLport()
PurchHeader2.INIT;
PurchHeader2.VALIDATE("Document Type", PurchHeader2."Document Type"::Order);
PurchHeader2.INSERT(TRUE);
ERROR(PurchHeader2."No.");


This function creates new Purch Order each time I call it from VS.

I have no idea how to fix it.
Sign In or Register to comment.