abap2UI5 / abap2UI5

Developing UI5 Apps Purely in ABAP
http://www.abap2UI5.org
MIT License
295 stars 58 forks source link

Export table to xlsx #388

Closed choper725 closed 1 year ago

choper725 commented 1 year ago

Hi @oblomov-dev is there a way of getting export to xlsx on tables ??

i saw a export to csv option, i wonder if a spreadsheet xlsx is possible somehow

oblomov-dev commented 1 year ago

Hi choper,

in general this is no problem. In abap you just need to create an xlsx out of an internal table and then send it as a file to the frontend.

I made the same for a CSV to demonstrate how it works: https://github.com/abap2UI5/app-tools/blob/main/src/z2ui5_tool_cl_app_07.clas.abap

But the itab -> xlsx functionality is not UI specific, so i have no plans to add it to the framework.

You can check other open-source projects to see if there is functionality you can use for that. For example the abap2xlsx project. Not yet "cloud ready" but if this is your use case, you can also adjust it in this direction and send PRs to the project.

Best regards.

oblomov-dev commented 1 year ago

you can also check this: https://help.sap.com/docs/btp/sap-business-technology-platform/xlsx-write-access#writing-data-via-a-stream

choper725 commented 1 year ago

https://sapui5.hana.ondemand.com/sdk/#/entity/sap.ui.export.Spreadsheet

we got this also, the thing is , this looks mostly like js specific, hence im thinking about how this can be implemented in this project

oblomov-dev commented 1 year ago

yes this is the frontend solution of UI5, you can also encapsulate this in a custom control and use this with abap2UI5.

But i would always try to keep the frontend small and solve everything you can in ABAP, in particular when this problems are solvable in the backend, that's why i recommended abap2xlsx.

choper725 commented 1 year ago

i see, so you say its better to create a dependecy on another project rather than try to go on a frontend way?

oblomov-dev commented 1 year ago

it's just the way i would do it, so maybe it is more a matter of taste.

For me developing frontend controls in the context of abap2UI5 is a lot more work than solving the problem directly in ABAP. So i always prefer backend implementations.

In ABAP you can develop everything by yourself or create a dependency and use other open-source projects. when i find a well known and tested open-source project like abap2xlsx, i always accept the dependency and go with it.