...
IF LineType = '14' THEN BEGIN
IF InvioceExists(DocumentNo) THEN BEGIN
GenJournalLine.VALIDATE("Account No.",VendorLedgerEntry."Vendor No.");
GenJournalLine.VALIDATE("Applies-to Doc. No.",VendorLedgerEntry."Document No.");
END ELSE
GenJournalLine.VALIDATE("Applies-to Doc. No.", '');
GenJournalLine.VALIDATE(Amount,Txt2Dec(TxtLine,38,12));
GenJournalLine.VALIDATE(Description,GenJournalLine."Applies-to Doc. No." + ' ' + BA002);
END ELSE BEGIN
IF CreditMemoExists(DocumentNo) THEN BEGIN
GenJournalLine.VALIDATE("Account No.",VendorLedgerEntry."Vendor No.");
GenJournalLine.VALIDATE("Applies-to Doc. No.",VendorLedgerEntry."Document No.");
END ELSE
GenJournalLine.VALIDATE("Applies-to Doc. No.", '');
GenJournalLine.VALIDATE(Amount,-Txt2Dec(TxtLine,38,12));
GenJournalLine.VALIDATE(Description,GenJournalLine."Applies-to Doc. No." + ' ' + BA003);
END;
IF GenJournalLine."Applies-to Doc. No." = '' THEN
GenJournalLine.VALIDATE(Description, BA004 + ' ' + DocumentNo);
GenJournalLine.INSERT;
...
...
IF LineType = '14' THEN BEGIN
IF InvioceExists(DocumentNo) THEN BEGIN
GenJournalLine.VALIDATE("Account No.",VendorLedgerEntry."Vendor No.");
// Add the following line.
GenJournalLine.VALIDATE("Applies-to Doc. Type",VendorLedgerEntry."Document Type");
// End of the added line.
GenJournalLine.VALIDATE("Applies-to Doc. No.",VendorLedgerEntry."Document No.");
END ELSE
GenJournalLine.VALIDATE("Applies-to Doc. No.", '');
GenJournalLine.VALIDATE(Amount,Txt2Dec(TxtLine,38,12));
GenJournalLine.VALIDATE(Description,GenJournalLine."Applies-to Doc. No." + ' ' + BA002);
END ELSE BEGIN
IF CreditMemoExists(DocumentNo) THEN BEGIN
GenJournalLine.VALIDATE("Account No.",VendorLedgerEntry."Vendor No.");
// Add the following line.
GenJournalLine.VALIDATE("Applies-to Doc. Type",VendorLedgerEntry."Document Type");
// End of the added line.
GenJournalLine.VALIDATE("Applies-to Doc. No.",VendorLedgerEntry."Document No.");
END ELSE
GenJournalLine.VALIDATE("Applies-to Doc. No.", '');
GenJournalLine.VALIDATE(Amount,-Txt2Dec(TxtLine,38,12));
GenJournalLine.VALIDATE(Description,GenJournalLine."Applies-to Doc. No." + ' ' + BA003);
END;
IF GenJournalLine."Applies-to Doc. No." = '' THEN
GenJournalLine.VALIDATE(Description, BA004 + ' ' + DocumentNo);
// Add the following line.
GenJournalLine."External Document No." := VendorLedgerEntry."External Document No.";
// End of the added line.
GenJournalLine.INSERT;
...