on 04-01-2008 2:54 PM
Hi All,
we have a requirement where in we have to create an XLS file from internal table. This xls file then has to be zipped and mailed.
If anyone knows how to create an xls file and zip it in WebDynpro, without using OPEN, CLOSE DATA SET etc, Please let us know. It will be of great help.
Thanks,
Anand
Hi Anand,
Try out the approach below:
1) Convert the internal table data into string format.
2) Convert the STRING format to XSTRING format by using the FM SCMS_STRING_TO_XSTRING.
3) Use the method COMPRESS_BINARY of class CL_ABAP_GZIP to compress the XSTRING file.
4) Use the method SEND_WEB_MAIL of class CL_HRRCF_SERVICES_MAIL to mail across the zipped contents.
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>2) Convert the STRING format to XSTRING format by using the FM SCMS_STRING_TO_XSTRING.
Actually you should use CL_BCS_CONVERT=>STRING_TO_XSTRING now.
>3) Use the method COMPRESS_BINARY of class CL_ABAP_GZIP to compress the XSTRING file.
You probably want to use CL_ABAP_ZIP instead of CL_ABAP_GZIP. CL_ABAP_GZIP only does compression, which is fine for storing a single packet of data in the database. However CL_ABAP_ZIP is better suited for mult-part zip (multiple inner files).
>4) Use the method SEND_WEB_MAIL of class CL_HRRCF_SERVICES_MAIL to mail across the zipped contents.
This seems to be an HR specific class. Better to use the cross application, NetWeaver provided functionality for sending mail - CL_BCS.
It is also possible to use ( possibly abuse ) the standard ALV export functionality to convert your table into a nicer formatted XLS. This has the benefits of the ALV formatting and using the context to derive headers etc.
[Using WD ABAP ALV export - the hacked way|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/19646] [original link is broken] [original link is broken] [original link is broken];
The code in the linked blog should be able to show you how to do step (1) of Uday's list to produce a nicely formatted XString (so even goes past step 1
I can't say I could recommend this approach - as that's why I put the blog post up there - I'm not sure. But it does work and could be useful in meeting your requirement.
Cheers,
Chris
Hi,
For ZIP file, you can check the link below.
Link:
[Creating a ZIP File|http://wiki.sdn.sap.com/wiki/display/ABAP/CL_ABAP_ZIPusage-ZippingABAPreportoutput?focusedCommentId=187336343]
Hope this helps.
Regards,
Sagar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This message was moderated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This message was moderated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not quite sure what you mean by 'create an xls file', but you do have UI elements for office. For zipping a file, there is a class with which you can do this. I don't have a system at hand right now, but you should be able to find the class when entering ZIP in SE24 and click F4-help.
By the way, you can create an xls file from an internal table. Search for function module ASMLEXCEL* or something like that. So when displaying this data in a table in WD, and create a button in which data will be downloaded. Or use file upload / download functionality if possible for you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.