Hi Everyone
Hope all are fine..!
I just want to use xml port to create a new purchase order and in that the header table is working fine but there line table is not getting updated.
I here by write the following code , can anyone please let me know if there is any changes to be followed.
xmlport 50120 importpo
{
Caption = 'importpo';
Direction = Import;
Format = VariableText;
Permissions = TableData "Purchase Header" = rimd;
TextEncoding = UTF8;
UseRequestPage = false;
TransactionType = UpdateNoLocks;
FileName = 'doc.csv';
schema
{
textelement(Root)
{
tableelement(PurchaseHeader; "Purchase Header")
{
SourceTableView = where("Document Type" = const(Order));
// MinOccurs = Zero;
// MaxOccurs = Once;
fieldelement(DocumentType; PurchaseHeader."Document Type")
{
}
fieldelement(No; PurchaseHeader."No.")
{
}
fieldelement(BuyfromVendorNo; PurchaseHeader."Buy-from Vendor No.")
{
}
tableelement(PurchaseLine; "Purchase Line")
{
AutoSave = true;
LinkTable = "PurchaseHeader";
LinkFields = "Document Type" = field("Document Type"), "Buy-from Vendor No." = field("Buy-from Vendor No."), "Document No." = field("No.");
SourceTableView = where("Document Type" = const(Order), Type = const(item));
LinkTableForceInsert = true;
MinOccurs = Zero;
MaxOccurs = Once;
fieldelement(No; PurchaseLine."No.")
{
trigger OnAfterAssignField()
var
myInt: Integer;
begin
lineNo += 10000;
PurchaseLine.Validate("Line No.", lineno);
end;
}
fieldelement(quantity; PurchaseLine.Quantity)
{
}
trigger OnPreXmlItem()
var
myInt: Integer;
begin
PurchaseLine.SetRange("Document Type", PurchaseHeader."Document Type");
PurchaseLine.SetRange("Document No.", PurchaseHeader."No.");
end;
}
}
}
}
requestpage
{
layout
{
area(content)
{
group(GroupName)
{
}
}
}
actions
{
area(processing)
{
}
}
}
var
LineNo: Integer;
}
Thanks & Regards ,
Karthikeyani C