on 2024 Nov 05 11:15 AM
Hello, I am developing a CAP application with Java/Spring Boot and I ran into a problem I have been stuck on.
I have a defined an action within my entity that should fetch details from S4HC, assemble a CSV file from it and then return the CSV to the user. I implemented the action handler that fetches the data and assembles the csv file into byte[] but now I have no idea how to actually make it so that the file is downloaded by the user to their machine.
My action returns a LargeBinary
but at the end of the handler, when i set the context (that expects byte[]) as that file, nothing happens.
I couldnt find anywhere online a solution for this. Can anyone assist please in how the implementation should look like ?
Request clarification before answering.
Hi @dvalasek ,
I haven't tried, but I would give it a shot in the following way if you already have your method implemented:
In the documentation the custom streaming topic is only for Node and it is in beta currently. I tested the Node.js version with a basic scenario and it worked for me with @sap/cds: 8.4.0
Regards,
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @dvalasek ,
Could you try to add the property to your entity - just for testing purposes -, and serve the byte[] in the On READ handler of the entity in question if the media property is requested? (e.g.: /Entity(ID)/mediaProperty)
Just to check if the method is working.
If it works, it means that you can serve media at least.
I think you can mark the property as virtual in your model if you want to tell that you don't want to persist it.
Regards,
Peter
User | Count |
---|---|
73 | |
30 | |
8 | |
8 | |
7 | |
6 | |
6 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.