I’ve resolved this exact issue multiple times during SAP PLM 2022 upgrades. Let me address all three focus areas systematically:
SAPUI5 Upgrade Compatibility:
SAP PLM 2022 ships with SAPUI5 1.96, which introduced breaking changes in the component extension framework. The key issue is that the controller extension mechanism was refactored to support better async module loading and stricter lifecycle management. Your manifest.json needs updates to declare compatibility:
"sap.ui5": {
"dependencies": {
"minUI5Version": "1.96.0",
"libs": {
"sap.plm.cadviewer": {"minVersion": "2022.1"}
}
},
"extends": {
"component": "sap.plm.cadviewer",
"minVersion": "2022.1",
"extensions": {
"sap.ui.controllerExtensions": {
"sap.plm.cadviewer.viewer.Main": {
"controllerName": "custom.annotations.MainExt",
"lifecycle": "async"
}
}
}
}
}
The critical addition is the “lifecycle”: “async” property. Without this, the extension controller loads in the old synchronous mode, which is no longer supported by the CAD viewer component in PLM 2022.
Manifest Module References:
The module reference structure changed significantly. In SAPUI5 1.96+, controller extensions must be defined as proper modules with explicit dependencies. Your MainExt.controller.js needs to declare its dependencies on the CAD viewer APIs:
sap.ui.define([
"sap/ui/core/mvc/ControllerExtension",
"sap/plm/cadviewer/api/AnnotationLayer",
"sap/plm/cadviewer/api/ViewerState"
], function(ControllerExtension, AnnotationLayer, ViewerState) {
"use strict";
return ControllerExtension.extend("custom.annotations.MainExt", {
override: {
onAfterRendering: function() {
// Annotation logic here
}
}
});
});
Note the use of ControllerExtension.extend() instead of the old Controller.extend() pattern. This is mandatory in the new framework. Also, the override block is now required to explicitly declare which lifecycle methods you’re extending.
Custom Annotation Logic:
The CAD viewer’s annotation API changed in PLM 2022. The old approach of directly manipulating the viewer’s scene graph is deprecated. You must now use the AnnotationLayer API:
onAfterRendering: function() {
var oViewer = this.base.getView().byId("cadViewer");
var oLayer = new AnnotationLayer({
id: "manufacturing_notes",
type: "overlay"
});
oViewer.addAnnotationLayer(oLayer);
this._loadAnnotations(oLayer);
}
The viewer component no longer exposes direct scene access. Instead, you create AnnotationLayer instances and register them with the viewer. The layer handles rendering and lifecycle management automatically.
One more critical point: the annotation data loading must be async. If your _loadAnnotations method was synchronous, it will fail silently in the new version. Refactor it to return a Promise:
_loadAnnotations: function(oLayer) {
return this.getOwnerComponent().getModel("annotations")
.read("/AnnotationSet")
.then(function(aData) {
aData.forEach(function(oAnnotation) {
oLayer.addAnnotation(oAnnotation);
});
});
}
Finally, clear your browser cache and the UI5 component cache. SAP PLM 2022 uses a new cache key structure, and old cached versions of the base CAD viewer component can cause extension loading failures. In the Fiori launchpad configuration, set the cachebuster parameter to force fresh component loads during your testing phase.
Implementing these three changes - async lifecycle declaration, proper module dependencies, and the new AnnotationLayer API - will restore your custom annotation functionality. The new architecture is actually more robust and provides better error handling for annotation rendering failures.
This draft is based on general SAP PLM knowledge. It has not been verified against your specific version and environment. Practitioners: verify the steps and share your experience below.