‎2011 Jan 10 7:20 AM
Hi All,
My requirement is to convert the alv output to an excel and send it to email in background processing.
Am creating the headers through the field cat headings as the headings are dynamic.
And the item data through the output internal table of ALV.
My issue is always the second row's first column is taking spaces in the start because of this the data starts getting truncated.
Am using a tab delimter to seprate 2 fields and at the end of a row am using line breaker cl_abap_char_utilities=>cr_lf.
the below is how am filling the packing lists.
Fill Packing List For body
lw_packing_list-transf_bin = space.
lw_packing_list-head_start = 1.
lw_packing_list-head_num = 0.
lw_packing_list-body_start = 1.
DESCRIBE TABLE lt_message LINES lw_packing_list-body_num.
lw_packing_list-doc_type = 'RAW'.
APPEND lw_packing_list TO lt_packing_list.
clear lw_packing_list.
Fill the fields of the packing_list for creating the attachment:
lw_packing_list-transf_bin = lc_x.
lw_packing_list-head_start = 1.
lw_packing_list-head_num = 1.
lw_packing_list-body_start = 1.
DESCRIBE TABLE t_attach LINES lw_packing_list-body_num.
lw_packing_list-doc_type = lv_format.
lw_packing_list-obj_descr = lv_attdesc.
lw_packing_list-doc_size = lw_packing_list-body_num * 255.
APPEND lw_packing_list TO lt_packing_list.
Fill the mail recipient list
lw_reclist-rec_type = 'U'.
lw_reclist-com_type = 'INT'.
LOOP AT t_recipient_list INTO w_recipient_list.
lw_reclist-receiver = w_recipient_list-ZSMTP_ADR.
APPEND lw_reclist TO lt_reclist.
ENDLOOP.
I have surfed the google and SDN but could not find any solution to my problem Please help guys..
‎2011 Jan 10 7:38 AM
Hi,
go to se38-->enter program name BCS_EXAMPLE_7
and see the sample code to send XLS attachment...
in this program it shows how to send the internal table or ALV report data into excel mail attachment
Prabhudas
‎2011 Jan 10 1:06 PM
hiii,
you can first convert the alv to excel file using gui_download and then attach the same and mail it.
thanx.
regards,
akshay ruia.
‎2011 Jan 10 7:52 PM
you can first convert the alv to excel file using gui_download and then attach the same and mail it
But that's completely unnecessary, not to mention extra overhead. The BCS_EXAMPLE_7 program is the correct approach as Prabhu Das mentioned...
‎2011 Jan 11 6:32 AM
Thanks for your replies
I have data more than 255 char in header as well as items.
so will the BCS_example7 will be helpfull to me.
And multiple recipients are also available.
‎2011 Jan 11 6:47 AM
hiii,
can u pls post the code for bcs_example_7 as it is not available in the system.
i got the code from some other forum but the code has an error that the class cl_bcs_convert is not availble.
thanx.
regards,
akshay ruia
‎2011 Feb 07 7:16 AM