Excel export is supported in both CRM and C4C. This blog gives a short introduction about how export is implemented in both system.
Excel export in CRM
In CRM, the exported excel has csv format which could directly be opened by any text editor:
If you would like to study how this functionality is implemented in CRM, just follow the guide below.
Open a WebClient UI component which supports excel export for example PRD01QR, double click the tag chtmlb: configTable
Then double click implementation class of this tag:
Set a breakpoint on method ADD_DOWNLOAD_TO_EXCEL:
Click Export button to trigger the breakpoint, in variable ev_script we can find the SICF service name for export function:
find this service in tcode SICF:
double click it to locate the handler class.
Set a breakpoint in its HANDLE_REQUEST method, and now you can debug how the source code of csv file is generated.
Excel export in C4C
The excel exported in C4C has postfix .xlsx, see one example below.
Rename it to ListofAccounts__EN.zip and unzip it, you will find that the .xlsx is actually a zipped package which contains several files. The actual content from C4C OWL are stored in file sheet1.xml.
Here below are the steps if you would like to explore more detail about excel export from UI perspective in C4C ( since the UI source code is open to partner & customer ).
(1) Launch C4C via Chrome, switch to debug mode via Ctrl+Alt+Shift+P.
Refresh the page and click F12 to launch Chrome development tool.
(2) Click Souces tab, press Ctrl+O and type keyword Button, click the first hit “Button-dbg.js”:
Set a breakpoint in line 154, the event handler for click:
(3) Perform Excel export in UI and breakpoint will be triggered. Debug into the code and soon you will find the url population logic is implemented in function _navigateToURL.
Inside this function you can learn how the final url for excel download is assembled by different parts:
Finally the assembled url is stored in variable url and the download is started by native API window.open. From the url we can also find the SICF service output_document, although its implementation in ABAP backend is not visible to partner & customer.
Further reading
In CRM there are also some standard API which supports to manipulation on Office document by ABAP. See Manipulate Docx document with ABAP for more detail.
Also refer to Jerry’s other blogs regarding the comparison how CRM and Cloud for Customer implement a given feature using different approaches:
- OData Service backend implementation in C4C, CRM and S4 HANA
- Excel export in CRM and C4C
- Saved query in C4C, CRM and S/4 HANA
- Direct navigation in CRM WebUI, CRM Fiori and C4C
- Formatted Text Edit in CRM and Cloud for Customer
- How Table column resize works in CRM and Cloud for Customer
要获取更多Jerry的原创文章,请关注公众号"汪子熙":