web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Aging to Excel Buffer, 'Excel Buffer already exist identification field =1 and value=1

(0) ShareShare
ReportReport
Posted on by

OK guys, I am using excel buffer and; excel buffer is temporary, I have done the delete all and the reset and I am still getting the error.  I have looked in the Excel buffer and deleted all the records.  Can you tell me what else to check.  Code below

PreReport()

ExcelBuf.DELETEALL;

OnPostReport()
ExcelBuf.RESET;
IF PrintToExcel THEN
CreateExcelbook;
ExcelBuf.GiveUserControl;

MakeExcelInfo()
MakeExcelDataHeader;
ExcelBuf.SetUseInfoSheet;
ExcelBuf.AddInfoColumn(FORMAT(Text103),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddInfoColumn(CompanyInformation.Name,FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text); //Company Name
ExcelBuf.NewRow;
ExcelBuf.AddInfoColumn(FORMAT(Text105),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text); //Report Name
ExcelBuf.AddInfoColumn(FORMAT(Text102),FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.NewRow;
ExcelBuf.AddInfoColumn(FORMAT(Text104),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddInfoColumn(REPORT::"Aging 360 Days test",FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Number); //Title
ExcelBuf.NewRow;
ExcelBuf.AddInfoColumn(FORMAT(Text106),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddInfoColumn(USERID,FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text); //UserID
ExcelBuf.NewRow;
ExcelBuf.AddInfoColumn(FORMAT(Text107),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddInfoColumn(TODAY,FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Date); //Date
ExcelBuf.AddInfoColumn(TIME,FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Time); //Time
ExcelBuf.NewRow;
ExcelBuf.AddInfoColumn(FORMAT(Text108),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddInfoColumn(FilterString,FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text); //Filterstring
ExcelBuf.NewRow;
ExcelBuf.AddInfoColumn(FORMAT(Text109),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text); //Text109 = 'Aged by'
ExcelBuf.AddInfoColumn(DateTitle,FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text); //Date Title
ExcelBuf.NewRow;
ExcelBuf.AddInfoColumn(FORMAT(Text113),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddInfoColumn(PeriodEndingDate[1],FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Date); //Aging as of Date
ExcelBuf.NewRow;
ExcelBuf.AddInfoColumn(FORMAT(Text110),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text); // Text110 = 'Amounts are'
IF PrintAmountsInLocal THEN
ExcelBuf.AddInfoColumn(FORMAT(Text112),FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text) //Text112 = 'As indicated in Data'
ELSE
ExcelBuf.AddInfoColumn(FORMAT(Text111),FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text); //Text111 = 'In our Functional Currency'
ExcelBuf.ClearNewRow;

MakeExcelDataHeader()
ExcelBuf.NewRow;
ExcelBuf.AddColumn('Cust No.',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn('Customer Name',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn('Job No.',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn('T',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn('Doc. No.',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn('Posting Date',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn('Balance Due',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn('Current',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn('31 - 60',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn('61 - 90',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn('91 - 120',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn('121 - 180',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn('181 - 240',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn('241 - 360',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn(' 360 +',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn('Retain.',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn('Dpt.',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn('CG',FALSE,'',TRUE,FALSE,TRUE,'',ExcelBuf."Cell Type"::Text);

MakeExcelDataBody()
ExcelBuf.NewRow;
ExcelBuf.AddColumn("Cust. Ledger Entry"."Customer No.",FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn(Customer.Name,FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn(SI."Job No.",FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn("Cust. Ledger Entry"."Document Type",FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text); //***********substring
ExcelBuf.AddColumn("Cust. Ledger Entry"."Document No.",FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);
ExcelBuf.AddColumn("Cust. Ledger Entry"."Posting Date",FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Date);
ExcelBuf.AddColumn(AmountDueToPrint,FALSE,'',FALSE,FALSE,FALSE,'#,##0.00',ExcelBuf."Cell Type"::Number); //BALANCE DUE
ExcelBuf.AddColumn(AmountDue[1],FALSE,'',FALSE,FALSE,FALSE,'#,##0.00',ExcelBuf."Cell Type"::Number); //CURRENT
ExcelBuf.AddColumn(AmountDue[2],FALSE,'',FALSE,FALSE,FALSE,'#,##0.00',ExcelBuf."Cell Type"::Number);
ExcelBuf.AddColumn(AmountDue[3],FALSE,'',FALSE,FALSE,FALSE,'#,##0.00',ExcelBuf."Cell Type"::Number);
ExcelBuf.AddColumn(AmountDue[4],FALSE,'',FALSE,FALSE,FALSE,'#,##0.00',ExcelBuf."Cell Type"::Number);
ExcelBuf.AddColumn(AmountDue[5],FALSE,'',FALSE,FALSE,FALSE,'#,##0.00',ExcelBuf."Cell Type"::Number);
ExcelBuf.AddColumn(AmountDue[6],FALSE,'',FALSE,FALSE,FALSE,'#,##0.00',ExcelBuf."Cell Type"::Number);
ExcelBuf.AddColumn(AmountDue[7],FALSE,'',FALSE,FALSE,FALSE,'#,##0.00',ExcelBuf."Cell Type"::Number);
ExcelBuf.AddColumn(AmountDue[8],FALSE,'',FALSE,FALSE,FALSE,'#,##0.00',ExcelBuf."Cell Type"::Number);
ExcelBuf.AddColumn(CustRetainage,FALSE,'',FALSE,FALSE,FALSE,'#,##0.00',ExcelBuf."Cell Type"::Number);
ExcelBuf.AddColumn("Cust. Ledger Entry"."Global Dimension 1 Code",FALSE,'',FALSE,FALSE,FALSE,'#,##0.00',ExcelBuf."Cell Type"::Number);
ExcelBuf.AddColumn("Cust. Ledger Entry"."Customer Posting Group",FALSE,'',FALSE,FALSE,FALSE,'#,##0.00',ExcelBuf."Cell Type"::Number);

CreateExcelbook()
ExcelBuf.CreateBookAndOpenExcel('Sheet 1','Aging 360',COMPANYNAME,USERID);

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Rajasekhar@MS Profile Picture
    5,569 on at

    Hi

    MakeExcelInfo Function - can you use the MakeExcelDataHeader on the last line and check

    refer the Aged Accounts Payable report

    Regards

    Rajasekhar.Y

  • mmv Profile Picture
    11,471 on at

    Hi,

    Try debugging the error, you will come to know at which point the error is triggering.

    BTW why you have called the CreateExcelbook() twice? (as seen from the above code)

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi,

    You should check the below link.

    Excel buffer already exists Error in Export to excel

    dynamicsuser.net/.../295188.aspx

    Excel buffer already exists Error in Export to excel

    www.mibuso.com/.../viewtopic.php;t=37873&start=0

  • Community Member Profile Picture
    on at

    update pls....

  • Community Member Profile Picture
    on at

    Sandeep,

    Here is where the error is happening within the debugger.

    SETRANGE("Date Filter",0D,PeriodEndingDate[1]);

    CALCFIELDS("Remaining Amount");

    IF "Remaining Amount" <> 0 THEN   //HAS REMAINING AMT INSERT TO TEMP TABLE

     InsertTemp("Cust. Ledger Entry");

    CurrReport.SKIP;    // this fools the system into thinking that no details "printed"...yet

    Cust. Ledger Entry - OnPostDataItem()

  • Rajasekhar@MS Profile Picture
    5,569 on at

    Hi

    Replace the Makeexcelinfo as below & check

    MakeExcelInfo()

    ExcelBuf.SetUseInfoSheet;

    ExcelBuf.AddInfoColumn(FORMAT(Text103),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);

    ExcelBuf.AddInfoColumn(CompanyInformation.Name,FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text); //Company Name

    ExcelBuf.NewRow;

    ExcelBuf.AddInfoColumn(FORMAT(Text105),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text); //Report Name

    ExcelBuf.AddInfoColumn(FORMAT(Text102),FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);

    ExcelBuf.NewRow;

    ExcelBuf.AddInfoColumn(FORMAT(Text104),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);

    ExcelBuf.AddInfoColumn(REPORT::"Aging 360 Days test",FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Number); //Title

    ExcelBuf.NewRow;

    ExcelBuf.AddInfoColumn(FORMAT(Text106),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);

    ExcelBuf.AddInfoColumn(USERID,FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text); //UserID

    ExcelBuf.NewRow;

    ExcelBuf.AddInfoColumn(FORMAT(Text107),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);

    ExcelBuf.AddInfoColumn(TODAY,FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Date); //Date

    ExcelBuf.AddInfoColumn(TIME,FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Time); //Time

    ExcelBuf.NewRow;

    ExcelBuf.AddInfoColumn(FORMAT(Text108),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);

    ExcelBuf.AddInfoColumn(FilterString,FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text); //Filterstring

    ExcelBuf.NewRow;

    ExcelBuf.AddInfoColumn(FORMAT(Text109),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text); //Text109 = 'Aged by'

    ExcelBuf.AddInfoColumn(DateTitle,FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text); //Date Title

    ExcelBuf.NewRow;

    ExcelBuf.AddInfoColumn(FORMAT(Text113),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);

    ExcelBuf.AddInfoColumn(PeriodEndingDate[1],FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Date); //Aging as of Date

    ExcelBuf.NewRow;

    ExcelBuf.AddInfoColumn(FORMAT(Text110),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text); // Text110 = 'Amounts are'

    IF PrintAmountsInLocal THEN

    ExcelBuf.AddInfoColumn(FORMAT(Text112),FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text) //Text112 = 'As indicated in Data'

    ELSE

    ExcelBuf.AddInfoColumn(FORMAT(Text111),FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text); //Text111 = 'In our Functional Currency'

    ExcelBuf.ClearNewRow;

    MakeExcelDataHeader;

    Regards

    Rajasekhar.Y

  • Community Member Profile Picture
    on at

    now it is row 2 column 1

  • Rajasekhar@MS Profile Picture
    5,569 on at

    Can you check the Aged Accounts Payable Report, it is similar to yours

  • Community Member Profile Picture
    on at

    No it is not like that this is just a line by line aged listing no percents or grouping by customers

  • Rajasekhar@MS Profile Picture
    5,569 on at

    Hi Kim

    The Aged Account Payables for reference how excel has done in NAV, in your case activate the debugger and find why the Row / Column no are not increasing, then increment the Row / Column no by 1 which will solve the problem

    Regards

    Rajasekhar.Y

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans