Calculate the Amount Vendor Ledger Entry And Insert Table

Hi Everybody,

I create a table with the following fields: Table Name: Cal Balance Vendor

Vendor Code Ending Date Currency Code Total Amount Line No

I use this table to save the results of the calculations at the end month. The purpose of reporting liabilities of Vendor.

  • I’m new 1 report on the data source Cal Balance Vendor use calculation by Ending Date
VendLedEntries.SETCURRENTKEY("Vendor No.","Posting Date","Currency Code");
VendLedEntries.SETRANGE("Vendor No.","Vendor Code");
VendLedEntries.SETRANGE("Posting Date",0D, EndingDate);
VendLedEntries.SETRANGE("Currency Code","Currency Code");

IF  VendLedEntries.FINDSET THEN BEGIN
  REPEAT
    VendLedEntries.CALCSUMS(Amount);
    TotalBalAmount:=VendLedEntries.Amount;
    
  UNTIL VendLedEntries.NEXT =0 ;
  LineNo+=1000
    "Cal Balance Vendor".INIT
    "Cal Balance Vendor"."Amount":=TotalBalAmount;
    "Cal Balance Vendor"."Ending Date":=EndingDate;
    "Cal Balance Vendor"."Currency Code":=VendLedEntries."Currency Code";
    "Cal Balance Vendor"."Line No":= LineNo;
    "Cal Balance Vendor".INSERT
END;

I cannot insert data into the table. Please help me with 1 solution.
Thanks very much