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)
  • 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!
  • Martin Dráb Profile Picture
    235,243 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.

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

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans