Skip to main content
4-Participant
September 22, 2022
Solved

API to download Multi Level BOM report as XML?

  • September 22, 2022
  • 3 replies
  • 1591 views

I am using Windchill PDMLink Release 11.2 and Datecode with CPS 11.2.0.2

Is it possible to generate Multi level BOM report through API in XML format? We tried using BOMHelper.produceBOMReport(), but its downloading as HTML. We need some help to understand if there is a way to download the report as XML?

Best answer by HelesicPetr

Hello @RK_10318816 

I don't think there is a general API to create BOM report as you need.

 

All exports of MultilevelBOM is done by JSP page from a table menu.

HelesicPetr_0-1663850812105.png

 

I always write own function to create the BOM output in any format I need it.. (xml, csv, html, txt)

 

It is not so complicated to collect all levels of BOM.

 

You can also build your xml format as you need. 

 

I know it doesn't help too much. May be somebody else knows the API which could help.

 

PS> useful api method is 

//primWtp is WTPart object
QueryResult qResult = WTPartHelper.service.getUsesWTParts(primWtp, new LatestConfigSpec());

PetrH

 

 

3 replies

HelesicPetr
22-Sapphire II
September 22, 2022

Hello @RK_10318816 

I don't think there is a general API to create BOM report as you need.

 

All exports of MultilevelBOM is done by JSP page from a table menu.

HelesicPetr_0-1663850812105.png

 

I always write own function to create the BOM output in any format I need it.. (xml, csv, html, txt)

 

It is not so complicated to collect all levels of BOM.

 

You can also build your xml format as you need. 

 

I know it doesn't help too much. May be somebody else knows the API which could help.

 

PS> useful api method is 

//primWtp is WTPart object
QueryResult qResult = WTPartHelper.service.getUsesWTParts(primWtp, new LatestConfigSpec());

PetrH

 

 

4-Participant
October 11, 2022

Hi PetrH,

 

This approach worked out. I have used a recursive loop to get all levels of BOM.

Thank you very much!

 

 

16-Pearl
September 22, 2022

You could get the multi-level BoM using an infoEngine webject like Query-Tree, then once you have the BoM as i.e convert to xml

 

//String oid = "VR:wt.part.WTPart:651623469";

 

<ie:getService varName="vdb" />

 

<ie:webject name="Query-Tree" type="OBJ">
<ie:param name="instance" data="<%= wtadapterVMName %>" valueSeparator=";" delim=";" default="Windchill" />
<ie:param name="type" data="wt.part.WTPartUsageLink" />
<ie:param name="DIRECTION" data="uses"/>
<ie:param name="ATTRIBUTE" data="number,name,*" delim=","/>
<ie:param name="OUTPUT_TYPE" data="FULL"/>
<ie:param name="MODE" data="NESTED"/>
<ie:param name="GROUP_OUT" data="tree_out"/>
<ie:param name="object_ref" data="<%= oid %>" />
<ie:param name="DEPTH" data="99"/>
</ie:webject>

 

String xmlBOM = vdb.getCollection().toXML();