cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to ensure changing the sap.app.id in manifest.json won't affect views and controllers?

alegru90
Explorer
0 Kudos
972

Hello. I have a SAP CAP Full Stack app with some custom ui5 code. There are some views and controllers created.
The app is working currently fine. But I need to deploy the same app to two different CF spaces, and because of that I need to change the sap.app.id in the manifest.json for one of the two app versions, because it is not allowing two apps to have the same sap.app.id.

When I change the id in the manifest from "m-app" to "m-app-predev", I started getting the:
ModuleError: failed to load 'm-app-predev/Component.js' from /f1d99111-9c46-43a0-80e2-20075fe117fc.mapppredev.mapppredev/~170524095809+0000~/Component.js: 404

Here is my manifest.json:

{
    "_version": "1.49.0",
    "sap.app": {
        "id": "m-app-predev",
        "type": "application",
        "i18n": "i18n/i18n.properties",
        "title": "M app PREDEV",
        "description": "M app PREDEV",
        "applicationVersion": {
            "version": "1.0.5"
        },
        "dataSources": {
            "testResultsRemote": {
                "uri": "/epm/testresults/",
                "type": "OData",
                "settings": {
                    "odataVersion": "4.0",
                    "localUri": "localService/metadata.xml"
                }
            },
            "testResultsAggRemote": {
                "uri": "/epm/resultsagg/",
                "type": "OData",
                "settings": {
                    "odataVersion": "4.0",
                    "localUri": "localService/metadata.xml"
                }
            },
            "performanceResultsAggRemote": {
                "uri": "/epm/resultsperfagg/",
                "type": "OData",
                "settings": {
                    "odataVersion": "4.0",
                    "localUri": "localService/metadata.xml"
                }
            },
            "performanceResultsRemote": {
                "uri": "/epm/testperfresults/",
                "type": "OData",
                "settings": {
                    "odataVersion": "4.0",
                    "localUri": "localService/metadata.xml"
                }
            }
        },
        "sourceTemplate": {
            "id": "@sap/ux-app-migrator:freestyle",
            "version": "1.12.5",
            "toolsId": "bb6f476c-771d-46d9-b6ac-fef2d8c7e824"
        },
        "crossNavigation": {
            "inbounds": {
                "epm-test-reporting-inbound": {
                    "signature": {
                        "parameters": {},
                        "additionalParameters": "allowed"
                    },
                    "semanticObject": "mapppredev",
                    "action": "display",
                    "title": "M App PREDEV",
                    "subTitle": "M App PREDEV",
                    "icon": "sap-icon://electrocardiogram"
                }
            }
        }
    },
    "sap.ui": {
        "technology": "UI5",
        "deviceTypes": {
            "desktop": true,
            "tablet": true,
            "phone": true
        }
    },
    "sap.ui5": {
        "rootView": {
            "viewName": "view.App",
            "type": "XML",
            "async": true,
            "id": "app"
        },
        "dependencies": {
            "minUI5Version": "1.60",
            "libs": {
                "sap.m": {}
            }
        },
        "models": {
            "i18n": {
                "type": "sap.ui.model.resource.ResourceModel",
                "settings": {
                    "bundleName": "i18n.i18n"
                }
            },
            "testResults": {
                "dataSource": "testResultsRemote",
                "settings": {
                    "operationMode": "Server"
                }
            },
            "testResultsAgg": {
                "dataSource": "testResultsAggRemote",
                "settings": {
                    "operationMode": "Server"
                }
            },
            "testResultsPerfAgg": {
                "dataSource": "performanceResultsAggRemote",
                "settings": {
                    "operationMode": "Server"
                }
            },
            "testResultsPerf": {
                "dataSource": "performanceResultsRemote",
                "settings": {
                    "operationMode": "Server"
                }
            }
        },
        "resources": {
            "css": [
                {
                    "uri": "css/style.css"
                }
            ]
        },
        "routing": {
            "config": {
                "routerClass": "sap.m.routing.Router",
                "viewType": "XML",
                "viewPath": "view",
                "controlId": "app",
                "controlAggregation": "pages",
                "async": true
            },
            "routes": [
                {
                    "pattern": "",
                    "name": "overview",
                    "target": "overview"
                },
                {
                    "pattern": "xsunit/{testcase}",
                    "name": "xsunit",
                    "target": "xsunit"
                },
                {
                    "pattern": "performance",
                    "name": "performance",
                    "target": "performance"
                }
            ],
            "targets": {
                "overview": {
                    "viewId": "overview",
                    "viewName": "Overview"
                },
                "xsunit": {
                    "viewId": "xsunit",
                    "viewName": "XsUnit"
                },
                "performance": {
                    "viewId": "performance",
                    "viewName": "Performance"
                }
            }
        }
    },
    "sap.fiori": {
        "registrationIds": [],
        "archeType": "transactional"
    },
    "sap.cloud": {
        "public": true,
        "service": "m.app.predev"
    }
}



Accepted Solutions (0)

Answers (1)

Answers (1)

Manisha_19
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi @alegru90, the error you are getting is because the namespace defined in the component.js file is not matching with the application id in manifest.json file. When you change the sap.app.id in the manifest.json, the runtime can no longer find the resources it expects at the old namespace.

As a workaround you can try following below mentioned steps - 

  1. Update the extend argument in your Component.js to the new sap.app.id.
  2. Review and update the controllerName in your views and the extend argument in your controllers if they use the old ID.
  3. Adjust routing configuration in Component.js or manifest.json if it relies on the old ID.
  4. Clean and rebuild your project before deploying.

Changing sap.app.id requires updating corresponding references in your UI5 code to avoid this error.

I hope this clarifies things for you 🙂

Regards,
Manisha Chaturvedi

Ask a Question