How to show related Bom Item & Qty on Line level

Hi Everyone,

I have developed sales invoice report using Docentric which is using our custom template. We are showing lines in the middle of the page. What we want to do is we want to show Bom items just underneath a sales line if the main line contains an Item made of BoM. We would like to show all the related BoM Items along with their Qty.

For Example: Suppose we have an Item Item-001 which was made of 4 other Bom items. What we want to do it when the main line is inserted on the report, we want to create 4 line just underneath this main line showing those related Items along with their quantities.

What the issue is I need to write while loop for looping through all the possible related BoM items. I am creating two new fields within the parentheses and assigning them the value.

When the first loop is run and picks a bom item, it creates the fields BomItem and BomQty and assigns the values. For the second loop the DSP class cannot assign the value to the field because there are already values in those two fields. The debugger shows that it throws an exception.
Please help me.

Hi @waqas_ahmed ,

If I understand you correctly, it seems that you are trying to add multiple BOM lines to each Sales line. You need to create a separate record for each BOM line you are adding to the Sales line record, this way the Sales line will be a parent record with one or multiple children BOM line records. With this structure you will be able to list BOM items under each relevant Sales line.

Hi Semir, my report throws error when I build. Here is the error:

The question is how do I create a separate record for each BoM line ? Please explain.

Is there anyone who can help me technically as to how to make a line level record as parent record to its related child records. I have written while loop and in the parenthesis I have created fields (BomItem, BomQty). Only one value can be stored in the field obviously?

Hi @waqas_ahmed ,

Perhaps this forum post can help you with it: Adding custom XML nodes and attributes to the DDSP of a report - Docentric Forum

Thanks Semir, It helped me resolve the issue.