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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Calling Action MenuItem: PurchCancel from X++

(0) ShareShare
ReportReport
Posted on by 678

Hi All,

I am calling an action menu item, PurchCancel from my own RunBaseBatch class as follows. 

Args args = new Args();
args.record(purchLine.purchTable());
args.parmEnum(NoYes::Yes);
args.caller(this);
new MenuFunction(menuitemActionStr(PurchCancel), MenuItemType::Action).run(args);

Then I get the following prompt because of the purchCancel.prompt() code in PurchCancel.mainOnServer method.

protected static void mainOnServer(PurchTable _purchTable)
{
    PurchCancel purchCancel = PurchCancel::construct();
    purchCancel.parmPurchTable(_purchTable);

    if (purchCancel.prompt())
    {
        purchCancel.runOperation();
    }
}

pastedimage1618856271336v1.png

Then if I click OK, I get an error saying that An unbalanced X TTSBEGIN/TTSCOMMIT pair has been detected... 

pastedimage1618856395616v2.png

1)how can I avoid this prompt() and 2) also solve this unbalanced X TTSBEGIN/TTSCOMMIT Pair issue?

Thank you. 

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,874 Most Valuable Professional on at

    I guess that you're trying to open the form from inside the database transaction. This is wrong and the system prevents serious consequences by aborting the transaction.

    I remember a company whose Axapta 3.0 was completely blocked from time to time. The cause was a dialog opened from a transaction (which wasn't rolled back in this version), which somebody sometimes left open and went for lunch or so. The transaction held a lock on InventSum table, preventing other users to do anything involving inventory...

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 659 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 289 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans