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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to create purchase agreement throught x++

(0) ShareShare
ReportReport
Posted on by

Hi,

I want to copy a purchase agreement lines to another purchase agreement lines, but when I tried to insert data to AgreementLine table, it throws me "Database insert operation is not allowed on an abstract table" error. So how can I insert data to agreement line programmatically?

*This post is locked for comments

I have the same question (0)
  • Mykhailo Stakhniv Profile Picture
    180 on at

    Hi,

    Try to use AgreementLineQuantityCommitment or AgreementLineVolumeCommitment tables

  • Community Member Profile Picture
    on at

    I tried to insert these tables, no errors. But no record in agreement line table and I can not see it in the user interface.

  • Verified answer
    Mykhailo Stakhniv Profile Picture
    180 on at

    this code works fine for me - new line is created and visible in UI:

    AgreementLineQuantityCommitment agreementLineQuantity;
    PurchAgreementHeader            purchAgreementHeader = PurchAgreementHeader::findAgreementId('XXXX');
    
    select firstOnly agreementLineQuantity where agreementLineQuantity.Agreement == purchAgreementHeader.RecId; agreementLineQuantity.LineNumber = 0; agreementLineQuantity.insert();
  • Community Member Profile Picture
    on at

    Can you share your code with me? I can see where I'm wrong

  • Verified answer
    Mykhailo Stakhniv Profile Picture
    180 on at
    AgreementLineQuantityCommitment agreementLineQuantity;
    PurchAgreementHeader            purchAgreementHeader = PurchAgreementHeader::findAgreementId('XXXX');
    
    select firstOnly agreementLineQuantity where agreementLineQuantity.Agreement == purchAgreementHeader.RecId; agreementLineQuantity.LineNumber = 0; agreementLineQuantity.insert();
  • Community Member Profile Picture
    on at

    Thanks Mykhailo.

  • Community Member Profile Picture
    on at

    Hi Mykhailo,

    I have the samme issue, the code works fine except when the agreement header don't contains any line, in this case it creates a record in AgreementQtyAgreementLine table but not in Agreement line, i think there is a missed field that must be filled but can't find wich one.

    Can you help please?

    Thanks in advance.

    Best Regards

  • Abdul Manan Profile Picture
    120 on at

    Hi Mehdi ,

    I am also facing same issue I am trying to create purchase agreement line with code it is creating record in AgreementQtyAgreementLine and Agreement line as well but I am unable to see it in UI (in purchase agreement line).Did you find any solution ?

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 21

#2
dekion Profile Picture

dekion 4

#2
Virginia99 Profile Picture

Virginia99 4

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans