Excel attachment in mailing program
Hi,
I am sending excel attachment in the mailing program.
The attachment contains 56 lines, but the problem is the attachment which is coming with 22 line only in mail .
What may be the problem?
Regards,
Please debug and check the internal table before the Mail FM, whether all lines are there.
Similar Messages
-
My computer is running slow after Yosemite install -but in the Mail program, when I open an email and then open the attachment -all is good -when I close the attachment the Mail program goes away, and I have to reopen it in my Dock -every time.
I tried this, but no luck. I went to Previous System>Users. There is nothing inside the "Users" folder, so I hit a dead end.
I can find my new e-mails -- those that came in since I re-installed the system -- in my NEW system (which I did to see if I was correctly understanding the advice), by going to Users>Home>Library>Mail>POP account name>Inbox.
Let me add a new question: I am running PhotoShop C3. It opens OK, and I can use it, but when it opens I get this message: "One or more files for Adobe Application Support folder are missing. Please re-run the PhotoShop installer."
I don't like re-installing working programs if I can avoid it, because it always seems to lead to other issues. Any idea what files are missing, and where it/they might be in the Previous System folder?
thanks
Mike -
Hi all,
I have an issue in sending mail as an excel attachment .
i am getting some records in the excel sheet as single line and some are coming correctly. here is the sample code.
ie. some records coming line by line, but some record for eg the 6th and 7th record is coming in the 6th line only .here is the coding part for that
CONCATENATE ' '
I_SHIP_HEAD-TKNUM
L_DATEB
VD
I_SHIP_HEAD-EXTI1
I_SHIP_HEAD-TPBEZ
I_SHIP_HEAD-SIGNI
I_SHIP_HEAD-EXTI2
L_NETWR
L_DMBTR
I_SHIP_HEAD-TNDR_TRKID
MODE
L_ALLOWED_TWGT
I_INV-VBELN
L_INVDAT
I_INV-VSTEL
I_INV-KUNRG
L_ETADATE
I_INV-SPART
I_INV-MATNR
I_INV-ARKTX
I_INV-MATKL
L_FKIMG
L_WT
L_VOL
L_DIFFVAL
CON_CRET
INTO I_BIN SEPARATED BY CON_TAB.
APPEND I_BIN .
CLEAR I_BIN.
suggest me a solution.
Thanks & Regards
Magesh AnandanHi,
check the following sample program and also its easy to understand.
REPORT zvenkat_mail_xls_attach.
" Data retrieval related declarations
TYPES:
BEGIN OF t_emp_dat,
pernr TYPE pa0001-pernr,
persg TYPE pa0001-persg,
persk TYPE pa0001-persk,
plans TYPE pa0001-plans,
stell TYPE pa0001-stell,
END OF t_emp_dat.
DATA:
w_emp_data TYPE t_emp_dat.
DATA:
i_emp_data TYPE STANDARD TABLE OF t_emp_dat.
" Mail related declarations
"Variables
DATA :
g_sent_to_all TYPE sonv-flag,
g_tab_lines TYPE i.
"Types
TYPES:
t_document_data TYPE sodocchgi1,
t_packing_list TYPE sopcklsti1,
t_attachment TYPE solisti1,
t_body_msg TYPE solisti1,
t_receivers TYPE somlreci1.
"Workareas
DATA :
w_document_data TYPE t_document_data,
w_packing_list TYPE t_packing_list,
w_attachment TYPE t_attachment,
w_body_msg TYPE t_body_msg,
w_receivers TYPE t_receivers.
"Internal Tables
DATA :
i_document_data TYPE STANDARD TABLE OF t_document_data,
i_packing_list TYPE STANDARD TABLE OF t_packing_list,
i_attachment TYPE STANDARD TABLE OF t_attachment,
i_body_msg TYPE STANDARD TABLE OF t_body_msg,
i_receivers TYPE STANDARD TABLE OF t_receivers.
"Start-of-selection.
START-OF-SELECTION.
PERFORM get_data.
PERFORM build_xls_data_table.
"End-of-selection.
END-OF-SELECTION.
PERFORM send_mail.
"Form get_data from PA0001
FORM get_data.
SELECT pernr
persg
persk
plans
stell
FROM pa0001
INTO CORRESPONDING FIELDS OF TABLE i_emp_data
UP TO 4 ROWS.
ENDFORM. " get_data
"Form build_xls_data_table
FORM build_xls_data_table.
"If you have Unicode check active in program attributes then
"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 'PERNR' 'PERSG' 'PERSK' 'PLANS' 'STELL'
INTO w_attachment
SEPARATED BY con_tab.
CONCATENATE con_cret
w_attachment
INTO w_attachment.
APPEND w_attachment TO i_attachment.
CLEAR w_attachment.
LOOP AT i_emp_data INTO w_emp_data.
CONCATENATE w_emp_data-pernr
w_emp_data-persg
w_emp_data-persk
w_emp_data-plans
w_emp_data-stell
INTO w_attachment
SEPARATED BY con_tab.
CONCATENATE con_cret w_attachment
INTO w_attachment.
APPEND w_attachment TO i_attachment.
CLEAR w_attachment.
ENDLOOP.
ENDFORM. "build_xls_data_table
"Form send_mail
"PACKING LIST
"This table requires information about how the data in the
"tables OBJECT_HEADER, CONTENTS_BIN and CONTENTS_TXT are to
"be distributed to the documents and its attachments.The first
"row is for the document, the following rows are each for one
"attachment.
FORM send_mail .
"Subject of the mail.
w_document_data-obj_name = 'MAIL_TO_HEAD'.
w_document_data-obj_descr = 'Regarding Mail Program by SAP ABAP'.
"Body of the mail
PERFORM build_body_of_mail
USING:space,
'Hi,',
'I am fine. How are you? How are you doing ? ',
'This program has been created to send simple mail',
'with Subject,Body with Address of the sender. ',
'Regards,',
'Venkat.O,',
'SAP HR Technical Consultant.'.
"Write Packing List for Body
DESCRIBE TABLE i_body_msg LINES g_tab_lines.
w_packing_list-head_start = 1.
w_packing_list-head_num = 0.
w_packing_list-body_start = 1.
w_packing_list-body_num = g_tab_lines.
w_packing_list-doc_type = 'RAW'.
APPEND w_packing_list TO i_packing_list.
CLEAR w_packing_list.
"Write Packing List for Attachment
w_packing_list-transf_bin = 'X'.
w_packing_list-head_start = 1.
w_packing_list-head_num = 1.
w_packing_list-body_start = 1.
DESCRIBE TABLE i_attachment LINES w_packing_list-body_num.
w_packing_list-doc_type = 'XLS'.
w_packing_list-obj_descr = 'Excell Attachment'.
w_packing_list-obj_name = 'XLS_ATTACHMENT'.
w_packing_list-doc_size = w_packing_list-body_num * 255.
APPEND w_packing_list TO i_packing_list.
CLEAR w_packing_list.
"Fill the document data and get size of attachment
w_document_data-obj_langu = sy-langu.
READ TABLE i_attachment INTO w_attachment INDEX g_tab_lines.
w_document_data-doc_size = ( g_tab_lines - 1 ) * 255 + STRLEN(
w_attachment ).
"Receivers List.
w_receivers-rec_type = 'U'. "Internet address
w_receivers-receiver = '[email protected]'.
w_receivers-com_type = 'INT'.
w_receivers-notif_del = 'X'.
w_receivers-notif_ndel = 'X'.
APPEND w_receivers TO i_receivers .
CLEAR:w_receivers.
"Function module to send mail to Recipients
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_document_data
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = g_sent_to_all
TABLES
packing_list = i_packing_list
contents_bin = i_attachment
contents_txt = i_body_msg
receivers = i_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.
IF sy-subrc = 0 .
MESSAGE i303(me) WITH 'Mail has been Successfully Sent.'.
ELSE.
WAIT UP TO 2 SECONDS.
"This program starts the SAPconnect send process.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
ENDFORM. " send_mail
" Form build_body_of_mail
FORM build_body_of_mail USING l_message.
w_body_msg = l_message.
APPEND w_body_msg TO i_body_msg.
CLEAR w_body_msg.
ENDFORM. " build_body_of_mail
I hope that it helps you something.
Regards,
Venkat.O -
Send an Excel Attachment as mail to a list of recipients
Hello Everyone,
I am trying to send an email with an excel attachment. My code has been activated successfully. But I haven't received any mail.
Kindly help.
My code is as below.
FORM Z_SENDMAIL .
DATA lv_receiver type SOMLRECI1-RECEIVER.
TYPES: BEGIN OF LTS_CHARFINAL,
matnr(18) type c,
maktx(40) type c,
idnlf(35) type c,
ltsnr(6) type c,
werks(4) type c,
ltsbz(20) type c,
ernam(12) type c,
verpr(11) type c,
soh_qty(13) TYPE c,
int_qty(13) TYPE c,
ext_soh(11) TYPE c,
hol_qty(13) TYPE c,
all_qty(13) TYPE c,
bac_qty(13) TYPE c,
ext_ttl(11) TYPE c,
END OF LTS_CHARFINAL.
DATA: WA_CHARFINAL TYPE LTS_CHARFINAL.
lv_receiver = '[email protected]'.
CONCATENATE 'ITEM_TRIM'
'DESCRIPTION'
'VEND_ITEM'
'PLNRCODE'
'LOCATION'
'SITE'
'PLANNER'
'AVERAGE_COST'
'SOH_QTY'
'INTRANS_QTY'
'EXT_COST_SOH'
'HOLD_QTY'
'ALLOC_QTY'
'BACKORD_QTY'
'EXT_COST_TTL_INVEN'
INTO IT_ATTACH SEPARATED BY CON_TAB.
CONCATENATE CON_CRET IT_ATTACH INTO IT_ATTACH.
APPEND IT_ATTACH.
LOOP AT GIT_FINAL INTO GWA_FINAL.
wa_charfinal-matnr = gwa_final-matnr.
wa_charfinal-maktx = gwa_final-maktx.
wa_charfinal-idnlf = gwa_final-idnlf.
wa_charfinal-ltsnr = gwa_final-ltsnr.
wa_charfinal-werks = gwa_final-werks.
wa_charfinal-ltsbz = gwa_final-ltsbz.
wa_charfinal-ernam = gwa_final-ernam.
wa_charfinal-verpr = gwa_final-verpr.
wa_charfinal-soh_qty = gwa_final-soh_qty.
wa_charfinal-int_qty = gwa_final-int_qty.
wa_charfinal-ext_soh = gwa_final-ext_soh.
wa_charfinal-hol_qty = gwa_final-hol_qty.
wa_charfinal-all_qty = gwa_final-all_qty.
wa_charfinal-bac_qty = gwa_final-bac_qty.
wa_charfinal-ext_ttl = gwa_final-ext_ttl.
CONCATENATE wa_charfinal-matnr
wa_charfinal-maktx
wa_charfinal-idnlf
wa_charfinal-ltsnr
wa_charfinal-werks
wa_charfinal-ltsbz
wa_charfinal-ernam
wa_charfinal-verpr
wa_charfinal-soh_qty
wa_charfinal-int_qty
wa_charfinal-ext_soh
wa_charfinal-hol_qty
wa_charfinal-all_qty
wa_charfinal-bac_qty
wa_charfinal-ext_ttl
INTO IT_ATTACH SEPARATED BY CON_TAB.
CONCATENATE CON_CRET IT_ATTACH INTO IT_ATTACH.
APPEND IT_ATTACH.
ENDLOOP.
PERFORM Z_BUILD_MESSAGE.
PERFORM Z_SEND_FILE_ATTACHMENT
TABLES IT_MESSAGE
IT_ATTACH
USING lv_receiver
'Example .xls documnet attachment'
'XLS'
'filename'
CHANGING GD_ERROR
GD_RECIEVER.
ENDFORM.
FORM Z_BUILD_MESSAGE .
REFRESH IT_MESSAGE.
IT_MESSAGE = 'Please find the attached document'.
APPEND IT_MESSAGE.
ENDFORM. " Z_BUILD_MESSAGE
FORM Z_SEND_FILE_ATTACHMENT TABLES P_IT_MESSAGE
P_IT_ATTACH STRUCTURE IT_ATTACH
USING P_lv_receiver
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_LV_RECEIVER.
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[] = P_IT_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. " Z_SEND_FILE_ATTACHMENT
-Regards
MonicaHi Monica,
Please check with your BASIS team if all the required configurations are there to send mail.
You can check in SOST transaction if you have an entry there for your mail.
Another relevant transaction in SCOT.
Regards,
Santanu. -
Large Mail Attachment Affecting Mail Program
I have an IMac G5 and use the mail program that came with OS X. The other day I attached a very large movie file to an email I wanted to send to my sister but stupidly, I forgot to compress the movie. I sent the email message but it is now suspended in the "OUT" box and completely slows down my computer and renders the mail program unusable due to its size.
I've tried deleting the file and email, and even though it says I have, every time I force quit and come back, the file is right back in the "out" box. The little circle keeps spinning indicating that it's working but nothing happens. HOW DO I EXPONGE THIS MISTAKE FROM MY MAIL AND GET MY COMPUTER AND MAIL PROGRAM WORKING REGULARLY AGAIN?
Please help!
G5 Imac Mac OS X (10.4)With the Mail.app quit and using the Finder, go to Home > Library > Mail > Mailboxes > Outbox.mbox.
Delete the Outbox.mbox folder and empty the Trash.
Launch Mail and a new Outbox.mbox folder will be created automatically within the Mailboxes folder and this should resolve the problem.
Depending on the size of the pre-encoded file, the Mail.app uses MIME 1.0 for attachment encoding which is the internet standard. The encoding process increases the size of the pre-encoded file by 50% or so. A 5MB file (pre-encoded) will be roughly 7.5MB after the encoding process.
Most ISPs and email account providers have limits on the overall size of incoming and sent messages. As an example, a .Mac account has a 10MB overall message size limit for incoming and sent messages and most ISPs and email account providers have similar limits so you need to check on this limit with your ISP or email account provider and the same with the recipient's ISP or email account provider before sending such a large file via email.
Something else to consider which I'm sure you are aware but just in case, if you can send a 20MB file (encoded size) and the recipient's incoming mail server accepts a message this large for example (which isn't likely) but the recipient has a limited amount of available incoming mail server storage space and the 20MB message exceeds the recipient's server storage space limit, the message will be rejected by the server. -
Read Excel attachment from mail
Hi,
Will be happy to know the inputs for the below specific requirement,
Step 1 : User will get an email into SAPinbox with an excel or text file as attachment.
Step 2 : Then a background <b>(automatic)</b> program should read the mail including the attached file.
Step 3 : Program should extract and data from excel file then execute some business process.
Any inputs will be highly helpful.
Regards
ManoharHi Manohar,
The mail which comes into SAP Inbox with say .xls file, when the attachment is selected, SAP downloads that .xls file to your presentation server and the same is opened through EXCEL.
If the path and filename is fixed, you can write a program which calls FM SO_OBJECT_UPLOAD, get the data, and do the processing of the same.
Regards,
Raj -
Arabic text in excel attachment in mail
my requirement is to mail the excel file so I used the internal table
to create an excel and used FM SO_NEW_DOCUMENT_ATT_SEND_API1, While the
excel file is created but however the arabic is not downloaded
correctly. It is downloaded with junk characters.
CONSTANTS:y_k_con_tab TYPE c VALUE
cl_abap_char_utilities=>horizontal_tab,
y_k_con_cret TYPE c VALUE
cl_abap_char_utilities=>cr_lf.
LOOP AT lt_output INTO ls_output.
MOVE ls_output-zdate_changed TO lv_datechanged.
MOVE ls_output-zdate_created TO lv_datecreated.
CONCATENATE ''''
lv_datechanged
INTO lv_datechanged.
CONCATENATE ''''
lv_datecreated
INTO lv_datecreated.
*Concatenate text fields to send the email in the r=uired format.
CONCATENATE ls_output-zexcess
ls_output-zbranch
ls_output-znotes
ls_output-zstatus
lv_datechanged
ls_output-zdate_changed
ls_output-zemp_changed
ls_output-zinitial_status
lv_datecreated
ls_output-zdate_created
ls_output-zemp_created
ls_output-zproduct_name
ls_output-zministry_name
ls_output-zentity_name
ls_output-zposting_date
ls_output-zservice_id
INTO y_wa_htop_new SEPARATED BY y_k_con_tab .
CONCATENATE y_k_con_cret
y_wa_htop_new
INTO y_wa_htop_new .
APPEND y_wa_htop_new TO y_i_htop_new.
CLEAR: y_wa_htop_new.
ENDLOOP.
*ENDLOOP.
i_attachment] = y_i_htop_new[.
SUBJECT OF THE MAIL.
w_document_data-obj_name = 'MAIL_TO_HEAD'.
w_document_data-obj_descr = text-001.
BODY OF THE MAIL
w_body_msg = text-002.
APPEND w_body_msg TO i_body_msg.
CLEAR w_body_msg.
w_body_msg = space.
APPEND w_body_msg TO i_body_msg.
CLEAR w_body_msg.
w_body_msg = text-003.
APPEND w_body_msg TO i_body_msg.
CLEAR w_body_msg.
w_body_msg = space.
APPEND w_body_msg TO i_body_msg.
CLEAR w_body_msg.
w_body_msg = text-004.
APPEND w_body_msg TO i_body_msg.
CLEAR w_body_msg.
w_body_msg = space.
APPEND w_body_msg TO i_body_msg.
CLEAR w_body_msg.
w_body_msg = text-005.
APPEND w_body_msg TO i_body_msg.
CLEAR w_body_msg.
WRITE PACKING LIST FOR BODY
DESCRIBE TABLE i_body_msg LINES g_tab_lines.
*describe table i_attachment lines g_tab_lines.
w_packing_list-head_start = 1.
w_packing_list-head_num = 0.
w_packing_list-body_start = 1.
w_packing_list-body_num = g_tab_lines.
w_packing_list-doc_type = 'RAW'.
APPEND w_packing_list TO i_packing_list.
CLEAR w_packing_list.
WRITE PACKING LIST FOR ATTACHMENT
w_packing_list-transf_bin = 'X'.
w_packing_list-head_start = 1.
w_packing_list-head_num = 1.
w_packing_list-body_start = 1.
DESCRIBE TABLE i_attachment LINES w_packing_list-body_num.
w_packing_list-doc_type = 'XLS'.
w_packing_list-obj_descr = 'Service_Details'.
w_packing_list-obj_name = 'Service_Details'.
w_packing_list-OBJ_LANGU = 'A'.
w_packing_list-doc_size = w_packing_list-body_num * 255.
APPEND w_packing_list TO i_packing_list.
CLEAR w_packing_list.
FILL THE DOCUMENT DATA &GET SIZE OF ATTACHMENT
w_document_data-obj_langu = sy-langu.
READ TABLE i_attachment INTO w_attachment INDEX g_tab_lines.
w_document_data-doc_size = ( g_tab_lines - 1 ) * 255 + STRLEN(
w_attachment ).
RECEIVERS LIST.
w_receivers-rec_type = 'U'. "Internet address
w_receivers-receiver = y_lv_emailid.
w_receivers-com_type = 'INT'.
w_receivers-notif_del = 'X'.
w_receivers-notif_ndel = 'X'.
APPEND w_receivers TO i_receivers .
CLEAR:w_receivers.
SEND MAILS TO RECIPIENTS
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_document_data
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = g_sent_to_all
TABLES
packing_list = i_packing_list
contents_bin = i_attachment
contents_txt = i_body_msg
receivers = i_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.
IF sy-subrc = 0 .
*MESSAGE s WITH 'Mail has been Successfully Sent.'.
ENDIF.
Kindly suggest how will I get arabic downloaded and sent as attachment
in email. Can I write a file to application server and send that
particular file as attachement? Can I use BCS class for mailing excel
file? Will it support arabic text?with Excel it is always a good idea to encode your data in UTF-16 LE.
to do so, take your internal table in SOLI format and call
CL_BCS_CONVERT=>TXT_TO_SOLIX
with iv_codepage = 4103 and iv_add_bom = 'X'.
you will get a binary table SOLIX as a result and just have to attach it to your message -
Hi,
I have done a script within Automator that does take filtered information in one Excel-file and copy it to another and close it. I choose a name for it and saves it. Could I get it to automatically attach this file inside a mail document in Mail.app and let me send it manually?
I also would like it to automatically uncheck 1904 Date option inside Excel prefs.If you know the name of the workbook, then add this applescript to the workflow, while the file is still open.on run {input, parameters}
tell application "Microsoft Excel"
set the date 1904 of workbook "Sheet1" to not the date 1904 of workbook "Sheet1"
send mail workbook "Sheet1"
end tell
return input
end runSubstitute the name of the workbook for Sheet1
I couldn't get any of the excel actions to pass the name into the Applescript action.
As for emailing, I can't get Excel to pass any of it's action results onto anything but it's own actions. They don't seem to be very well written. Normally, you'd just add a "New Mail Message" action after something and the output from the previous action would be the content for the new mail message.
Due to Microsoft's shortcomings, there doesn't seem to be a way to do that without using the "send mail" function in Excel's Applescript dictionary.
If you need to do more Applescripting of Excel (or Office), see the [VBA to Applescript Transition Guide|http://www.mactech.com/vba-transition-guide>. It is geared towards converting from VBA to Applescript, but it has many examples of how to automate various tasks.
Message was edited by: Barney-15E -
Query regarding Excel attachment to mail
Hi all,
I am passing spool no. and download path to 'RSPO_DOWNLOAD_SPOOLJOB' to the function module. I am getting the file stored at specified path in 'RAW' format. Now using GUI_UPLOAD to get the excel file data into internal table i_texts.
This excel gets attached to the mail. Since data is in RAW format, I have to pick line by line data. So I am not able to get the data column by column and data appended to the attached mail as line by line. So data redability at column level is not there.
If someone has worked on this type of requirement to get the spool no. data convertd to excel format and attached as an mail.
Please suggest your solutions regarding this...
regards,
Brijesh Patelhi,<b>
first save the excel file as tabdelimited file </b>
Try using GUI_UPLOAD in this way
V_FILENAME = P_FILE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = V_FILENAME
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = '|'
TABLES
DATA_TAB = ITAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17.
Regards,
Santosh
Message was edited by: Santosh -
Sending Excel attachment in E-mail
Hi All,
I am sending excel attachment in mail, when I see in SO01 tcode I am able to see the attachment in outbox, but getting 'Error during send Process' in sent status and not getting any mails to my e-mail id.
Could you any one help me in this?
Thanks in advance.
Vijaya.Hi,
data: p_email type somlreci1-receiver
value 'Mail ID'.
data: begin of it001 occurs 0,
bukrs type t001-bukrs,
butxt type t001-butxt,
end of it001.
data: imessage type standard table of solisti1 with header line,
iattach type standard table of solisti1 with header line,
ipacking_list like sopcklsti1 occurs 0 with header line,
ireceivers like somlreci1 occurs 0 with header line,
iattachment like solisti1 occurs 0 with header line.
start-of-selection.
select bukrs butxt into table it001 from t001.
Populate table with detaisl to be entered into .xls file
perform build_xls_data .
Populate message body text
clear imessage. refresh imessage.
imessage = 'Please find attached excel file'.
append imessage.
Send file by email as .xls speadsheet
perform send_email_with_xls tables imessage
iattach
using p_email
'Example Excel Attachment'
'XLS'
'TestFileName'
'CompanyCodes'.
Form BUILD_XLS_DATA
form build_xls_data .
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 'BUKRS' 'BUTXT'
into iattach separated by con_tab.
concatenate con_cret iattach into iattach.
append iattach.
loop at it001 .
concatenate it001-bukrs it001-butxt
into iattach separated by con_tab.
concatenate con_cret iattach into iattach.
append iattach.
endloop .
endform.
Form SEND_EMAIL_WITH_XLS
form send_email_with_xls tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription.
data: xdocdata like sodocchgi1,
xcnt type i.
Fill the document data.
xdocdata-doc_size = 1.
Populate the subject/generic message attributes
xdocdata-obj_langu = sy-langu .
xdocdata-obj_name = 'SAPRPT' .
xdocdata-obj_descr = p_mtitle .
Fill the document data and get size of attachment
clear xdocdata.
read table iattach index xcnt.
xdocdata-doc_size =
( xcnt - 1 ) * 255 + strlen( iattach ).
xdocdata-obj_langu = sy-langu.
xdocdata-obj_name = 'SAPRPT'.
xdocdata-obj_descr = p_mtitle.
clear iattachment. refresh iattachment.
iattachment[] = pit_attach[].
Describe the body of the message
clear ipacking_list. refresh ipacking_list.
ipacking_list-transf_bin = space.
ipacking_list-head_start = 1.
ipacking_list-head_num = 0.
ipacking_list-body_start = 1.
describe table imessage lines ipacking_list-body_num.
ipacking_list-doc_type = 'RAW'.
append ipacking_list.
Create attachment notification
ipacking_list-transf_bin = 'X'.
ipacking_list-head_start = 1.
ipacking_list-head_num = 1.
ipacking_list-body_start = 1.
describe table iattachment lines ipacking_list-body_num.
ipacking_list-doc_type = p_format.
ipacking_list-obj_descr = p_attdescription.
ipacking_list-obj_name = p_filename.
ipacking_list-doc_size = ipacking_list-body_num * 255.
append ipacking_list.
Add the recipients email address
clear ireceivers. refresh ireceivers.
ireceivers-receiver = p_email.
ireceivers-rec_type = 'U'.
ireceivers-com_type = 'INT'.
ireceivers-notif_del = 'X'.
ireceivers-notif_ndel = 'X'.
append ireceivers.
call function 'SO_DOCUMENT_SEND_API1'
exporting
document_data = xdocdata
put_in_outbox = 'X'
commit_work = 'X'
tables
packing_list = ipacking_list
contents_bin = iattachment
contents_txt = imessage
receivers = ireceivers
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.
Check this Sample code.
Thanks,
Durai.V -
Long text in mail as excel attachment
Hi Experts,
I am sending internal table as excel attachment in mail through Function Module - SO_DOCUMENT_SEND_API1.
But there is one field with long text. Pls help me how to send long text in excel sheet as mail attachment.
Regards,
Reny RichardHi,
And do your self a favor and use CL_BCS instead of SO_DOCUMENT_SEND_API1 .
See Send email from ABAP with class CL_BCS - Code Gallery - SCN Wiki
See Re: Excel formating in email attachment without using XML.
Use "where use" for class CL_BCS .
Regards. -
How to handle more than 250 characters in excel attachment
hi,
i lokesh, actually i am sending a excel attachment through mail. i am using " SO_DOCUMENT_SEND_API1" function module, one problem what i facing is , this function module handle only 250 characters, i need to display more than 250 characters. pls any one knows about this, pls let me know.
regards
lokesh tHi,
Xls allows only 250 char.
Cheers -
Hello,
I have to send an email in a workflow step with a excel attach from an internal table, Does anyone have any sugestion ?
Thanks,
DiegoHi,
Check this [thread1|send excel attachment as email; [thread2|Re: Excel attachment in SO_DOCUMENT_SEND_API1; & [thread3|Help needed for the Excel attachment to mail;.
Regards,
Surjith -
Mail program doesn't stop sending
Since I tried to send a mail with a large attachment, the mail program doesn't stop sending any more. Every time I start the mail program it goes immediately into the sending mode and I can't do or select anything anymore. Anybody out there with a good idea?
when it fails, doesn't it eventually give an option to Try Later or Edit message?
If the later choose that & delete the attachment, then close that window.
Have you tried disconnecting from the Internet & see if you can stop it & trash that file? -
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.
Maybe you are looking for
-
How to print PeopleSoft page in the landscape mode automatically???
hi We have a requirement from the client, who wants to get it implemented urgently. The peopletools version is 8.16 and appversion is 8.0 The requirement is as follows:Whenever the user prints on the Print button on a page, the page should get printe
-
What would make my Cp7 course get hung up during the loading process when launching on LMS?
In Cp7, I created a SCORM project to post on our LMS and submitted it for testing. Our LMS department confirmed it worked successfully, and in fact I tested it myself – it worked great. However, my work team asked me to make some changes to the conte
-
Update for itouch 1g to iOS 4.
How can i Update my itouch 1g to iOS 4, because Nancy Apps doesn't work under iOS 3.1.3
-
Is there a breeze export option that defines the maximum opening resolution of the browser ?
Hi, The maximum resolution of a breeze presentation slide is 720 x 540 correct? Does anyone know if there is a way to prevent that a breeze presentation gets too big when it is opened in a big resolution screen? What I'm asking is if there is a breez
-
Won't allow me to send emails from one email account
Firstly my z10 won't allow me to send wails from my website email address (my website is with mr site) my last bob worked fine with no issues it was a torch 9800. Mr site say it's not them but suggest I can register with a server company, I checked t