03-31-2016 5:01 AM
Dear All,
I am facing the issue while sending the mail with attachment type .XLSX. for the multiple Worksheets.
we have Tried with below possibilities :
1. Customized SO_DOCUMENT_SEND_API1 and Changed the Document type Size as from ( 3 to 4 ).
2. Tried with CL_BCS Functionality based on the reference Standard program BCS_EXAMPLE_7
3. Tried with ABAP2XLSX Functionality.
Finally we have achieved to send single worksheet with .XLSX Extension , But its not happening for Multiple worksheets.
Waiting for Solutions.
Regards ,
Nagaraju Adhikari
03-31-2016 6:44 AM
Hi Naga Raju,
Try using the OLE For attaching Multiple Work sheets in Excel..All the Changes regarding the Excel you can go through the OLE( For Downloading , Uploading , Creating the Sheets Dynamically ).
Find the below link...
Sending email with multiple tabs of excel as a single attachment in ABAP
Hope these is useful
Thanks & Regards
@SURENDRA@
03-31-2016 6:57 AM
Dear Surendra,
appreciate your immediate response, I have checked the link which you have provided. in fact we have already implemented the same but it will only works for .XLS and not for .XLSX.
Our requirement is to send the file as .XLSX Format / MS-Excel 2007 Format, Kindly help if you have solution.
Thanks & Regards,
Nagaraju Adhikari
03-31-2016 7:16 AM
Hi
Naga Raju,
Have you tried these
objpack-doc_type = 'XLSX'.
* Packing List For the E-mail Attachment
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-obj_descr = 'Summary Table'.
objpack-doc_type = 'XLSX'.
objpack-doc_size = tab_lines * 255.
APPEND objpack.
Thanks & Regards
@Surendra@
03-31-2016 7:37 AM
Dear Surendra,
We have tried the provided logic but Objpack-doc_type accepts only 3 characters because of that even if you provide XLSX it will trim till 3 digits and it will consider XLS.
I mentioned in my First Post , We have customized the Standard Functionality still it is not working.
So, Now we are focusing on ABAP2XLSX functionality, Kindly suggest If you have any alternative solution.
Thank you.
Regards ,
Nagaraju Adhikari
03-31-2016 7:57 AM
Hi Nagaraju,
I used ABAP2XLSX to send this kind of file (multiple sheets) via mail without problems a good amount of times.
Could you kindly share a snippet of your code where you try to create the multiple sheets so we can give you a better answer?
TY
Simone
03-31-2016 8:20 AM
Hi Nagu Raju,
I have find one function module by surfing..Try these SO_DOCUMENT_REPOSITORY_MANAGER if use ful..I will try mean while for the better solution.
Read the below link
How to use FM "SO_DOCUMENT_REPOSITORY_MANAGER" ... | SCN
Thanks & Regards
@Surendra@
03-31-2016 8:30 AM
Dear Simone,
Code snippet as follows:
=======================================================================================
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->title = title.
lo_worksheet->set_table( ip_table = ip_table
ip_table_title = 'ITAB' " internal Table1
ip_hdr_style = lv_style_header_guid
ip_body_style = lv_style_body_guid
zlt_components = zlt_components ). =======================================================================================
with the help of above code we are able to send .XLSX File with single worksheet and data in Internal table.
but as per our requirement we need to send multiple worksheets with XML data.
you may ask why we are using XML data??? because we need cell wise color and formatting in Excel file.
Kindly suggest solution.
Thanks & Regards,
Nagaraju Adhikari
03-31-2016 10:12 AM
You have to create a new worksheet (or any number you need)
If I remember well (in this system I have not yet installed it) there are 2 methods in LO_EXCEL to add_worksheet and SET_ACTIVE_WORKSHEET.
With them you can add and activate the correct worksheet with a flow like the one below
LO_EXCEL->ADD_WORKSHEET( )
LO_EXCEL->SET_ACTIVE_WORKSHEET( n ) <-n is the worksheet number
LO_WORKSHEET = LO_EXCEL->GET_ACTIVE_WORKSHEET( ).
<---your code--->
If you check ZCL_EXCEL class you can find pretty easily the methods you need.
Sorry for the raw answer, but, as I stated, I do not have the code on this system for a more accurate one
03-31-2016 1:46 PM
With little bit of XML knowledge and a know how of how Open XML Spreadsheet works, you can merge different XLSX files into 1 file. I have done this in the past.
Considering the XLSX files contains only text data - not graphs, pictures etc - You just need to merge, Shared strings, Styles and Relationships for this to happen.
Don't ask me for source code - I don't have access to it currently - but it is definitely doable without the help of external tools and by just using ABAP.
Thanks, Juwin
04-01-2016 5:07 AM
Dear All,
I got the solution for multiple worksheets with .XLSX Extension.
Thanks for your suggestions.
Regards ,
Nagaraju Adhikari
04-01-2016 5:11 AM
Hi NagaRaju,
You can explain how you have done..So it is useful for some one who may face the same issue..
Appreciate if you share your knowledge regarding these.
Thanks & Regards
@Surendra@
04-01-2016 7:58 AM
Dear Surendra,
I Have Used ABAP2XLSX Concept and Written the Below Code:
data:lo_excel type ref to zcl_excel ,
lo_worksheet type ref to zcl_excel_worksheet ,
* For first Sheet in the excel workbook
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->title = 'First Sheet'.
lo_worksheet->set_table( ip_table = ip_table
ip_table_title = 'ITAB'"'LT_TEST'
ip_hdr_style = lv_style_header_guid
ip_body_style = lv_style_body_guid
zlt_components = zlt_components ).
* For second Sheet in the excel workbook
Add a new work sheet and set the second table as above. ).
and use below logic
lv_file = lo_excel->save_as( zcl_excel=>c_xlsx ).
" Convert to binary
call function 'SCMS_XSTRING_TO_BINARY'
exporting
buffer = lv_file
importing
output_length = lv_bytecount
tables
binary_tab = lt_file_tab.
and then write send_request method.
we need to write code for SET_TABLE and SET_TABLE2 to pass the Internal table data by using all the importing parameters.
Thanks & Regards ,
Nagaraju Adhikari