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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Can't delete data from SalesInvoiceHeaderFooterTmp table

(0) ShareShare
ReportReport
Posted on by 44
Hi Experts,
 
I am trying to create a batch job to clean temp data in sales invoice header footer temp and sales invoice tmp tables. The data is deleting from sales invoice tmp successfully but data still resides when deleting data from sales invoice header footer temp. I don't know what is wrong I am doing. Also I see there is created transaction ID property enable in sales invoice header footer temp table. Please guide me.
 
SalesInvoiceHeaderFooterTmp headerTemp;
SalesInvoiceTmp             lineTemp;
DataArea                    company;
while select id from company
where company.id != /DAT/
 {
   changecompany(company.id)
     {
        ttsbegin;
        delete_from headerTemp;
        ttscommit;
        ttsbegin;
        delete_from lineTemp;
        ttscommit;
      }
 } 
I have the same question (0)
  • Martin Dráb Profile Picture
    237,681 Most Valuable Professional on at
    Can't delete data from SalesInvoiceHeaderFooterTmp table
    What did you find when you investigated the data? Are the records for the partition where you ran your code and aren't there in DAT company? Weren't they created after the deletion?
     
    By the way, you code is dangerous because it can delete data of currently running reports. Be careful where and when you use it.
     
    The fact that Created Transaction Id property is enabled is correct. It's needed when pre-processing is used with regular (persistent) tables.
  • Community member Profile Picture
    2 on at
    Can't delete data from SalesInvoiceHeaderFooterTmp table
    Hi,
     
    search AOT to find SalesInvoiceTempDataCleanup classes and MI.
     
    /// <summary>
    /// The <c>SalesInvoiceTempDataCleanup</c> class evaluates and deletes
    /// temporary records in <c>SalesInvoiceTmp</c> and other associated tables.
    /// </summary>
    internal final class SalesInvoiceTempDataCleanup
    {
        /// <summary>
        /// Removes records.
        /// </summary>
        internal void deleteRecords()
        {
            ttsbegin;
            SalesInvoiceTmp salesInvoiceTmp;
            delete_from salesInvoiceTmp; // Not a per-company table; crosscompany is not needed here
     
            SalesInvoiceTmp_IN salesInvoiceTmp_IN;
            salesInvoiceTmp_IN.skipDatabaseLog(true);
            salesInvoiceTmp_IN.skipEvents(true);
            delete_from crosscompany salesInvoiceTmp_IN;
     
            SalesInvoiceHeaderFooterTmp headerFooterTmp;
            headerFooterTmp.skipDatabaseLog(true);
            headerFooterTmp.skipEvents(true);
            delete_from crosscompany headerFooterTmp;
     
            SalesInvoiceLocalizationTmp localizationTmp;
            localizationTmp.skipDatabaseLog(true);
            localizationTmp.skipEvents(true);
            delete_from crosscompany localizationTmp;
     
            SalesInvoicePaymentStubTmp paymentStubTmp;
            paymentStubTmp.skipDatabaseLog(true);
            paymentStubTmp.skipEvents(true);
            delete_from crosscompany paymentStubTmp;
            ttscommit;
        }
     
     
    BR!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 683 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 563 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans