Im trying to import invoices to salesheader table. If i import one invoice it works fine, but if i import multiple invoices then i get this error: "The Sales Header already exists. Identification fields and values: Document type='Invoice,No=''
Here is the code
IF fl.FINDFIRST THEN
REPEAT
MySalesHeader.INIT;
MySalesHeader."Posting Date" := TODAY;
MySalesHeader."Document Date" := TODAY;
MySalesHeader."Document Type" := MySalesHeader."Document Type"::Invoice;
MySalesHeader.VALIDATE("Sell-to Customer No.", fl.debet);
MySalesHeader.INSERT;
UNTIL fl.NEXT = 0;
fl is the table with the imported invoices
Any idea what is wrong here?
Thank you in advance
Answers
You are not assigning any value to "No."
before the INIT statement or MySalesHeader."No." := '';
Hope this helps
But I keep getting the same error.. Sales Header already exists.
Instead of typing insert I typed insert(true)
Thank for your help