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 AX (Archived)

At least one BOM line must be attached to this line

(0) ShareShare
ReportReport
Posted on by 180

Hi Guys,

I´m tyring to post & register a BOM journal in AX 2012 R3, but when I run my code I get this error:

At least one BOM line must be attached to this line.

I think that I missing a link field or somethng like that,

Anyone can help me with this. 

This is the code that I'm using:

journalTable.clear();
journalTable.initValue();
journalTable.initFromInventJournalName(InventJournalName::find(InventParameters::find().BomJournalNameId));
journalTable.JournalId = journalTableData.nextJournalId();
journalTable.insert();

 

journalTrans.clear();
journalTrans.initFromInventJournalTable(journalTable);
journalTrans.initFromInventTable(InventTable::find("22-590-125"));
journalTrans.InventDimId = "NDIM0000007";
journalTrans.Qty = 1;
journalTrans.PriceUnit = InventTableModule::find(journalTrans.ItemId, ModuleInventPurchSales::Invent).pcsPrice();
journalTrans.CostAmount = journalTrans.Qty * journalTrans.PriceUnit;
journalTrans.InventTransId = "LOTE002951085"; 
journalTrans.BOMLine = NoYes::No;
journalTrans.insert();


inventTransId = journalTrans.InventTransId;

journalTrans.clear();
journalTrans.initFromInventJournalTable(journalTable);
journalTrans.initFromInventTable(InventTable::find("22-590-126"));
journalTrans.InventDimId = "NDIM0000007";
journalTrans.Qty = -1*1;
journalTrans.PriceUnit = InventTableModule::find(journalTrans.ItemId, ModuleInventPurchSales::Invent).pcsPrice();
journalTrans.CostAmount = journalTrans.Qty * journalTrans.PriceUnit;
journalTrans.InventTransId = NumberSeq::newGetNum(InventParameters::numRefInventTransId()).num();
journalTrans.TransDate = today();
journalTrans.BOMLine = NoYes::Yes;
journalTrans.InventTransIdFather = inventTransId;
journalTrans.insert();

if(InventJournalCheckPost::newPostJournal(journalTable).validate())

InventJournalCheckPost::newPostJournal(journalTable).run();

Thank you in Advance

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Faisal Fareed Profile Picture
    10,796 User Group Leader on at

    Have a look on this example; it is working fine www.andesoft.net/creating-bom-journal-using-x-code-ax-2009-ax-2012

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 AX (Archived)

#1
Basit Profile Picture

Basit 1

#1
GL-01081504-0 Profile Picture

GL-01081504-0 1

#1
Roya Profile Picture

Roya 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans