Wednesday, August 10, 2016

Empty BOM lines

We faced with a problem of empty BOMs. Users created BOM versions and approved them, but they forgot to fill BOM lines table. In order to solve this problem, I wrote a really simple X++ job to collect information about exists BOM versions with empty BOM lines.

PS: ItemId has a special code format in a project, so I used itemId mask in "like" statement.


 static void NBA_GetEmptyBOM(Args _args)  
 {  
   BOM tBOM;  
   BOMVersion tBomVersion;  
   info("Run");  
   while select tBOMVersion  
   where tBomVersion.ItemId like '?-?????-??????'  
   notexists join tBOM  
   where tBOM.BOMId == tBomVersion.BOMId  
   {  
     info(tBomVersion.BOMId + " with itemId: " + tBomVersion.ItemId);  
   }  
   info("Done");  
 }  

PPS: A report about BOM statement could be a better solution, but I in a current stage we decided not to spend developer time on developing the report.