
I Have a report which when printed should show the"Active version" of a BOM. However it is instead showing the latest version which is still under development.
Here is the code on the report which should get the BOM Version for the Label.
grecProductionBOMHeader.GET(Item."Production BOM No.");
IF gstrVersionCode = '' THEN // TIO000002
strVersionCode :=
cuVersionManagement.GetBOMVersion(
grecProductionBOMHeader."No.",
WORKDATE,
TRUE)
ELSE // TIO000002
strVersionCode := gstrVersionCode; // TIO000002
ERROR('ll');
IF NOT grecProductionBOMVersion.GET(
grecProductionBOMHeader."No.",
strVersionCode
) THEN
ERROR(Text002,
Item."Production BOM No.",
strVersionCode);
This is the "GetBOMVersion" Function in the codeunit called..
ProdBOMVersion.SETCURRENTKEY("Production BOM No.","Starting Date");
ProdBOMVersion.SETRANGE("Production BOM No.",BOMHeaderNo);
ProdBOMVersion.SETFILTER("Starting Date",'%1|..%2',0D,Date);
IF OnlyCertified THEN
ProdBOMVersion.SETRANGE(Status,ProdBOMVersion.Status::Certified);
IF NOT ProdBOMVersion.FINDLAST THEN
CLEAR(ProdBOMVersion);
EXIT(ProdBOMVersion."Version Code");
Any feedback would be appreciated
*This post is locked for comments
I have the same question (0)Hi
Can you check the dataset and how you are using the strversion in the report.(you can check by message in the code).