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
Manohar
Hi 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
Similar Messages
-
Error while reading excel file from application server into internal table.
Hi experts,
My requirement is to read an excel file from application server into internal table.
Hence I have created an excel file fm_test_excel.xls in desktop and uploaded to app server using CG3Z tcode (as BIN file type).
Now in my program I have used :
OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
DO.
READ DATASET v_filename INTO wa_tab.
The statement OPEN DATASET works fine but I get a dump (conversion code page error) at READ DATASET statement.
Error details:
A character set conversion is not possible.
At the conversion of a text from codepage '4110' to codepage '4103':
- a character was found that cannot be displayed in one of the two
codepages;
- or it was detected that this conversion is not supported
The running ABAP program 'Y_READ_FILE' had to be terminated as the conversion
would have produced incorrect data.
The number of characters that could not be displayed (and therefore not
be converted), is 445. If this number is 0, the second error case, as
mentioned above, has occurred.
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was not
caught and
therefore caused a runtime error.
The reason for the exception is:
Characters are always displayed in only a certain codepage. Many
codepages only define a limited set of characters. If a text from a
codepage should be converted into another codepage, and if this text
contains characters that are not defined in one of the two codepages, a
conversion error occurs.
Moreover, a conversion error can occur if one of the needed codepages
'4110' or '4103' is not known to the system.
If the conversion error occurred at read or write of screen, the file
name was '/usr/sap/read_files/fm_test_excel.xls'. (further information about
the file: "X 549 16896rw-rw----201105170908082011051707480320110517074803")
Also let me know whether this is the proper way of reading excel file from app server, if not please suggest an alternative .
Regards,
KarthikHi,
Try to use OPEN DATASET v_filename FOR INPUT IN BINARY mode encoding default. instead of OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
As I think you are uploading the file in BIN format to Application server and trying to open text file.
Regards,
Umang Mehta -
When I open a word document attachment in mail for IOS 7.1.1 the previous jpeg is showing on the first page. When I open the attachment from mail in mac OS X the jpeg does not appear. Can anyone help?
gonsa47 wrote:
When I open it in pages or word the correct company logo appears.
Does the mail app display whatever is in the document without the ability to differentiate between hidden or non hidden images?
The mail app will not display fillable form fields in PDF files that can be seen in real PDF apps. I say real PDF apps because the form fields in PDF apps will not appear in the iBooks app either. IMO, iBooks is not a real PDF app.
So, I would say that the mail app cannot differentiate between hidden and non hidden items -
Reading excel sheet from out side of the server though sql developer.
Hi ALL,
Is it possible to read the excel sheet from the out side of the oracle server.
If it possible please send me the sample code.Duplicate thread.
Reading excel sheet from local system though sql developer
Also a FAQ
SQL and PL/SQL FAQ -
Pdf attachment from mail to ibooks?
hmm, how do you 'import' pdf attachment from mail into ibooks 1.1? i hit downloaded on iphone mail, it loaded with img, not even a pdf. flip back to ibooks, hit pdf tab, its not there. am i missing something here?
thanks guys
Message was edited by: Tran Hoang LongI have the latest version of iTunes with iBooks, and it doesn't have anywhere to drag PDF files into iTunes. Where are you seeing this? I tried every imaginable PDF, include a text document, I printed to PDF from textedit, then dragging it into the pane of grayed out books in iTunes.
What gives?
Here's a screenshot:
http://drp.ly/1eMh5M -
Help read excel path from forms 4.5
i have trigger on when-button-pressed which opens excel file whit HOST like
host('"C:\Program Files\Microsoft Office\OFFICE11\excel.exe" '||cFileName);
My question is: How to read excel path from forms 4.5 whitout any utility or extra pll, because excel.exe is not always on path C:\Program Files\Microsoft Office\OFFICE11
thanksStoring the path of excel in some kind of file or db-table is not a good solution, for this may change with any version of excel.
Let the operating system decide on its on, just call
HOST('rundll32.exe url.dll, FileProtocolHandler "' || vcFile || '"');
where vcFile is the file you want to open -
Email XLS excel attachment from ABAP
Hi,
I am trying to email an excel attachment from ABAP, but when I open in excel, it says not a recognizable format, but when I click OK it does open as a tab-delimited file and look OK.
Any ideas please?Hi,
Please check this link
http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
aRs -
Sending external mail with excel attachment from SAP
Hi All,
I am trying to send a external mail from SAP. Mail is getting posted correctly with attachment having type excel. If attach file has more than 1 records then in mail it is coming in a single lines. it is not getting wrap.
e.g. my attach internal table has records like LINE1
LINE2
LINE3
output in attach excel file is : LINE1 LINE2 LINE3
in attach file it should come line by line.
source code of my function module is as follows :
FUNCTION ZXI_SEND_MAIL_WITH_ATTACHMENT.
""Local Interface:
*" IMPORTING
*" REFERENCE(SUBJECT) TYPE SO_OBJ_DES OPTIONAL
*" REFERENCE(ATTACH_NAME1) TYPE SOOD-OBJDES
*" REFERENCE(EXT1) TYPE SOODK-OBJTP
*" REFERENCE(MAIL_ID) TYPE ADR6-SMTP_ADDR
*" TABLES
*" IT_CONTENT TYPE SOLI_TAB OPTIONAL
*" IT_ATTACH TYPE SOLI_TAB OPTIONAL
DATA: send_request TYPE REF TO cl_bcs.
DATA: document TYPE REF TO cl_document_bcs.
DATA: sender TYPE REF TO cl_sapuser_bcs.
DATA: recipient TYPE REF TO if_recipient_bcs.
DATA: exception_info TYPE REF TO if_os_exception_info,
bcs_exception TYPE REF TO cx_document_bcs.
DATA i_attachment_size TYPE sood-objlen.
Creates persistent send request
send_request = cl_bcs=>create_persistent( ).
TRY.
*****Create txt mail document**************************
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = it_content[]
i_subject = subject ).
**************Creates Attachment 1***********************
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = ext1
i_attachment_subject = attach_name1
i_att_content_text = it_attach[].
Add document to send request
CALL METHOD send_request->set_document( document ).
Get sender object
sender = cl_sapuser_bcs=>create( sy-uname ).
Add sender
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
recipient = cl_cam_address_bcs=>create_internet_address(
i_address_string = mail_id ).
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'U'
i_copy = ' '
i_blind_copy = ' '
i_no_forward = ' '.
**********Trigger e-mails immediately****************************
send_request->set_send_immediately( 'X' ).
CALL METHOD send_request->send( ).
COMMIT WORK.
CATCH cx_document_bcs INTO bcs_exception.
ENDTRY.
ENDFUNCTION.
please suggest me a solution and thanks in advance.
Thanks&Regards,
SachinSee the sample code for sending attachment as Mail
Mailing with Attachment by ABAP Coding
Refer this link:
Mail with attachment.
FORM send_list_to_basis .
DATA: w_path LIKE rlgrap OCCURS 0 WITH HEADER LINE,
lt_index TYPE sy-tabix,
doc_type(3) TYPE c,
descr LIKE it_objpack_basis-obj_descr,
temp_data LIKE w_path,
temp1 TYPE string,
tab_lines TYPE i,
langu(15) TYPE c,
expirydate TYPE so_obj_edt,
L_FILE1(100).
CONCATENATE 'C:\' sy-repid '_' sy-datum '.XLS' INTO L_FILE1.
W_PATH-FILENAME = L_FILE1.
APPEND w_path.
CLEAR w_path.
wa_doc_chng-obj_descr = 'User List not logged on for 180 days'.
wa_doc_chng-obj_langu = 'E'.
wa_doc_chng-obj_expdat = sy-datum.
CLEAR w_subject.
CONCATENATE 'Please find attached document with list of users'
'not logged on for 180 days for client' sy-mandt
INTO w_subject SEPARATED BY space.
it_objtxt_basis-line = w_subject.
APPEND it_objtxt_basis.
CLEAR it_objtxt_basis.
it_objtxt_basis-line = text-004.
APPEND it_objtxt_basis.
CLEAR it_objtxt_basis.
CLEAR w_tab_line.
DESCRIBE TABLE it_objtxt_basis LINES w_tab_line.
READ TABLE it_objtxt_basis INDEX w_tab_line INTO l_cline.
wa_doc_chng-doc_size =
( w_tab_line - 1 ) * 255 + STRLEN( l_cline ).
CLEAR it_objpack_basis-transf_bin.
it_objpack_basis-head_start = 1.
it_objpack_basis-head_num = 0.
it_objpack_basis-body_start = 1.
it_objpack_basis-body_num = w_tab_line.
it_objpack_basis-doc_type = 'RAW'.
APPEND it_objpack_basis.
CLEAR it_objpack_basis.
LOOP AT w_path.
temp1 = w_path.
descr = w_path.
CALL FUNCTION 'STRING_REVERSE'
EXPORTING
string = descr
lang = 'E'
IMPORTING
rstring = descr.
CALL FUNCTION 'STRING_SPLIT'
EXPORTING
delimiter = '\'
string = descr
IMPORTING
head = descr
tail = temp_data.
CALL FUNCTION 'STRING_REVERSE'
EXPORTING
string = descr
lang = 'E'
IMPORTING
rstring = descr.
CALL FUNCTION 'STRING_SPLIT'
EXPORTING
delimiter = '.'
string = descr
IMPORTING
head = temp_data
tail = doc_type.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = temp1
filetype = 'BIN'
header_length = 0
read_by_line = 'X'
replacement = '#'
TABLES
data_tab = it_upload.
DESCRIBE TABLE it_upload LINES tab_lines.
DESCRIBE TABLE it_objbin_basis LINES lt_index.
lt_index = lt_index + 1.
LOOP AT it_upload.
wa_objbin_basis-line = it_upload-line.
APPEND wa_objbin_basis TO it_objbin_basis.
CLEAR wa_objbin_basis.
ENDLOOP.
it_objpack_basis-transf_bin = 'X'.
it_objpack_basis-head_start = 0.
it_objpack_basis-head_num = 0.
it_objpack_basis-body_start = lt_index.
it_objpack_basis-body_num = tab_lines.
it_objpack_basis-doc_type = doc_type.
it_objpack_basis-obj_descr = descr.
it_objpack_basis-doc_size = tab_lines * 255.
APPEND it_objpack_basis.
CLEAR it_objpack_basis.
ENDLOOP.
it_reclist_basis-receiver = '[email protected]'.
it_reclist_basis-rec_type = 'U'.
APPEND it_reclist_basis.
CLEAR it_reclist_basis.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_objpack_basis
contents_txt = it_objtxt_basis
contents_bin = it_objbin_basis
receivers = it_reclist_basis
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
IF sy-subrc EQ 0.
SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
ENDIF.
ENDFORM. " send_list_to_basis
Reward points if useful
Regards
Anji -
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. -
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.
-
IOS4.0.2 won't open excel attachment from email
I can open the PDF file, but not the excel file. When I click on the .xls attachment from my email, it brought me to the home screen. Does anyone know what I need to setup in order to be able to view the excel file?
Motion can't find a framework it needs in order to launch. That could be because the framework is missing or because permissions are set incorrectly.
To fix this problem, try repairing permissions. If that doesn't work, reinstall Final Cut Studio or copy the file /System/Library/PrivateFrameworks/Helium.framework/Frameworks/HeliumRender.fram ework/Versions/A/HeliumRender from another computer with the SAME version of Final Cut Studio. Then repair permissions again. -
Hi,
To achieve these are the steps that I had followed :
1. Add the document Library path into Central Admin -> Application Mgmt -> Manage Service App -> Excel Service App -> Trusted File Locations
2. Add Documnet Library link to Trusted Connection Proivder
3. Open Visual Studio as Run as Administrator
4.Create an SharePoint 2013 Empty Project.
5.Add Service Reference : http:\\<server>\_vti_bin/excelservice.asmx
6.Service added successfully
7.Create a class file and add the Service Reference namespace
There is no such class as ExcelService to call.
Please let me know if somebody knows how to open the Excel file into C#(2012) either using ExcelService or any other way to open. I tried old methods of Sharepoint 2010 server but it's not able to access classes.
Requirement is :
Need to read the excel sheet from Document Library and transfer all data into DataTable.
Please help asap.Hi,
This is the forum to discuss questions and feedback for Microsoft Office, I'll move your question to the SharePoint 2013 development forum
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/home?forum=sharepointdevelopment
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
George Zhao
TechNet Community Support -
RFC to read the attachment from PR05 and pass the doc to the PHP front end
Hi Team,
Our requirement : We are designing a new front end using PHP portal and pull the data from SAP-backend for travel expense/request.
We are able to upload the document to PR05 using frontend portal.
If employee/manger wants to read the attachment in the portal,how to get the documents attached in PR05 to the front end..
I would like to know the RFC which help me in reading the attachemnts.Regards,
MadhuI dont want use all the values in my second program I need to pass empno and job only.Since your cursor gets all the columns (using the * is not a good way to code the cursor), that is what your other program will get when it calls pr_test procedure. You will have to FETCH all the columns in that other procedure and discard the ones you do not need.
Alternatively, change the code of cursor to select only the columns you would actually need. -
Sending email with excel attachment from an ABAP report
Hello All,
I am using the function module SO_DOCUMENT_SEND_API1 to send an e-mail with an excel attachment.
The code works fine for less than 255 characters in each row of excel file.But for more than 255 characters , the excel file received has data upto 255 characters only.
Can someone please suggest how to send excel file with more than 255 characters in each row ?
Regards,
KKcheck below code
FORM excelrep .
DATA :l_syuzeit TYPE sy-uzeit,
l_time(5) TYPE c,
l_ampm(2) TYPE c,
l_subject(255) TYPE c.
CLEAR t_xls.
REFRESH t_xls.
l_syuzeit = sy-uzeit.
IF t_final_data1[] IS NOT INITIAL.
PERFORM fill_header.
LOOP AT t_final_data1 WHERE status NE space.
t_xls-jobname = t_final_data1-jobname.
WRITE t_final_data1-act_start_date TO t_xls-act_start_date.
WRITE t_final_data1-est_start_time TO t_xls-est_start_time.
WRITE t_final_data1-act_start_time TO t_xls-act_start_time.
WRITE t_final_data1-est_end_time TO t_xls-est_end_time.
WRITE t_final_data1-act_end_time TO t_xls-act_end_time.
t_xls-est_duration = t_final_data1-est_duration.
t_xls-act_duration = t_final_data1-duration.
t_xls-status = t_final_data1-comment.
t_xls-process = t_final_data1-desc.
t_xls-fill10 = c_0d.
t_xls-fill1 = c_09.
t_xls-fill2 = c_09.
t_xls-fill3 = c_09.
t_xls-fill4 = c_09.
t_xls-fill5 = c_09.
t_xls-fill6 = c_09.
t_xls-fill7 = c_09.
t_xls-fill8 = c_09.
t_xls-fill9 = c_09.
APPEND t_xls.
CLEAR t_xls.
ENDLOOP.
l_ampm = c_am.
IF l_syuzeit GT c_125959.
l_syuzeit = l_syuzeit - c_120000.
l_ampm = c_pm.
ELSEIF l_syuzeit GT c_120000.
l_ampm = c_pm.
ELSEIF l_syuzeit LT c_010000.
l_syuzeit = l_syuzeit + c_120000.
l_ampm = c_am.
ENDIF.
WRITE l_syuzeit TO l_time USING EDIT MASK c_edmask.
CONCATENATE text-070 l_time l_ampm INTO l_subject
SEPARATED BY space.
CLEAR w_doc_chng.
w_doc_chng-obj_name = l_subject.
w_doc_chng-obj_descr = l_subject.
CLEAR t_objtxt.
REFRESH t_objtxt.
t_objtxt = text-068.
APPEND t_objtxt.
CLEAR t_objtxt.
t_objtxt = space.
APPEND t_objtxt.
CLEAR t_objtxt.
t_objtxt = text-069.
APPEND t_objtxt.
CLEAR t_objtxt.
t_objtxt = space.
APPEND t_objtxt.
CLEAR t_objtxt.
MOVE w_sysinfo TO t_objtxt.
APPEND t_objtxt.
CLEAR t_objtxt.
t_objtxt = space.
APPEND t_objtxt.
CLEAR t_objtxt.
CLEAR w_tab_lines.
DESCRIBE TABLE t_objtxt LINES w_tab_lines.
w_doc_chng-doc_size = w_tab_lines * c_255.
CLEAR t_objpack.
REFRESH t_objpack.
t_objpack-body_start = c_1.
t_objpack-body_num = w_tab_lines * c_255.
t_objpack-doc_type = c_txt.
APPEND t_objpack.
CLEAR t_objpack.
CLEAR t_objbin.
REFRESH t_objbin.
LOOP AT t_xls.
t_objbin = t_xls.
APPEND t_objbin.
CLEAR t_objbin.
ENDLOOP.
CLEAR w_tab_lines.
DESCRIBE TABLE t_objbin LINES w_tab_lines.
CLEAR l_subject.
CONCATENATE text-083 sy-datum l_time l_ampm INTO l_subject
SEPARATED BY c_uscore.
CLEAR t_objhead.
REFRESH t_objhead.
t_objhead = l_subject.
APPEND t_objhead.
CLEAR t_objhead.
t_objpack-transf_bin = c_x.
t_objpack-head_start = c_1.
t_objpack-head_num = c_1.
t_objpack-body_start = c_1.
t_objpack-body_num = w_tab_lines.
t_objpack-doc_type = c_xls.
t_objpack-obj_name = text-070.
t_objpack-obj_descr = text-070.
t_objpack-doc_size = w_tab_lines * c_255.
t_objpack-mess_type = space.
APPEND t_objpack.
CLEAR t_objpack.
CLEAR t_reclist.
REFRESH t_reclist.
IF s_email[] IS NOT INITIAL.
LOOP AT s_email.
t_reclist-receiver = s_email-low.
t_reclist-rec_type = c_u.
APPEND t_reclist.
CLEAR t_reclist.
ENDLOOP.
ENDIF.
PERFORM mail_report.
ELSE.
MESSAGE e015 WITH text-072.
ENDIF.
CLEAR : w_doc_chng,
t_objpack,
t_objhead,
t_objbin,
t_objtxt.
REFRESH : t_objpack,
t_objhead,
t_objbin,
t_objtxt,
t_reclist.
ENDFORM. " excelrep_criticaljobs
*& Form mail_report
text
--> p1 text
<-- p2 text
FORM mail_report .
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_doc_chng
commit_work = c_x
TABLES
packing_list = t_objpack
object_header = t_objhead
contents_bin = t_objbin
contents_txt = t_objtxt
receivers = t_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.
IF sy-subrc NE 0.
CASE sy-subrc.
WHEN 1.
MESSAGE i015 WITH text-071.
WHEN 2.
MESSAGE i015 WITH text-072.
WHEN 4.
MESSAGE i015 WITH text-073.
WHEN OTHERS.
MESSAGE i015 WITH text-074.
ENDCASE.
ELSE.
MESSAGE s015 WITH text-081.
ENDIF.
ENDFORM. " mail_report
Maybe you are looking for
-
IPod touch doesnt work with Ford Sync after 2,1 upgrade
After I upgraded my iPod Touch to the new 2.1 version I am having all kinds of issues with it. Either it won't charge, says it has no media files, is not connected or device is not supported. Anyone have the same problem. Is there a way of reverting
-
Exporting/Sharing Custom XMP metadata schema not possible?
I've written a Python script which automatically encodes Quicktime files which I've mastered out of Premiere Pro CC with embedded custom XMP metadata (created using "New Schema" in the Metadata Display panel). I'm using the embedded custom metadata t
-
Is it possible to get a black background when using Picture Book layout in iphoto?
I want to customize the layouts more in iphoto--either be able to use a black background when using the Picture Book layout, or have more layout options in the Photo Essay layout. Are either of these possible? Thanks!
-
SAPNW70 Runtime Error BDIF_RSQL_INVALID_REQUEST
Hallo Freinds, I have successfully installed the new ABAP Editor (SAPNW70). After Starting Application sever, I am getting Runtime Error at Logon. Message: The Current ABAP/4 program terminated due to an internal error in the database interface. Erro
-
Prompts say password is incorrect
Using a eMac on Panther, I have no problem getting emails. But I can't send them. I can receive emails through SBC webmail. But when I try to send, the screen prompts that my password is wrong. = I went to Preferences. My email details are correct -