Email excel attachment issues
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..
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
Similar Messages
-
Hi ,
I use the FM : SO_NEW_DOCUMENT_ATT_SEND_API1 for triggering an email with the excel attachment. Email triggering with an attachment happens without any issues. But in the attachment , I am facing the following issue.
One of the fields in the excel is numeric. Excel displays that field in the exponential format. Say for example, if the content is 38883001593305 ,excel displays it as 3.8883E+13. I need to display the numeric as it is without any conversion. Please kindly suggest how to achieve this.
Thanks.Hi friend,
follow the below code
{ lv_message = 'Mail For Cancelled Invoices.'.
append lv_message to it_message.
concatenate 'OPERATING UNIT NAME'
'INVOICE BATCH NAME'
'SUPPLIER NAME'
'SUPPLIER GSL'
'SUPPLIER PAY SITE CODE'
'SUPPLIER PAY SITE ADDRESS'
'SUPPLIER PAY SITE CITY'
'SUPPLIER PAY SITE STATE'
'SUPPLIER PAY SITE COUNTRY'
'INVOICE NUMBER'
'VOUCHER NUMBER'
'PO NUMBER'
'PO LINE NUMBER'
'PO BUYER NAME'
'INVOICE DATE'
'CANCELLED DATE'
'INVOICE ENTERED DATE'
'INVOICE AMOUNT'
'INVOICE CREATED BY'
into it_attachment separated by
cl_abap_char_utilities=>horizontal_tab.
concatenate cl_abap_char_utilities=>cr_lf it_attachment into it_attachment.
append it_attachment.
loop at t_output into wa_output.
concatenate wa_output-bukrs
wa_output-belnr
wa_output-name1
wa_output-gsl
wa_output-lifnr
wa_output-stras
wa_output-ort01
wa_output-regio
wa_output-land1
wa_output-xblnr
wa_output-belnr
wa_output-ebeln
wa_output-ebelp
wa_output-name2
wa_output-budat
wa_output-cpudt
wa_output-bldat
wa_output-dmbtr
wa_output-usnam
into it_attachment separated by
cl_abap_char_utilities=>horizontal_tab.
concatenate cl_abap_char_utilities=>cr_lf it_attachment into it_attachment.
append it_attachment.
endloop.
Selecting the mail id's
select intid
email
from ztbidl
into table t_ztbidl
where intid = 'RICEF125' and
obj_name = 'EPIQ'.
loop at t_ztbidl into wa_ztbidl.
it_receivers-receiver = wa_ztbidl-email.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = 'X'.
it_receivers-notif_ndel = 'X'.
it_receivers-express = 'X'.
append it_receivers.
endloop.
*File Type
ld_format = 'XLS'.
**File Name
ld_attfilename = 'File1'.
concatenate 'PIC_' sy-datum into ld_attfilename.
Fill the document data.
gd_doc_data-doc_size = 1.
Populate the subject/generic message attributes
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SAPRPT'.
gd_doc_data-obj_descr = psubject .
gd_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
clear gd_doc_data.
Populate the subject/generic message attributes
gd_doc_data-obj_langu = sy-langu.
read table it_attachment index w_cnt.
gd_doc_data-doc_size = ( w_cnt - 1 ) * 255 + strlen( it_attachment ).
gd_doc_data-obj_name = 'SAPRPT'.
gd_doc_data-obj_descr = psubject.
gd_doc_data-sensitivty = 'F'.
Describe the body of the message
clear it_packing_list.
refresh it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
describe table it_message lines it_packing_list-body_num.
it_packing_list-doc_type = 'RAW'.
append it_packing_list.
**Describe the attachment info
it_packing_list-transf_bin = 'X'.
it_packing_list-head_start = 1.
it_packing_list-head_num = 1.
it_packing_list-body_start = 1.
describe table it_attachment lines it_packing_list-body_num.
it_packing_list-doc_type = ld_format.
it_packing_list-obj_name = ld_attfilename.
it_packing_list-obj_descr = ld_attfilename.
it_packing_list-doc_size = it_packing_list-body_num * 255.
append it_packing_list.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
tables
packing_list = it_packing_list
contents_bin = it_attachment
contents_txt = it_message
receivers = it_receivers
exceptions
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8. -
Email Excel attachment with a BOLD row
hi!
My requirement is that data in an internal table should be sent as an attachment in an email. There are a few records in the internal table which needs to be in bold(i have the logic to figure out whichones). I am using the below FM .
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = wa_object_hd
object_type = 'RAW'
TABLES
objcont = i_text
receivers = i_recv
packing_list = i_packing_list
att_cont = i_att
Does any body have any idea how to bold a few records in the excel attachment?
I appreciate your suggestions.
Thanks,
manasa
Message was edited by:
manasaHi Manasa,
The Code below is for sending Excel attachment in email. Not sure for BOLD...
You can copy and paste the following codes and execute..
Hope this will help you..
TYPE-POOLS: truxs.
DATA t5 LIKE t005t OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
SELECT * INTO TABLE t5
FROM t005t
WHERE spras = sy-langu.
DATA wa_data TYPE truxs_t_text_data.
CALL FUNCTION 'SAP_CONVERT_TO_TXT_FORMAT'
EXPORTING
i_line_header = 'X'
TABLES
i_tab_sap_data = t5
CHANGING
i_tab_converted_data = wa_data
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
DATA stmp(4096) TYPE c.
DATA itmp TYPE i.
LOOP AT wa_data INTO stmp.
itmp = STRLEN( stmp ).
stmp+itmp = cl_abap_char_utilities=>cr_lf.
MODIFY wa_data FROM stmp.
ENDLOOP.
PERFORM send_email.
*& Form send_email
FORM send_email .
DATA docs LIKE docs OCCURS 0 WITH HEADER LINE.
DATA excelsize TYPE i.
DATA excel LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA doc LIKE sodocchgi1.
DATA excelln TYPE i.
DATA int_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA int_objhead LIKE solisti1 OCCURS 2 WITH HEADER LINE.
DATA int_objtext LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA int_reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA bodyln LIKE sy-tabix.
DATA output_data TYPE ssfcrescl.
excel[] = wa_data[].
excel table sizes
DESCRIBE TABLE excel LINES excelln.
Body Email
int_objtext-line = 'Test Body'.
APPEND int_objtext.
DESCRIBE TABLE int_objtext LINES bodyln.
READ TABLE int_objtext INDEX bodyln.
CLEAR doc.
doc-doc_size = ( bodyln - 1 ) * 255 + STRLEN( int_objtext ).
doc-obj_name = ' '.
doc-sensitivty = 'P'.
doc-proc_syst = sy-sysid.
doc-proc_clint = sy-mandt.
CLEAR: int_objpack, int_objpack[].
int_objpack-transf_bin = ' '.
int_objpack-head_start = 1.
int_objpack-head_num = 0.
int_objpack-body_start = 1.
int_objpack-body_num = bodyln.
int_objpack-doc_type = 'RAW'.
int_objpack-obj_descr = 'Test'.
APPEND int_objpack.
CLEAR: int_objhead, int_objhead[].
int_objhead = 'Attachment'.
APPEND int_objhead.
int_objpack-transf_bin = 'X'.
int_objpack-head_start = 1.
int_objpack-head_num = 0.
int_objpack-body_start = 1.
int_objpack-body_num = excelln.
int_objpack-doc_size = excelsize.
int_objpack-doc_type = 'XLS'.
int_objpack-obj_name = 'excel'.
int_objpack-obj_descr = 'test.xls'. "File name
APPEND int_objpack.
Set Receiver
int_reclist-receiver = 'SAPUSER'.
int_reclist-rec_type = 'B'.
int_reclist-notif_del = 'X'.
int_reclist-notif_read = 'X'.
int_reclist-notif_ndel = 'X'.
int_reclist-express = 'X'.
APPEND int_reclist.
doc-obj_descr = 'Report in Excel'.
Sending Email
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = int_objpack
object_header = int_objhead
contents_bin = excel
contents_txt = int_objtext "Body
receivers = int_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
ENDFORM. " send_email
Note:
- If you are using FM SAP_CONVERT_TO_TXT_FORMAT you will not be able to execute this program in the background.
- dont forget to change 'SAPUSER' to your SAP user ID
- you can check the email by using tcode 'SBWP'.
Reward points if this Helps.
Manish -
I am sending an email with an excel attachment using fm SO_NEW_DOCUMENT_ATT_SEND_API1. All is well except that the first column of the excel document displys a load of blank spaces in front of the data item. Is there any way of cutting out the blank spaces?
Code is as follows:
Populate the email header
CONCATENATE text-m09 l_pltxt INTO docdata-obj_descr.
docdata-obj_name = text-m11.
Populate the body of the mail
MOVE text-m10 TO objtxt.
APPEND objtxt.
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
Size of the document in bytes. The calculation is
Length of last line + number of remaining lines * 255
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
APPEND objpack.
Get end of line character
l_eol = cl_abap_char_utilities=>newline.
Set up attachment
Column headers
CONCATENATE 'Requested by'
'Serial Number'
'Part Number'
'Inst.or Dism.'
'Mvmnt.To(Sup.Equip.)'
'Mvmnt.To(Func.Loc.)'
'Mvmnt.Date'
'Posn'
'Start Date'
l_eol
INTO objbin SEPARATED BY ','.
APPEND objbin.
CLEAR objbin.
Lines
LOOP AT it_equipment.
CONCATENATE sy-uname
it_equipment-sernr
zdbmatl-matnr
it_equipment-iord
it_equipment-equnr
it_equipment-tplnr
it_equipment-move_date
it_equipment-pors
it_equipment-start_date
l_eol
INTO objbin SEPARATED BY ','.
APPEND objbin.
CLEAR objbin.
ENDLOOP.
att_type = 'CSV'.
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
Size of the document in bytes.The calculation is
Length of last line + number of remaining lines * 255
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
CONCATENATE text-m09
l_pltxt
INTO objpack-obj_descr SEPARATED BY space.
APPEND objpack.
CLEAR objpack.
reclist-receiver = '[email protected]'.
reclist-rec_type = 'U'.
APPEND reclist.
Send mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
COMMIT WORK.Hi
Please see the link below
It will definately satisfy your requirement.
Re: FI docu
<b>Mark if helpful</b>
Regards
Tushar
Message was edited by:
Tushar Mundlik -
Email Excel attachement showing dollar amount instead of date.
Hi,
I emailed an Excel (.xlsx) file from my pc to two people. They both opened the attachment on their iPads from mail. One person is seing the only date column as a dollar amount with a dollar sign. The other person is showing the column correctly. I looked for any setting that could cause this, but I cannot see anything.
Any suggestions would greatly be appreciated.
Thank you.Hi SZ,
you can configure what properties are showed for resources within the collection or the resource renderer. Check this out and around: http://help.sap.com/saphelp_ep50sp5/helpdata/en/50/041142e862654ca98ced1607386c9c/frameset.htm (especially "Visible Properties"). Take some time to understand the mechanisms...
> We are using EP5
Ah, <i>you</i> are the last one
Hope it helps
Detlev
PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance! -
Issue in Sending email with EXCEL attachment
Hi,
Im using the FM SO_NEW_DOCUMENT_ATT_SEND_API1 for sending emails to a list of recipients with an excel attachment. In the attachment data, as the field length is 255 for the structure SOLISTI1, for the records having more than 255 characters, data is being truncated. I did a search in this forum and done some changes , still it is not working properly.
I have used SCMS_TEXT_TO_XSTRING, SCMS_XSTRING_TO_BINARY FMs for converting the data to hexa format. This case, records having more than 255 are displayed properly in the attachment, but there are blank lines inserted between two records.
Please suggest me to resolve this isssue.
Thanks in advance.
JayashreeHi Jayashree,
you might want to check out the example link by Saso in his post Send external email from within ABAP program to xls.
For the rest I can only guess that there might be some issues with the format you use for Excel. In case of empty lines and using a text format for Excel the issue is in most cases that there are too many carriage return line feeds in the text fiel (cl_abap_char_utilities=>cr_lf).
Hope that helps.
Best Regards
Michael -
Issue in sending e mails with Excel attachment
Hi,
I am facing an issue with one function module - SO_DOCUMENT_SEND_API1. We were using this for sending mails to diff destination with excel sheet attachment contains sales data. This system has been migrated from 4.5B to ECC 5. Now this process is not working like the old one and the excel attachment is not properly formatted. All the data is being written into one cell of excel sheet and it seems only one line is present in output and is corrupted.
Can you please let me know what might be the issue here, any alternate option available or something to be modified in new version with this function module?
Thanks in advance,
UllasHi Ullas,
check this once.
REPORT ZLAXMI_ALVMAIL4 .
TABLES: EKKO.
PARAMETERS: P_EMAIL TYPE SOMLRECI1-RECEIVER
DEFAULT '[email protected]'.
TYPES: BEGIN OF T_EKPO,
EBELN TYPE EKPO-EBELN,
EBELP TYPE EKPO-EBELP,
AEDAT TYPE EKPO-AEDAT,
MATNR TYPE EKPO-MATNR,
END OF T_EKPO.
DATA: IT_EKPO TYPE STANDARD TABLE OF T_EKPO INITIAL SIZE 0,
WA_EKPO TYPE T_EKPO.
TYPES: BEGIN OF T_CHAREKPO,
EBELN(10) TYPE C,
EBELP(5) TYPE C,
AEDAT(8) TYPE C,
MATNR(18) TYPE C,
END OF T_CHAREKPO.
DATA: WA_CHAREKPO TYPE T_CHAREKPO.
DATA: IT_MESSAGE TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: IT_ATTACH TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: T_PACKING_LIST LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
T_CONTENTS LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_RECEIVERS LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
T_ATTACHMENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_OBJECT_HEADER LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
W_CNT TYPE I,
W_SENT_ALL(1) TYPE C,
W_DOC_DATA LIKE SODOCCHGI1,
GD_ERROR TYPE SY-SUBRC,
GD_RECIEVER TYPE SY-SUBRC.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM DATA_RETRIEVAL.
Populate table with detaisl to be entered into .xls file
PERFORM BUILD_XLS_DATA_TABLE.
*END-OF-SELECTION
END-OF-SELECTION.
Populate message body text
PERFORM POPULATE_EMAIL_MESSAGE_BODY.
Send file by email as .xls speadsheet
PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
TABLES IT_MESSAGE
IT_ATTACH
USING P_EMAIL
'Example .xls documnet attachment'
'XLS'
'filename'
CHANGING GD_ERROR
GD_RECIEVER.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM DATA_RETRIEVAL.
SELECT EBELN EBELP AEDAT MATNR
UP TO 10 ROWS
FROM EKPO
INTO TABLE IT_EKPO.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM BUILD_XLS_DATA_TABLE.
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
CONSTANTS:
CON_TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
CON_CRET TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
INTO IT_ATTACH SEPARATED BY CON_TAB.
CONCATENATE CON_CRET IT_ATTACH INTO IT_ATTACH.
APPEND IT_ATTACH.
LOOP AT IT_EKPO INTO WA_CHAREKPO.
CONCATENATE WA_CHAREKPO-EBELN WA_CHAREKPO-EBELP
WA_CHAREKPO-AEDAT WA_CHAREKPO-MATNR
INTO IT_ATTACH SEPARATED BY CON_TAB.
CONCATENATE CON_CRET IT_ATTACH INTO IT_ATTACH.
APPEND IT_ATTACH.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES PIT_MESSAGE
PIT_ATTACH
USING P_EMAIL
P_MTITLE
P_FORMAT
P_FILENAME
P_ATTDESCRIPTION
P_SENDER_ADDRESS
P_SENDER_ADDRES_TYPE
CHANGING P_ERROR
P_RECIEVER.
DATA: LD_ERROR TYPE SY-SUBRC,
LD_RECIEVER TYPE SY-SUBRC,
LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
LD_EMAIL LIKE SOMLRECI1-RECEIVER,
LD_FORMAT TYPE SO_OBJ_TP ,
LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,
LD_ATTFILENAME TYPE SO_OBJ_DES ,
LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
LD_RECEIVER LIKE SY-SUBRC.
LD_EMAIL = P_EMAIL.
LD_MTITLE = P_MTITLE.
LD_FORMAT = P_FORMAT.
LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
LD_ATTFILENAME = P_FILENAME.
LD_SENDER_ADDRESS = P_SENDER_ADDRESS.
LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
Fill the document data.
W_DOC_DATA-DOC_SIZE = 1.
Populate the subject/generic message attributes
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
W_DOC_DATA-SENSITIVTY = 'F'.
Fill the document data and get size of attachment
CLEAR W_DOC_DATA.
READ TABLE IT_ATTACH INDEX W_CNT.
W_DOC_DATA-DOC_SIZE =
( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE.
W_DOC_DATA-SENSITIVTY = 'F'.
CLEAR T_ATTACHMENT.
REFRESH T_ATTACHMENT.
T_ATTACHMENT[] = PIT_ATTACH[].
Describe the body of the message
CLEAR T_PACKING_LIST.
REFRESH T_PACKING_LIST.
T_PACKING_LIST-TRANSF_BIN = SPACE.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 0.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = 'RAW'.
APPEND T_PACKING_LIST.
Create attachment notification
T_PACKING_LIST-TRANSF_BIN = 'X'.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 1.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
APPEND T_PACKING_LIST.
Add the recipients email address
CLEAR T_RECEIVERS.
REFRESH T_RECEIVERS.
T_RECEIVERS-RECEIVER = LD_EMAIL.
T_RECEIVERS-REC_TYPE = 'U'.
T_RECEIVERS-COM_TYPE = 'INT'.
T_RECEIVERS-NOTIF_DEL = 'X'.
T_RECEIVERS-NOTIF_NDEL = 'X'.
APPEND T_RECEIVERS.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_DATA
PUT_IN_OUTBOX = 'X'
SENDER_ADDRESS = LD_SENDER_ADDRESS
SENDER_ADDRESS_TYPE = LD_SENDER_ADDRESS_TYPE
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL = W_SENT_ALL
TABLES
PACKING_LIST = T_PACKING_LIST
CONTENTS_BIN = T_ATTACHMENT
CONTENTS_TXT = IT_MESSAGE
RECEIVERS = T_RECEIVERS
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
Populate zerror return code
LD_ERROR = SY-SUBRC.
Populate zreceiver return code
LOOP AT T_RECEIVERS.
LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
ENDLOOP.
ENDFORM.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM INITIATE_MAIL_EXECUTE_PROGRAM.
WAIT UP TO 2 SECONDS.
SUBMIT RSCONN01 WITH MODE = 'INT'
WITH OUTPUT = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
FORM POPULATE_EMAIL_MESSAGE_BODY.
REFRESH IT_MESSAGE.
IT_MESSAGE = 'Please find attached a list test ekpo records'.
APPEND IT_MESSAGE.
ENDFORM. " POPULATE_EMAIL_MESSAGE_BODY
Regards,
Laxmi. -
Facing problem in excel attachment in the Email
Hi,
I am facing one issue while sending an email with an excel attachment . In the excel attachment the actual number of line items are not displaying . For example if i have 4 rows in my internal table the excel shows only the first row of the internal table.
Can anybody suggest what is the issue.
Regards,
Ratheesh BSHi ,
Please find the code used.
WRITE: sy-datum TO l_date MM/DD/YY.
CONCATENATE text-014 "Enterprise workflow(s) are in ERROR status
l_date
INTO l_text
SEPARATED BY c_colon.
wa_doc_data-obj_langu = sy-langu.
wa_doc_data-obj_name = text-013. "SAPRPT
wa_doc_data-obj_descr = l_text.
wa_doc_data-sensitivty = c_false.
Fill the document data and get size of attachment
DESCRIBE TABLE i_attach LINES l_cnt.
READ TABLE i_attach INTO wa_attach INDEX l_cnt.
IF sy-subrc EQ 0.
l_size = STRLEN( wa_attach ).
l_docsize = ( ( l_cnt - 1 ) * c_length255 + l_size ).
wa_doc_data-doc_size = l_docsize.
wa_doc_data-obj_langu = sy-langu.
wa_doc_data-obj_name = text-013. "SAPRPT
wa_doc_data-obj_descr = l_text.
wa_doc_data-sensitivty = c_false.
ENDIF.
lt_attachment[] = i_attach[]." XLS attachment details
Describe the body of the message
CLEAR wa_packing_list.
REFRESH lt_packing_list.
wa_packing_list-transf_bin = space.
wa_packing_list-head_start = 1.
wa_packing_list-head_num = 0.
wa_packing_list-body_start = 1.
DESCRIBE TABLE lt_message LINES wa_packing_list-body_num .
wa_packing_list-doc_type = c_raw.
APPEND wa_packing_list TO lt_packing_list.
CLEAR wa_packing_list.
*l_docsize = 5000.
Create attachment notification
wa_packing_list-transf_bin = c_active.
wa_packing_list-head_start = 1.
wa_packing_list-head_num = 1.
wa_packing_list-body_start = 1.
DESCRIBE TABLE lt_attachment LINES wa_packing_list-body_num.
wa_packing_list-doc_type = c_xls.
wa_packing_list-obj_descr = text-022.
wa_packing_list-doc_size = wa_packing_list-body_num * c_length255.
APPEND wa_packing_list TO lt_packing_list.
CLEAR: wa_packing_list,l_cnt.
Email to be sent for multiple receivers
Add the recipients email address
LOOP AT s_receiv INTO wa_email.
l_email = wa_email-low.
wa_receivers-rec_type = c_rectyp.
wa_receivers-receiver = l_email.
wa_receivers-com_type = c_internet.
wa_receivers-notif_del = c_true.
wa_receivers-notif_ndel = c_true.
APPEND wa_receivers TO lt_receivers.
CLEAR : wa_receivers, wa_email, l_email.
ENDLOOP.
IF lt_receivers[] IS NOT INITIAL AND
i_itemrecord[] IS NOT INITIAL.
email sender
l_sender_address = sy-uname. " Stores the sender's address
*Function module to handel mail sending.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = wa_doc_data
put_in_outbox = c_true
sender_address = l_sender_address
sender_address_type = c_sender_address_type
commit_work = c_true
IMPORTING
SENT_TO_ALL =
TABLES
packing_list = lt_packing_list
contents_bin = lt_attachment
contents_hex = lt_attachment1
contents_txt = lt_message
receivers = lt_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8 -
I attempted to eprint an email with an excel attachment. The attachment didn't print
I attempted to eprint an email with an Excel attachment. The email message printed but the Excel attachment does not print
Hi DaveF100,
You may want to refer to the help section of ePrintCenter.com here about attachments. In general though, Excel documents will have difficulty if they have complex variables in the document, such as pivot tables, macros, etc.
If I have solved your issue, please feel free to provide kudos and make sure you mark this thread as solution provided!
Although I work for HP, my posts and replies are my own opinion and not those of HP. -
Unicode Upgarde Issue : Excel attachment formatting error
Hi all
We recently had over unicode upgrade.
We have some ALV reports, which when we run in bg, send an email with attachment in excel format. These excel sheets have some XML tags also specified in it.
Now after upgrade, when i open the attachment, whole data ( along with XML tags ) are all filled in the 1st column of the excel.
I am using FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send email
The funny thing..when i copy all these data from column 1 and create a new xls document, the xml format is coming fine.
Can any one please guide me in this issue
Points will be rewarded for all helpful answersHello.. any updates..anyone??
-
Issue while opening Excel attachment send through FM
Hi All,
I had program in which i am sending mail along with Excel attachment using FM SO_NEW_DOCUMENT_ATT_SEND_API1. Mail is going fine with data in Excel attachment. But when i try to open the Excel it gives an Info message saying that "<b>You are trying to open (attachment name),is in different format than specified file extension Verify that file is not corrupted and is from a trusted source before opening file. Do you want to open file now</b>". Then when i presses YES, Excel opens up with all data. I want to know how to avoid that info popup. Is there something has to be passed to FM or something has to be done to Excel like settings in EXCEL so that i can avoid that Info message coming.
Document type of attachment is gw_packing_list-doc_type = 'XLS'.
Thanks in advance,
ShyamHi Shyam,
Have you build your Excel Data table to get attachement in Mail? If no then please find the Eg. code for your reference to send Excel attachment..
* End of Selection Event : Displaying the selected data *
END-OF-SELECTION.
PERFORM EMAIL_EXCEL_ATTACHMENT.
******///form
FORM EMAIL_EXCEL_ATTACHMENT .
* Populate table with detaisl to be entered into .xls file
PERFORM BUILD_XLS_DATA_TABLE.
* Populate message body text
PERFORM POPULATE_EMAIL_MESSAGE_BODY.
* Send file by email as .xls speadsheet
PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
TABLES IT_MESSAGE
IT_ATTACH
USING S_EMAIL
TEXT-042
C_XLS
'filename'
CHANGING GD_ERROR
GD_RECIEVER.
* Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
ENDFORM. " EMAIL_EXCEL_ATTACHMENT
********///form BUILD_XLS_DATA_TABLE
FORM BUILD_XLS_DATA_TABLE .
DATA : LV_NETWR(20) TYPE C,
LV_BOL_DATE(20) TYPE C,
LV_KAWRT(20) TYPE C,
LV_FKDAT(20) TYPE C,
LV_WAERK(20) TYPE C,
LV_KURRF(20) TYPE C,
LV_SHIPDATE(20) TYPE C,
LV_DEPTDATE(20) TYPE C.
CONSTANTS:
CON_TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
CON_CRET TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF. "#EC *
DATA STR TYPE STRING.
**********/ this parameter concatenate to get headers
CONCATENATE STR
'SLNO'
'OWNER'
'SERIAL NO'
'FROM'
'DESTINATION'
'INVOICE VALUE'
'DESCRIPTION'
'CUSTOMER NAME'
'BL NUMBER'
'BL DATE'
'VESSEL NAME/AIRLINE DETAILS'
'MODE OF TRANSIT'
'SHIPPING MARKS'
'DUTY SUM INSURED'
'FLAG'
'OPEN COVERNO'
'INVOICE DATE'
'INVOICE NO'
'LC WORDING'
'QUANTITY'
'PACKAGING DETAILS'
'BASIS OF VALUATION'
'EXCLUDE WAR SRCC'
'CURRENCY'
'EXCHANGE RATE'
'ADDRESS'
'VESSEL BUILT YEAR'
'VESSEL FLAG'
'VOYAGE NO'
'SHIPMENT DATE'
'DEPARTURE DATE'
'SURVEYOR COUNTRY'
'SURVEYOR CITY'
'SURVEYOR AGENT'
'SURVEYOR ADDRESS'
'EXPORT CONSIGNMENT'
'CONTAINER DETAILS'
CL_ABAP_CHAR_UTILITIES=>CR_LF INTO STR SEPARATED BY CON_TAB.
LOOP AT IT_FINAL.
*******/ this is to pass body / row data
WRITE : IT_FINAL-NETWR TO LV_NETWR, "#EC UOM_IN_MES
IT_FINAL-BOL_DATE TO LV_BOL_DATE,
IT_FINAL-KAWRT TO LV_KAWRT, "#EC UOM_IN_MES
IT_FINAL-FKDAT TO LV_FKDAT,
IT_FINAL-WAERK TO LV_WAERK,
IT_FINAL-KURRF TO LV_KURRF,
IT_FINAL-SHIPDATE TO LV_SHIPDATE,
IT_FINAL-DEPTDATE TO LV_DEPTDATE.
CONCATENATE
STR
IT_FINAL-SLNO
IT_FINAL-OWNER
IT_FINAL-SRNO
IT_FINAL-PORT_LOAD
IT_FINAL-PORT_DSCHR
LV_NETWR
IT_FINAL-DESCRIP
IT_FINAL-CUSTNAME
IT_FINAL-BOL_NUM
LV_BOL_DATE
IT_FINAL-VESSELNAME
IT_FINAL-SHP_TYPE
IT_FINAL-SHP_MARK
LV_KAWRT
IT_FINAL-FLAG
IT_FINAL-OPEN_CONO
LV_FKDAT
IT_FINAL-VBELN
IT_FINAL-LC_WORD
IT_FINAL-QUANT
IT_FINAL-PACKDETL
IT_FINAL-INCO1
IT_FINAL-EXCWSR
LV_WAERK
LV_KURRF
IT_FINAL-ADDPAY
IT_FINAL-VESSBYR
IT_FINAL-VESSFLG
IT_FINAL-VOY_FLY_NO
LV_SHIPDATE
LV_DEPTDATE
IT_FINAL-SURCOUNT
IT_FINAL-INCO2
IT_FINAL-EXPORT_CON
IT_FINAL-SURAGT
IT_FINAL-SURADD
IT_FINAL-CONTRNO
CL_ABAP_CHAR_UTILITIES=>CR_LF INTO STR SEPARATED BY CON_TAB.
ENDLOOP.
CALL FUNCTION 'SCMS_STRING_TO_FTEXT'
EXPORTING
TEXT = STR
TABLES
FTEXT_TAB = IT_ATTACH.
ENDFORM. " BUILD_XLS_DATA_TABLE
******// form POPULATE_EMAIL_MESSAGE_BODY
FORM POPULATE_EMAIL_MESSAGE_BODY .
REFRESH IT_MESSAGE.
IT_MESSAGE = TEXT-043. " Please find attached Insurance Certificate details
APPEND IT_MESSAGE.
ENDFORM. " POPULATE_EMAIL_MESSAGE_BODY
*******'/ form SEND_FILE_AS_EMAIL_ATTACHMENT
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
* text
* -->PIT_MESSAGE text
* -->PIT_ATTACH text
* -->P_EMAIL text
* -->P_MTITLE text
* -->P_FORMAT text
* -->P_FILENAME text
* -->P_ATTDESCRIPTION text
* -->P_SENDER_ADDRESS text
* -->P_SENDER_ADDRES_TYPE text
* -->P_ERROR text
* -->P_RECIEVER text
FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES PIT_MESSAGE
PIT_ATTACH
USING P_EMAIL
P_MTITLE
P_FORMAT
P_FILENAME
P_ATTDESCRIPTION
P_SENDER_ADDRESS
P_SENDER_ADDRES_TYPE
CHANGING P_ERROR
P_RECIEVER. "#EC *
DATA: LD_ERROR TYPE SY-SUBRC, "#EC *
* LD_RECIEVER TYPE SY-SUBRC,
LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
* LD_EMAIL LIKE SOMLRECI1-RECEIVER,
LD_FORMAT TYPE SO_OBJ_TP ,
LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,
LD_ATTFILENAME TYPE SO_OBJ_DES ,
LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
LD_RECEIVER LIKE SY-SUBRC. "#EC *
* ld_email = p_email.
LD_MTITLE = P_MTITLE.
LD_FORMAT = P_FORMAT.
LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
LD_ATTFILENAME = P_FILENAME.
LD_SENDER_ADDRESS = P_SENDER_ADDRESS.
LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
* Fill the document data.
W_DOC_DATA-DOC_SIZE = 1.
* Populate the subject/generic message attributes
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
W_DOC_DATA-SENSITIVTY = 'F'.
* Fill the document data and get size of attachment
CLEAR W_DOC_DATA.
DESCRIBE TABLE IT_ATTACH LINES W_CNT.
READ TABLE IT_ATTACH INDEX W_CNT.
W_DOC_DATA-DOC_SIZE =
W_CNT * 255 + STRLEN( IT_ATTACH ).
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE.
W_DOC_DATA-SENSITIVTY = 'F'.
CLEAR T_ATTACHMENT.
REFRESH T_ATTACHMENT.
T_ATTACHMENT[] = PIT_ATTACH[].
* Describe the body of the message
CLEAR T_PACKING_LIST.
REFRESH T_PACKING_LIST.
T_PACKING_LIST-TRANSF_BIN = SPACE.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 0.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = 'raw'.
APPEND T_PACKING_LIST.
* Create attachment notification
T_PACKING_LIST-TRANSF_BIN = 'X'.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 1.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
APPEND T_PACKING_LIST.
* Add the recipients email address
CLEAR T_RECEIVERS.
REFRESH T_RECEIVERS.
LOOP AT S_EMAIL.
T_RECEIVERS-RECEIVER = S_EMAIL-LOW.
T_RECEIVERS-REC_TYPE = 'U'.
T_RECEIVERS-COM_TYPE = 'INT'.
T_RECEIVERS-NOTIF_DEL = 'X'.
T_RECEIVERS-NOTIF_NDEL = 'X'.
APPEND T_RECEIVERS.
ENDLOOP.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_DATA
PUT_IN_OUTBOX = 'X'
SENDER_ADDRESS = LD_SENDER_ADDRESS
SENDER_ADDRESS_TYPE = LD_SENDER_ADDRESS_TYPE
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL = W_SENT_ALL
TABLES
PACKING_LIST = T_PACKING_LIST
CONTENTS_BIN = T_ATTACHMENT
CONTENTS_TXT = IT_MESSAGE
RECEIVERS = T_RECEIVERS
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
* Populate zerror return code
LD_ERROR = SY-SUBRC.
* Populate zreceiver return code
LOOP AT T_RECEIVERS.
LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
ENDLOOP.
ENDFORM. " SEND_FILE_AS_EMAIL_ATTACHMENT
*******/form
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
* text
* --> p1 text
* <-- p2 text
FORM INITIATE_MAIL_EXECUTE_PROGRAM .
WAIT UP TO 2 SECONDS.
SUBMIT RSCONN01 WITH MODE = 'INT'
WITH OUTPUT = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*********end of code to trigger mail in excel format....
If any other help please let me know......
I am sure this example code will help you to resolve your problem...
please analyse above code for your requirement...
In my scenario the message you said is not displaying.....
<i>Reward Points</i>
Cheers,
Sagun Desai -
Issue with Excel Attachement in BI 7.0
Hi,
I have developed a custom report to send an e-mail with excel attachment in BI 7.0. When we are trying to open the excel sheet attachment in the e-mail. I am getting a message warning message stating that<b> 'This file is not in a recognizable format'</b>. but if we click on ok button then everything looks fine i.e the data is displaying as expected.
I have developed the same reports in SAP R/3 and SRM but I don't see any issues over there.
Can any one help me on this issue.
Thanks in advance,
Venkat BommaWhen the selection screen pops up choose the KEY only function on the TOOLS on the top right corner of the screen. Then you will be able to enter the values manually.
Hope this helps. -
How to send pdf or excel attachment as saved alv layout in email
Hi Guru,
I am developing a report in which, i am sending report as excel attachment after clicking a button on top of alv grid, and pdf attachment after clicking another button on top of alv grid. I am sending mail by two ways they are:
1) I am populating my internal table value in separate internal table and converting that to string and sending email as excel attachment.
2) And am converting report as spooljob, and using abapspool 2 pdf function module i am converting spool to pdf, after that am send that pdf as mail attachment.
Now my requirement is i need to send email attachment as layout which is displayed in the alv screen, even i hide a column and change the layout it is going with all the columns. What should i do for this problem.
Regards,
RithikaHi,
Check if the below steps will solve the problem.
* Get the run time ALV layout (field catalog) using the below method.
data: r_grid TYPE REF TO cl_gui_alv_grid.
CALL METHOD r_grid->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = t_fcat.
* Adjust the download table according to t_fcat. -
EXCEL attachment as EMAIL to USER - When USER executes REPORT in BACKGROUND
Hi Friends,
I have 10 records in Internal Table. In BACK GROUND execution, I have to send this 10 records as EXCEL attachment through EMAIL to the USER who executed in background.
How to do this? Thanks in advance.
Regards,
Viji.hi,
the following excerpt converts to excel:
REPORT ZEX_DATATOEXCEL .
Parameters: P_file like RLGRAP-FILENAME.
data : begin of int_head occurs 0,
Filed1(20) type c, " Header Data
end of int_head.
data : begin of int_data occurs 0,
Field1(20) type c, " Data
Field2(20) type c,
Field3(20) type c,
Field4(20) type c,
end of int_data.
int_head-Filed1 = 'Sales Ord'.
APPEND int_head.
CLEAR int_head.
int_head-Filed1 = 'Sold-to-Party'.
APPEND int_head.
CLEAR int_head.
int_head-Filed1 = 'Purchase Ord'.
APPEND int_head.
CLEAR int_head.
int_head-Filed1 = 'Ship-to-Party'.
APPEND int_head.
CLEAR int_head.
int_data-field1 = '1JOHN'.
int_data-field2 = '2TOM'.
int_data-field3 = '3BRAD'.
int_data-field4 = '4PETER'.
Append int_data.
Clear int_data.
CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
EXPORTING
file_name = p_file " path offile where u need to download
* CREATE_PIVOT = 0
* DATA_SHEET_NAME = ' '
* PIVOT_SHEET_NAME = ' '
* PASSWORD = ' '
* PASSWORD_OPTION = 0
TABLES
* PIVOT_FIELD_TAB =
data_tab = int_data "internal table with data
fieldnames = int_head "internal table with header
EXCEPTIONS
file_not_exist = 1
filename_expected = 2
communication_error = 3
ole_object_method_error = 4
ole_object_property_error = 5
invalid_filename = 6
invalid_pivot_fields = 7
download_problem = 8
OTHERS = 9
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
got it from
http://abaplovers.blogspot.com/2008/05/abap-internal-table-to-excel-sheet.html.
then you can export to spool and mail it.
ags. -
Send Email with Excel attachment with formatting(bold, color) in Background
Hi,
I have requirement wherein I have to send an email with excel attachment with proper formatting of certain fields in the excel sheet like making it bold or setting different color. The data is available in an internal table. Just to to format it and send an email when the program is executed in background mode.
Any pointers on this would be highly appreciated!
Thanks,
Anil.I resolved my own problem using the BCS_EXAMPLE_7 program as sample.
Maybe you are looking for
-
What gets wiped out if I sync my phone to iTunes
Sorry for starting a new thread with this. It is really a followup/clarification to another post, but that one won't let me reply/comment In https://discussions.apple.com/docs/DOC-3141 wjosten wrote: By design, the iPhone will sync iTunes content wit
-
Apple Video Adapter / Firewire Out Thru Camera
Hello, Could someone explain in somewhat technical detail the difference between playing your timeline out to a TV, through the Video Adapter as compared to Firewire out thru a camera. I didn't own a TV - I only watch films on my wall with a projecto
-
IPod music lost after upgrading to iOS 8.3
I own a 5th generation iPod touch. When I connected to my computer the iTunes prompted me to update to the latest iOS available i.e., 8.3 and I accepted it. In the process it downloaded the software and restarted my iPod but somewhere in that process
-
QUESTION from an American in India: How do I find the screen with my personal iPod (my name's iPod) so I can download from my purchased or free songs/pods from my computer? My iPod has opened to that for 3 years and this week I can't find it: not on
-
How to update Logic Pro 9 to Logic Pro X..!
I bought the App. (Logic Pro V.9) in April. I'm trying to update it to the V.10 (Logic Pro X) , but i had been asked to re-buy the App..! Please, advise how to update..! by the way, i already updated My MacBook Pro to OS X Mavericks Regards,