I would like to copy some records form one table to another table.
I have this code:
VendorLedgerEntry.SETFILTER(“Amount to Transfer”, ‘>0’);
IF VendorLedgerEntry.FIND(’-’) THEN
WITH BankTransferLine DO
“Vendor No.” := VendorLedgerEntry.“Vendor No.”;
“Document No.” := VendorLedgerEntry.“Document No.”;
“Currency Code” := VendorLedgerEntry.“Currency Code”;
“Amount to Transfer” := VendorLedgerEntry.“Amount to Transfer”;
“Vendor Account No.” := VendorLedgerEntry.“Vendor Account No.”;
UNTIL VendorLedgerEntry.NEXT = 0;
It works well, when I have only one record. The record is inserted in the target table.
But when I want to copy more than one record at the same time, I get the error message:
The Bank Transfer Line already exists. Identification fields and values: Line No.=‘12’
It seems that the program always wants to insert the record in the same line.
What is missing from my code? How to code that every record is inserted in a new line?
Thanks a lot, Frida