spreadsheetimporter / ui5-cc-spreadsheetimporter

A UI5 Component to integrate a Spreadsheet Upload for UI5 Apps.
https://spreadsheet-importer.com/
Apache License 2.0
84 stars 16 forks source link

[Bug]: Excel Upload does not work at BAS using 'Application Preview' #265

Closed Neil057 closed 1 year ago

Neil057 commented 1 year ago

OData Version

OData V4

Draft

Yes

Scenario

Fiori Elements, Object Page

UI5 Excel Component

v0_19_0

What happened?

The app is an OData V4 app with draft and a RAP backend. I follow below url and use yo generate to create Excel Upload button and code https://marianfoo.github.io/ui5-cc-excelUpload/pages/GettingStarted/

also make sure the UI5 Excel Component is v019 0 version but the Error pop up when i click Excel Upload button

How can i do to solve this issue

attach file is my console fail log Excel Upload Error.zip

Relevant log output

Log-dbg.js:452 2023-06-16 10:21:40.533000 Error setting 'setContext' - TypeError: Cannot read properties of undefined (reading 'getId') ExcelUpload: ExcelUpload 
 TypeError: Cannot read properties of undefined (reading 'getId')
    at D.setContext (ExcelUpload-dbg.js:99:56)
    at D.initialSetup (ExcelUpload-dbg.js:80:32)
    at async D.openExcelUploadDialog (ExcelUpload-dbg.js:129:9)

Log-dbg.js:452 2023-06-16 10:21:40.534100 Error setting 'setContext' - TypeError: Cannot read properties of undefined (reading 'getId') ExcelUpload: ExcelUpload 
 TypeError: Cannot read properties of undefined (reading 'getId')
    at D.setContext (ExcelUpload-dbg.js:99:56)
    at D.initialSetup (ExcelUpload-dbg.js:80:32)
    at D.openExcelUploadDialog (ExcelUpload-dbg.js:132:28)

Log-dbg.js:452 2023-06-16 10:21:40.534399 Cannot read properties of undefined (reading 'getId') - TypeError: Cannot read properties of undefined (reading 'getId') ExcelUpload.ts.initialSetup 
 TypeError: Cannot read properties of undefined (reading 'getId')
    at D.setContext (ExcelUpload-dbg.js:99:56)
    at D.initialSetup (ExcelUpload-dbg.js:80:32)
    at D.openExcelUploadDialog (ExcelUpload-dbg.js:132:28)

Log-dbg.js:452 2023-06-16 10:21:40.553199 Error opening the dialog -  ExcelUpload: ExcelUpload

Excel Component Init

"Extension in manifest.json
"TravelObjectPage": {
                    "type": "Component",
                    "id": "TravelObjectPage",
                    "name": "sap.fe.templates.ObjectPage",
                    "options": {
                        "settings": {
                            "editableHeaderContent": false,
                            "entitySet": "Travel",
                            "content": {
                                "header": {
                                    "actions": {
                                        "excelUpload": {
                                            "id": "excelUploadButton",
                                            "text": "Excel Upload",
                                            "enabled": "{ui>/isEditable}",
                                            "press": "sznetrex02.znetrex02.ext.ObjectPageExtController.openExcelUploadDialog",
                                            "requiresSelection": false
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },

"Custom Code
sap.ui.define([], function () {
    "use strict";
    return {
        /**
         * Create Dialog to Upload Excel and open it
         * @param {*} oEvent
         */
        openExcelUploadDialog: async function (oEvent) {
            this._view.setBusyIndicatorDelay(0);
            this._view.setBusy(true);
            if (!this.excelUpload) {
                this.excelUpload = await this._controller.getAppComponent().createComponent({
                    usage: "excelUpload",
                    async: true,
                    componentData: {
                        context: this
                    }
                });
            }
            this.excelUpload.openExcelUploadDialog();
            this._view.setBusy(false);
        }
    };
});

Manifest

"resourceRoots": {
            "cc.excelUpload.v0_19_0": "./thirdparty/customControl/excelUpload/v0_19_0"
        },
        "componentUsages": {
            "excelUpload": {
                "name": "cc.excelUpload.v0_19_0"
            }
        },
Neil057 commented 1 year ago
image
marianfoo commented 1 year ago

Hi @Neil057 thank you for opening the issue. Can you please make sure to activate the debug mode as described here https://marianfoo.github.io/ui5-cc-excelUpload/pages/Troubleshooting/#activate-debug-mode-and-copy-error-messages Otherwise some important info is missing. You can see a example when you open this: https://excelupload.marianzeis.de/?sap-ui-debug=true It takes a while to load.

If possible, can you please send me the metadata.xml and some screenshots of the object page at marian@marianzeis.de

Thanks!

Neil057 commented 1 year ago

Dear @marianfoo I revise my Excel Upload button from Object Page to List Report

image

but it keep spinning when I click Excel Upload button this time

image

The file and some screenshot will Sent to you through the email.

Neil057 commented 1 year ago

I success to Upload Excel this time, many thx~

image
marianfoo commented 1 year ago

Happy that it works now 🙂