+ Start a Discussion
p1 force developerp1 force developer 

VF PAge for Multi-Level Bill of Material

Hi

 

I need to urgently develop a page which shows the mulit-level Bill of material.

 

This is based on 3 objects

 

Item Master

 BOMHeader

 BOM Lines

 

BOM Header is child of Item Master

BOM Lines is child of BOM Header

 

Following is a example bill of material for product A. 

 

Product A is made of assembly B, components C and D, and material E.  Assembly B is made from components F, G, and H (as well as other assemblies or products).  Note that a component can be made from another component (item D), or a component can be made from raw material (item  C and H).

 

 

 

BOM

 

 

I my case I will have Product A and There will be a BOM header which will have Bom Lines with Product B, C, D & E. Then Product B will have a BOM header records with Bom Lines with product  F, G & H and like wise there can be unlimited levels  of components. Practically there will be maximum 4-5 levels.

 

I need to be able to do a bom explosion and create a flat bom for the work order

 

Also

 

I need to be able to create a page which show the indented Multi-Level BOM for the product A

 

Please let me know, how I can do this using Apex and Visuaforce.

 

Any examples will be greately appreciated.

 

Thanks

 

 

 

 

 

 

 

p1 force developerp1 force developer

I found following SQL ways of doing it in Oracle and SQL Server.

 

How Can we use this concept using APEX & SOQL

 

 

The following example code demonstrates how to migrate a simple hierarchical query:

Oracle

SELECT "NAME", "PARENT", LEVEL

  FROM COMPANY

 START WITH ("NAME" = 'Company Ltd')

 CONNECT BY ("PARENT" = PRIOR "NAME");

 

SQL Server

WITH

   h$cte AS

   (

      SELECT COMPANY.NAME, COMPANY.PARENT, 1 AS LEVEL, CAST(row_number() OVER(

         ORDER BY @@spid) AS varchar(max)) AS path

      FROM dbo.COMPANY

      WHERE ((COMPANY.NAME = 'Company Ltd'))

       UNION ALL

      SELECT COMPANY.NAME, COMPANY.PARENT, h$cte.LEVEL + 1 AS LEVEL, path + ',' + CAST(row_number() OVER(

         ORDER BY @@spid) AS varchar(max)) AS path

      FROM dbo.COMPANY, h$cte

      WHERE ((COMPANY.PARENT = h$cte.NAME))

   )

 

   SELECT h$cte.NAME, h$cte.PARENT, h$cte.LEVEL

   FROM h$cte

   ORDER BY h$cte.path

 

Note   The ROW_NUMBER() function evaluates the path column to provide Oracle nodes ordering.

 

 

Can any one tell how we can achive this using APEX & SOQL

 

Thanks

Plural BPlural B
@p1 force developer:Please let me know if you have got solution for the same