In 2024 we shipped the end user file upload in SAP Analytics Cloud planning (see New End User File Upload in SAP Analytics Cloud QRC3 2024). The feature has been well received by our customers and in widely adopted now. Since then we have been working on enhancing the feature (see New Clean and Replace Feature for SAC End User File Upload ) but also still see areas where we can improve, like the necessity to provide a more flexible un-pivoting (see also How to configure a dynamic file upload in SAP Analytics Cloud).
With version SAC QRC1 2026 we provide a new script event, that allows customers to check and massage the uploaded data before it is written into the system and to control error situations flexibly.
So far we had two JavaScript events in the file upload: onBeforeExecute and onAfterExecute. The event onBeforeExecute is executed before any of the upload functions is performed whereas onAfterExecute is triggered when everything has finished already. Customer have been asking for an additional event that is triggered during the upload. This event is now delivered with SAC QRC1 2026 and is called onBeforeImport.
When running a file upload from the file upload starter the user is asked to select the file in a file selector. Once a file has been chosen the content of the file is uploaded to the browser.
This is the moment the new event is triggered. In your script you have access to the following information:
The JavaScript can return the object DataUploadFileHandler. In this object you can set two parameters:
The first parameter enables you to abort the file upload. By default the value is set to 'true'. If you set the parameter continue to 'false', then the file upload will be stopped.
The second parameter can contain the modified file content. If you leave this parameter blank, then the system will use the originally uploaded data for further processing. In case the parameter is filled, the system will continue with the new content. That means that in your JavaScript you have the option to not only check the uploaded data but even massage the data before further processing. For example, you could:
Please note that you will receive the data as uploaded with no mappings defined in data wrangling applied yet.
Provided that you do not abort the execution by setting the parameter continue to 'false' the system now proceeds with processing the data. The system will check whether a new file content has been provided - in this case it will proceed with the new content. If no new content has been provided, then the system proceeds with the unaltered initially uploaded content.
The data records are then sent to the data wrangling where all the mappings defined in the definition of the job are applied. Finally the data is checked and the correct data is written to the model.
We want to give a simple example here. Let us assume we are uploading a file with header line (first row of the file consists of the column headers).
This is our sample coding in our script:
In the first block we show an example, how to use the file name of the uploaded file and to display it to the end user (as a warning).
In the second block we show how to access the content of the uploaded file. We loop over the rows and display each row in the console.
In the last block we show how the uploaded data can be modified. We use a modified file content containing only the first 7 rows of the originally uploaded data. As the first row contains the header line we thus only us the first 6 data records from the original file.
Let us run the sample upload with the above script. We trigger the upload starter that is using our script. After our selected file is uploaded to the browser, we get the information which file has been selected.
Next, we have a look at the console and can view the content of the uploaded data. Our uploaded file contains 10 data records.
And finally, once the upload has finished, we get the information that 6 new records have been written into the selected version.
Thus we can see that indeed the modified data was used that we have stripped down to 6 records (plus the header line).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 52 | |
| 49 | |
| 37 | |
| 36 | |
| 30 | |
| 25 | |
| 23 | |
| 23 | |
| 22 | |
| 22 |