Send Excel sheet as attachment
Hello,
One of our user is trying to send one sheet of an excel file as attachment and the user does not want to save the sheet.
User is using MS Excel 2010 and Outlook 2013/Office365, the question is " From Excel when you go to File>Save&Send>Send as attachment , you will loose Excel program control until you send the email", user is complaining the she used to
be able to go back to the original Excel file and continue working even before she send the email before migration her email from Lotus Notes to Outlook.
Any idea if that will be a setting in Excel need to be enable/disable to let the user send the sheet as attachment and work on the same excel file at the same time even before clicking on send bottom ?
Thanks,
Pkakaie
Hi,
We just need to educate the user how Outlook works in thie scenario.
When we use the option Send as Attachment from Excel, we can't edit the Excel from the new message dialog, you may notice Excel is actually "locked". To workaround this, simply create a new message, then drag the Excel
file to the message window, double click the attached file, thus we can edit it from the new message. Once you finish editing, click Save button and send the file.
Regards,
Melon Chen
TechNet Community Support
Similar Messages
-
Error while sending excel sheet as attachment to Mail Receiver
Hi everyone,
I am facing the below error when I am trying to send data to Mail receiver adapter. The attachment is excel sheet.
Delivery of the message to the application using connection Mail_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Object not found in lookup of MessageTransformBean.: com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of MessageTransformBean..
I don't understand where the problem is. This has been running since long time and last month we have changed our web dispatcher details. I hope everything is fine. But not sure the root cause for this issue.
Please help me in resolving this.
Thank you.
Regards
Bhanu T.Check if this helps: MessageTransformBean module
Confirm that you have configured the MessagetransformationBean properly.
Are you trying to convert some payload into Excel and send it as an attachment in the Mail CC? If yes, then I hope that you have included the correct Content_type value.
Check this for more info on Content_type: /people/community.user/blog/2006/09/08/email-report-as-attachment-excelword
Regards,
Abhishek. -
Sending a excel sheet as attachment in mail
Hi,
I have requirement where I need to send excel sheet as attachment in mail. I could do it by using FM SO_NEW_DOCUMENT_ATT_SEND_API1. But, I am not able to format the excel sheet before sending.
I need to make heading bold, fix column width and wrap text in some cells, and send the mail.
Pls help me with your suggestions.
Thanks,
Siva.this link will show you how to do formatting in Excel using the OLE method, then use that EXCEL to send the MAIL using your program \
[OLE-format excel |http://www.sap-img.com/abap/download-to-excel-with-format-border-color-cell-etc.htm]
Hope That Helps
Anirban M. -
Need to send email with excel sheet as attachment: URGENT
Hi all....i have a requirement where i should extract data from SAP. These datas has to be sent to a mail id entered in the selection screen in excel sheet as an attachment.Can you suggest me any function module that meets the requirement...
For kind information...there is only one selection field for entering the mail id.
Thanks in advance
NandaHi all....i have a requirement where i should extract data from SAP. These datas has to be sent to a mail id entered in the selection screen in excel sheet as an attachment.Can you suggest me any function module that meets the requirement...
For kind information...there is only one selection field for entering the mail id.
Thanks in advance
Nanda -
Error when sending excel as email attachment
Hi All,
I am sending excel document as email attachment through F.M. SO_DOCUMENT_SEND_API1. I am getting the attachment but when i open it, it is giving error "The file is not in recognizable format....."
Please let me know how can i solve this problem.
Regards,
SabaHi Saba,
Check this link I think will surely help.
[http://www.sap-img.com/abap/sending-email-with-attachment.htm]
Regards,
Amit. -
Sending excel as email attachment
Hi All,
I am getting truncated with the header only upto 255 char length , and the field contents are ok more than 255 length it s taking.
I am using it_attach type standard table of solisti1 with header line.
the report code is given below
**& Report ZPBILL_INT1 **
REPORT zpbill_int1 .
*Declaration of type-pools.
TYPE-POOLS slis.
D A T A **
TABLES: zbill_inphdr,
zbill_inpdtl.
TYPES: BEGIN OF t_zbill_ipdtl,
cusnr TYPE zbill_inpdtl-cusnr,
svsnr TYPE zbill_inpdtl-svsnr,
revnr TYPE zbill_inpdtl-revnr,
sysnr TYPE zbill_inpdtl-sysnr,
sdate TYPE zbill_inpdtl-sdate,
filnm TYPE zbill_inpdtl-filnm,
zlsch TYPE zbill_inpdtl-zlsch,
clrfe TYPE zbill_inpdtl-clrfe,
revds TYPE zbill_inpdtl-revds,
prind TYPE zbill_inpdtl-prind,
svsds TYPE zbill_inpdtl-svsds,
quant TYPE zbill_inpdtl-quant,
adate TYPE zbill_inpdtl-adate,
trdat TYPE zbill_inpdtl-trdat,
mdate TYPE zbill_inpdtl-mdate,
trdval type zbill_inpdtl-trdval,*
exrate TYPE zbill_inpdtl-exrate,
birate TYPE zbill_inpdtl-birate,
cusds1 TYPE zbill_inpdtl-cusds1,
cusds2 TYPE zbill_inpdtl-cusds2,
cusstr TYPE zbill_inpdtl-cusstr,
cuspc TYPE zbill_inpdtl-cuspc,
cuscity TYPE zbill_inpdtl-cuscity,
cusctry TYPE zbill_inpdtl-cusctry ,
rect TYPE zbill_inpdtl-rect,
invno TYPE zbill_inpdtl-invno,
ldate TYPE zbill_inpdtl-ldate,
conty TYPE zbill_inpdtl-conty,
edate TYPE zbill_inpdtl-edate,
custa TYPE zbill_inpdtl-custa,
currc TYPE zbill_inpdtl-currc,
warrt TYPE zbill_inpdtl-warrt,
indrp TYPE zbill_inpdtl-indrp,
textc TYPE zbill_inpdtl-textc,
gstr TYPE zbill_inpdtl-gstr,
clrds TYPE zbill_inpdtl-clrds,
commty TYPE zbill_inpdtl-commty,
commyr TYPE zbill_inpdtl-commyr,
commmt TYPE zbill_inpdtl-commmt,
commop TYPE zbill_inpdtl-commop,
eposdoc TYPE zbill_inpdtl-eposdoc,
custp TYPE zbill_inpdtl-custp,
END OF t_zbill_ipdtl.
DATA: it_zbill TYPE STANDARD TABLE OF t_zbill_ipdtl
INITIAL SIZE 0.
ALV Data declaration.*
DATA : v_repid LIKE sy-repid.
ALV Function Module Variables*
DATA: gs_layout TYPE slis_layout_alv,
g_exit_caused_by_caller,
gs_exit_caused_by_user TYPE slis_exit_by_user.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,
gs_print TYPE slis_print_alv,
gt_events TYPE slis_t_event,
gt_list_top_of_page TYPE slis_t_listheader,
g_status_set TYPE slis_formname VALUE 'PF_STATUS_SET',
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
g_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
g_top_of_list TYPE slis_formname VALUE 'TOP_OF_LIST',
g_end_of_list TYPE slis_formname VALUE 'END_OF_LIST',
g_variant LIKE disvariant,
g_save(1) TYPE c,
g_tabname_header TYPE slis_tabname,
g_tabname_item TYPE slis_tabname,
g_exit(1) TYPE c,
gx_variant LIKE disvariant.
DATA : gr_layout_bck TYPE slis_layout_alv.
DATA : wa_zbill TYPE t_zbill_ipdtl.
*Email related declarations
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: it_attach TYPE STANDARD TABLE OF SOMLRECI1 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_attachment LIKE SOMLRECI1 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.
*DATA IT_HEADER TYPE STANDARD TABLE OF SOLIX INITIAL SIZE 0 WITH
*HEADER LINE.
*data : begin of it_header occurs 0,
header(1023) type C,*
end of it_header.*
S E L E C T I O N S **
SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE text-b01.
SELECT-OPTIONS: s_cusnr FOR zbill_inpdtl-cusnr,
s_svsnr FOR zbill_inpdtl-svsnr,
s_revnr FOR zbill_inpdtl-revnr,
s_sysnr FOR zbill_inpdtl-sysnr,
s_sdate FOR zbill_inpdtl-sdate,
s_filnm FOR zbill_inpdtl-filnm,
s_prind for zbill_inpdtl-prind.
PARAMETERS: p_test AS CHECKBOX,
p_email AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b01.
*PARAMETERS: p_email TYPE somlreci1-receiver
Initialization **
INITIALIZATION.
v_repid = sy-repid.
start-of-selection **
START-OF-SELECTION.
PERFORM data_retrieval.
IF p_test = '' AND P_EMAIL = ''.
MESSAGE S038(ZMBILLING).
ELSEIF P_TEST = 'X'.
display the data in the form of ALV*
PERFORM display_data.
ELSEIF P_EMAIL = 'X'.
*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 p_email
'Billing Details list'
'XLS'
'filename'
CHANGING gd_error
gd_reciever.
*Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
ENDIF.
*& Form data_retrieval
text*
FORM data_retrieval.
SELECT revnr sysnr sdate filnm cusnr
svsnr zlsch clrfe revds prind svsds
quant adate trdat mdate exrate
birate cusds1 cusds2 cusstr
cuspc cuscity cusctry rect
invno ldate conty edate custa
currc warrt indrp textc
gstr clrds commty commyr commmt
commop eposdoc custp
INTO CORRESPONDING FIELDS OF TABLE it_zbill FROM zbill_inpdtl
WHERE cusnr IN s_cusnr
AND svsnr IN s_svsnr
AND revnr IN s_revnr
AND sysnr IN s_sysnr
AND sdate IN s_sdate
AND filnm IN s_filnm
and prind in s_prind.
ENDFORM. " DATA_RETRIEVAL
**& Form build_xls_data_table
text*
FORM build_xls_data_table.
DATA: ld_store(50) TYPE c. "Leading zeros
DATA: wa_zbill-quant(20),
wa_zbill-custa(20),
wa_zbill-gstr(20).
wa_zbill-mxamt(20).*
*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 'Customer code' 'Service Number' 'Revenue Type' 'Source
System Code' 'Date Source' 'File Name' 'Payment Code' 'Single Char Flag'
'Revenue Description' 'Processing Indicator' 'Service Description'
'Order Quantity' 'Date of Adustment' 'Trade Date' 'Mos Date'
'ExchangeRate' 'Billing Rate' 'Customer Name1' 'Customer name2'
'Customer adress' 'Customer postalcode' 'Customer city'
'Customer country' 'Billing amt without GST' 'GST Payable'
'Receipt number' 'Invoice Number' 'Listing Period'
'Contract Type' 'Entry date' 'Custody Code' 'Currency Code'
'Name of Warrant' 'Rights issue' 'No Of copies'
'GST Rate' 'Clearing Fee' 'Commodity type'
'Commodity year' 'Commodity month' 'Commodity Option Tpye'
'Quantity Transacted' 'Amendment Quantity' 'EPOS DOC type'
'Customer Type'
INTO IT_ATTACH SEPARATED BY con_tab.
CONCATENATE con_cret IT_ATTACH INTO IT_ATTACH.
*CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
LOOP AT it_zbill INTO wa_zbill.
CONCATENATE wa_zbill-cusnr wa_zbill-svsnr wa_zbill-revnr
wa_zbill-sysnr wa_zbill-sdate wa_zbill-filnm wa_zbill-zlsch
wa_zbill-clrfe wa_zbill-revds wa_zbill-prind wa_zbill-svsds
wa_zbill-quant wa_zbill-adate wa_zbill-trdat wa_zbill-mdate
wa_zbill-exrate wa_zbill-birate wa_zbill-cusds1 wa_zbill-cusds2
wa_zbill-cusstr wa_zbill-cuspc wa_zbill-cuscity wa_zbill-cusctry
wa_zbill-rect wa_zbill-invno wa_zbill-ldate wa_zbill-conty
wa_zbill-edate wa_zbill-custa wa_zbill-currc wa_zbill-warrt
wa_zbill-indrp wa_zbill-textc wa_zbill-gstr wa_zbill-clrds
wa_zbill-commty wa_zbill-commyr wa_zbill-commmt wa_zbill-commop
wa_zbill-eposdoc wa_zbill-custp
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
it_header = it_attach .*
*append it_header.
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
***& Form SEND_FILE_AS_EMAIL_ATTACHMENT
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.
*ld_sender_address = SY-UNAME.
ld_sender_address_type = 'SMTP'.*
*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-OBJ_NAME = ld_attfilename.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment = it_attach.
t_attachment[] = it_attach[] .
t_attachment = it_header.*
t_attachment[] = it_header[] .*
*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. "build_xls_data_table
regards
subbaHi ,
i'm saying check the field doc_size, umcomment it .change 255--->1025 .
w_doc_data-doc_size =
**( w_cnt - 1 ) * 255 + STRLEN( it_attach ).**
**t_packing_list-doc_size = t_packing_list-body_num * 255.**
for more details , check the documentation.
regards
Prabhu -
I need to send an Excel file created by a query written in PL/SQL by email (Oracle 8). What is the process and steps to do this?
I need to send an Excel file created by a query written in PL/SQL by email (Oracle 8). What is the process and steps to do this?
-
Logo in excel sheet while mailing
Hi,
Is there anyway we can add logo to excel.I am sending excel sheet as attachment via email, now i need to add logo into the excel sheet. Is it possible to add logo into excel sheet.
Regards,
Karthik.kHi Karthik,
I'm not sure, how you are developing the above.
If your devopment is focusing more on Excel better go for OLE.
By using this you can open an existing Excel template (so you can place your logo here).
You can do many more things by this method by writing macro (like formatting data, drawing graphs, etc).
Regards
Surya. -
Sending a formatted Excel sheet as an attachment in a mail.
Hi ,
I have been using following code to to send formatted excel sheet as attachment in email.
in the below code I want to change the format of cell from Bold to Underline.
I have replaced Bold with Underline for below code but it is not working can anyone suggest on this.
Department
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ).
r_data = l_document->create_simple_element( name = 'Data' value = 'MATNR' parent = r_cell ).
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
r_format->set_attribute_ns( name = 'Bold' prefix = 'ss' value = '1' ).
Creating a ixml Factory
l_ixml = cl_ixml=>create( ).
Creating the DOM Object Model
l_document = l_ixml->create_document( ).
Create Root Node 'Workbook'
l_element_root = l_document->create_simple_element( name = 'Workbook' parent = l_document ). l_element_root->set_attribute( name = 'xmlns' value = 'urn:schemas-microsoft-com:office:spreadsheet' ). ns_attribute = l_document->create_namespace_decl( name = 'ss' prefix = 'xmlns' uri = 'urn:schemas-microsoft-com:office:spreadsheet' ). l_element_root->set_attribute_node( ns_attribute ). ns_attribute = l_document->create_namespace_decl( name = 'x' prefix = 'xmlns' uri = 'urn:schemas-microsoft-com:office:excel' ). l_element_root->set_attribute_node( ns_attribute ).
Create node for document properties.
r_element_properties = l_document->create_simple_element( name = 'TEST_REPORT' parent = l_element_root ). l_value = sy-uname. l_document->create_simple_element( name = 'Author' value = l_value parent = r_element_properties ).
Styles
r_styles = l_document->create_simple_element( name = 'Styles' parent = l_element_root ).
Style for Header
r_style = l_document->create_simple_element( name = 'Style' parent = r_styles ). r_style->set_attribute_ns( name = 'ID' prefix = 'ss' value = 'Header' ). r_format = l_document->create_simple_element( name = 'Font' parent = r_style ).
Worksheet
r_worksheet = l_document->create_simple_element( name = 'Worksheet' parent = l_element_root ). r_worksheet->set_attribute_ns( name = 'Name' prefix = 'ss' value = 'PO Details' ).
Table
r_table = l_document->create_simple_element( name = 'Table' parent = r_worksheet ). r_table->set_attribute_ns( name = 'FullColumns' prefix = 'x' value = '1' ). r_table->set_attribute_ns( name = 'FullRows' prefix = 'x' value = '1' ).
Column Formatting
r_column = l_document->create_simple_element( name = 'Column' parent = r_table ). r_column->set_attribute_ns( name = 'Width' prefix = 'ss' value = '70' ). r_column = l_document->create_simple_element( name = 'Column' parent = r_table ). r_column->set_attribute_ns( name = 'Width' prefix = 'ss' value = '70' ). r_column = l_document->create_simple_element( name = 'Column' parent = r_table ). r_column->set_attribute_ns( name = 'Width' prefix = 'ss' value = '70' ). r_column = l_document->create_simple_element( name = 'Column' parent = r_table ). r_column->set_attribute_ns( name = 'Width' prefix = 'ss' value = '70' ). r_column = l_document->create_simple_element( name = 'Column' parent = r_table ). r_column->set_attribute_ns( name = 'Width' prefix = 'ss' value = '70' ).
Blank Row
r_row = l_document->create_simple_element( name = 'Row' parent = r_table ).
Column Headers Row
r_row = l_document->create_simple_element( name = 'Row' parent = r_table ). r_row->set_attribute_ns( name = 'AutoFitHeight' prefix = 'ss' value = '1' ).
Sr. No.
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ). r_data = l_document->create_simple_element( name = 'Data' value = 'EBELN' parent = r_cell ). r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
User Name
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ). r_data = l_document->create_simple_element( name = 'Data' value = 'EBELP' parent = r_cell ). r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
Full Name
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ). r_data = l_document->create_simple_element( name = 'Data' value = 'AEDAT' parent = r_cell ). r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
Department
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ). r_data = l_document->create_simple_element( name = 'Data' value = 'MATNR' parent = r_cell ). r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ). r_format->set_attribute_ns( name = 'Bold' prefix = 'ss' value = '1' ). r_format = l_document->create_simple_element( name = 'Interior' parent = r_style ). r_format->set_attribute_ns( name = 'Color' prefix = 'ss' value = '#C0C0C0' ). r_format->set_attribute_ns( name = 'Pattern' prefix = 'ss' value = 'Solid' ). r_format = l_document->create_simple_element( name = 'Alignment' parent = r_style ). r_format->set_attribute_ns( name = 'Vertical' prefix = 'ss' value = 'Center' ). r_format->set_attribute_ns( name = 'WrapText' prefix = 'ss' value = '1' ).
Data Table
LOOP AT it_ekpo INTO wa_ekpo. r_row = l_document->create_simple_element( name = 'Row' parent = r_table ).
Sr. No.
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ).
l_value = sy-tabix.
CONDENSE l_value NO-GAPS.
r_data = l_document->create_simple_element( name = 'Data' value = l_value parent = r_cell ). " Data
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'Number' ). " Cell format
EBELN
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ). l_value = wa_ekpo-ebeln. r_data = l_document->create_simple_element( name = 'Data' value = l_value parent = r_cell ). " Data r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ). " Cell format
EBELP
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ). l_value = wa_ekpo-ebelp. r_data = l_document->create_simple_element( name = 'Data' value = l_value parent = r_cell ). " Data r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ). " Cell format
AEDAT
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ). l_value = wa_ekpo-aedat. r_data = l_document->create_simple_element( name = 'Data' value = l_value parent = r_cell ). " Data r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ). " Cell format
MATNR
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ). l_value = wa_ekpo-matnr. r_data = l_document->create_simple_element( name = 'Data' value = l_value parent = r_cell ). " Data r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ). " Cell format ENDLOOP.
Creating a Stream Factory
l_streamfactory = l_ixml->create_stream_factory( ).
Connect Internal XML Table to Stream Factory
l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
Rendering the Document
l_renderer = l_ixml->create_renderer( ostream = l_ostream document = l_document ). l_rc = l_renderer->render( ).
Saving the XML Document
l_xml_size = l_ostream->get_num_written_raw( ).
Before sending the mail,
LOOP AT l_xml_table INTO wa_xml.
CLEAR objbin.
objbin-line = wa_xml-data.
APPEND objbin to BINARY_CONTENT.
ENDLOOP.
Here, objbin is of type SOLIX and BINARY_CONTENT is of type SOLIX_TAB.
Now, call the method,
CALL METHOD DOCUMENT->ADD_ATTACHMENT
EXPORTING I_ATTACHMENT_TYPE = 'XLS'
I_ATTACHMENT_SUBJECT = 'My attachment'
I_ATT_CONTENT_HEX = BINARY_CONTENT .Try this..
r_format->set_attribute_ns( name = 'Underline' prefix = 'ss' value = 'Single' ). -
Send excel as Pivot table in attachment through ABAP
Hi All,
I have a requirement where I have to send excel file as attachment. Which I can do without any issue.
But when we send in excel it should be in Pivot format as we can do in Excel.
Sending excel file as attachment in Pivot format thorugh ABAP. Is it possible. If some one has tried it ever can tell me some thing about this.
Thanks,
AnuHi Anu,
can you pls share the logic of sending excel as pivot table and i can try with it.
Thank You.
K.S. -
Hi There
I would like to compare two excel sheets
Sheet1 - Current day records
Sheet2 - Last day records
My requirement is this : Comparing sheet1 and sheet2
1. updating the changes and inserting new records into current day with respect to last day.
2. I have idea of using Merge. But, use it with PL/sql for comparing two excel sheets how?
Please help
Thanks
RajRangarajan wrote:
If you want SQL or PL/SQL to process the data then it really needs to be on the database.
__What ever it may be i need solution.*I am ok for creating two addtional tables to run the show.*Well you write the solution, we just give you the information you will need to do it. Unless of course you want to pay for our services? (hint: a little less of the bold agressive posturing would go down better; asking nicely works for most people)
So, although you say it's excel sheets, are you really talking about CSV files (which are not Excel sheets, but Character Seperated Values)?
its not csv its xls only_
If you are dealing with CSV's then you could create external tables that read the data from the files and then do the comparisons mentioned above, especially if you are looking to MERGE the data, because SQL commands such as insert, merge etc. don't work on flat files.
its ok* Ok, Excel (.xls) files are a proprietary Microsoft binary format file. These can't just be read into the database as they are. If your database was on a windows platform you could set up an Excel ODBC connection to the .xls files and then treat them as external databases. As you're on solaris you won't really be able to do that. You only option therefore is to export your data to CSV or other flat file format so that the database can read the data from those. CSV is preferable as you will be able to use Oracles External tables to load the data.
You don't have to share your actual data with us, just give us some idea of the infrastructure you are dealing with. You haven't even told us if you've got the data loaded into database tables yet...
its ora 9i / solaris*
Let me put some more clarity on the objective.
Currently, I am comparing two excel sheet manually(using vlookup, match etc,) Utimately, I am doing set minus, presence of previous run and not in current run. then,I will make the changes to current run and send excel sheet to email integration system. I would like to automate entire stuff.So here's the steps you need...
Export excel sheets to CSV files.
Have Oracle external tables defined to point at those flat files.
Use the aforementioned comparison methods to compare the two flat files by reading with SQL from the external tables.
Generate the output into another CSV file. (you can use writeable external tables in 10g onwards, but as you're on 9i you'll need to use UTL_FILE to write it out instead).
Take your written CSV file and load that back into Excel. (Excel likes reading CSV's)
The problems you've got in automating it are getting the data exported from Excel to CSV files and also reading the output CSV back into Excel. You may be able to do this using some OLE/DDE type stuff, but as you're on a solaris platform rather than Windows, that could prove a little tricky.
Could you arrange to have the data delivered to you already in CSV format rather than as Excel sheets? Could you provide CSV results rather than an Excel sheet in return? -
Field length shows more in excel sheet which is sent via email
I am sending excel sheet through email. I have data in internal table which i move to the email internal table and data is been sent via email using a excel sheet.
Now, when I open the excel sheet, i see that all fields get displayed but the last field is shown as too much length meaning field length is 15 chars but in excel sheet it shows as almost 40 - 50 chars.Decalre one more field in your internal table ,which should be last field.
and do not pass header for this field and just pass the empty value to this field.
if not use this FM : EXCEL_OLE_STANDARD_DAT
Reward Points if it is helpful
Thanks
Seshu -
Converting OTF to EXCEL or PDF to ECXEL and sending Excel through mail
Hi ,
I need a solution for Converting OTF into EXCEL or PDF into ECXEL and sending Excel as a attachment to the mail.
In my current Program I am getting OTF data from script and converting into PDF using Function module ' CONVERT_OTF'
And sending PDF as a mail attachment using Function module 'SO_NEW_DOCUMENT_SEND_API1' it is working fine but
My current requirement is I need to send Excel as a mail attachment instead of PDF.
Hope it is clear for you, please give me solutions with sample code..Hi!
Because OTF is not a grid, like Excel, and PDF can also contain anything, I think it is not possible to convert an OTF, or PDF into an excel spreadsheet.
You can convert an ALV into excel and send it via email.
Regards
Tamá -
How to send huge no. of excel sheet attachment to a mail ID
HI ,
I have mail functionality program which send mail to a mail id with multiple excel sheet attchment. I have done all these things. When it sends small number of excel attchment then it's ok. But when it sends huge number of excel attchment (ex.- 1000 excel attchment) then it showing error message to the mail id -
'This message is larger than the size limit for messages. Please make it smaller and try sending it again.'
I have used cl_bcs, cl_document_bcs these class. I have seen all related post in sdn but unable to get my requirement.
i need your suggestion.Hi,
Try this code::
FORM MAIL_SEND .
*Mail Body
MOVE text-004 TO wa_text. "Space
APPEND wa_text TO wt_text.
CLEAR wa_text.
MOVE TEXT-003 TO wa_text.
APPEND wa_text TO wt_text.
CLEAR wa_text.
MOVE text-005 TO wa_text.
APPEND wa_text TO wt_text.
CLEAR wa_text.
MOVE TEXT-003 TO wa_text.
APPEND wa_text TO wt_text.
CLEAR wa_text.
MOVE text-011 TO wa_text.
APPEND wa_text TO wt_text.
CLEAR wa_text.
tl_contents[] = wt_text.
TRY.
TRY.
**-- Create persistent send request
l_send_request = cl_bcs=>create_persistent( ).
CATCH CX_SEND_REQ_BCS.
ENDTRY.
*-- Get the length of the Document
DESCRIBE TABLE tl_contents LINES l_cnt.
READ TABLE tl_contents INTO wa_contents INDEX l_cnt.
l_doc_len = ( l_cnt - 1 ) * 255 + STRLEN( wa_contents ).
*-- Subject of the mail
l_sub = 'TEST1'.
I_SUBJECT = 'BP assignment report for Credit analyst and CrSeg'.
**-- Create Document
l_document = cl_document_bcs=>create_document(
i_type = c_htm
i_text = tl_contents
i_length = l_doc_len
i_subject = I_SUBJECT "'BP assignment report for Credit analyst and CrSeg
i_language = sy-langu
i_importance = '1' ).
CATCH CX_DOCUMENT_BCS.
**-- Subject of the mail
MOVE l_sub TO l_subj.
ENDTRY.
TRY.
*-- Set the Message Subject
CALL METHOD l_send_request->set_message_subject
EXPORTING
ip_subject = l_subj.
CATCH CX_SEND_REQ_BCS.
ENDTRY.
**-- Add document to send request
try.
CALL METHOD l_send_request->set_document( l_document ).
CATCH CX_SEND_REQ_BCS.
endtry.
CALL FUNCTION 'SPLIT_FILENAME'
EXPORTING
long_filename = 'C:\BP_DETAILS.XLS'
IMPORTING
pure_filename = p_name
pure_extension = p_ext.
TRANSLATE p_ext TO UPPER CASE.
elpath = 'C:\BP_DETAILS.XLS'.
*Upload the file
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = elpath
filetype = 'BIN'
TABLES
data_tab = t_ann
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.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
try.
IF t_ann[] IS NOT INITIAL.
*-- File name of the Attachment
l_subject = p_name.
*-- Extension of the Attachment
l_att_type = p_ext.
TRY.
w_document = l_document.
*-- Add Attachment to the Document
CALL METHOD L_document->add_attachment
EXPORTING
i_attachment_type = l_att_type
i_attachment_subject = l_subject
i_att_content_hex = t_ann. "t_mailhex.
CATCH cx_document_bcs.
ENDTRY.
ENDIF.
*-- Do send delivery info for successful mails
lv_msg = 'E'.
CALL METHOD l_send_request->set_status_attributes
EXPORTING
i_requested_status = lv_msg "Error status
i_status_mail = lv_msg. "Error status
TRY.
send_request = l_send_request->send_request.
CATCH cx_bcs.
ENDTRY.
set outbox flag
TRY.
CALL METHOD send_request->set_link_to_outbox( 'X' ).
CATCH cx_bcs.
ENDTRY.
request error status
TRY.
CALL METHOD send_request->setu_requested_status( req_stat ).
CATCH cx_bcs INTO l_bcs_exception.
ENDTRY.
*-- Set sender
l_sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD l_send_request->set_sender
EXPORTING
i_sender = l_sender.
gs_mail-e_mail = 'mail ID1'.
APPEND gs_mail TO gt_mail.
CLEAR gs_mail.
gs_mail-e_mail = 'mail ID2'.
APPEND gs_mail TO gt_mail.
CLEAR gs_mail.
gs_mail-e_mail = 'mail ID3'.
APPEND gs_mail TO gt_mail.
CLEAR gs_mail.
loop at gt_mail into gs_mail.
try.
l_recipient = cl_cam_address_bcs=>create_internet_address(
gs_mail-e_mail ).
catch cx_address_bcs.
endtry.
CALL METHOD l_send_request->add_recipient
EXPORTING
i_recipient = l_recipient
i_express = 'X'
i_copy = 'X'.
endloop.
*-- Send Email
CALL METHOD l_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = l_result ).
CATCH cx_bcs INTO l_bcs_exception.
ENDTRY.
COMMIT WORK.
ENDFORM.
Thanks -
Urgent: Sending an Email with Excel sheet attachment
Hi All,
I am preparing a report and has to send mail with excel sheet attachement. In report i am getting everything fine. But in the mail i am not getting the data, data is passing to the FM succesfully. But in the mail, excel is not having full data.
the below mentioned is my code.
i_texts-line = c_stern.
i_texts-line+254(1) = c_newline.
APPEND i_texts.
LOOP AT i_texc.
i_att_line-line = i_texc.
APPEND i_att_line.
ENDLOOP.
DATA: wa_doc_chng LIKE sodocchgi1.
DATA: w_tab_lines LIKE sy-tabix.
STATICS: c_body_start TYPE i VALUE '1'.
CONSTANTS: lc_filename(10) TYPE c VALUE 'Attachment',
lc_atthead(30) TYPE c VALUE 'Manually released invoices'.
DATA: i_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: w_doc_name(30) TYPE c.
DATA: l_text1(15),
l_text2(12),
l_text3(15),
l_text4(15),
l_text5(14),
l_text6(17),
l_text7(10),
l_text8(20),
l_text9(19),
l_text10(19),
l_text11(19),
l_text12(16),
l_text13(20),
l_text14(19),
l_text15(19),
l_text16(30).
DATA: DATE(10),
DT(2),
MON(3),
YR(4),
lc_final(50).
CLEAR: i_texts, i_reci,i_att_line. "i_bname,
REFRESH: i_texts, i_reci,i_att_line. "i_bname,
WRITE sy-datum TO w_datex.
WRITE sy-uzeit TO w_timex.
l_text1 = text-003.
l_text2 = text-004.
l_text3 = text-005.
l_text4 = text-006.
l_text5 = text-007.
l_text6 = text-008.
l_text7 = text-009.
l_text8 = text-010.
l_text9 = text-011.
l_text10 = text-012.
l_text11 = text-013.
l_text12 = text-014.
l_text13 = text-015.
l_text14 = text-016.
l_text15 = text-017.
l_text16 = text-026.
CONCATENATE
l_text1
l_text2
l_text3
l_text4
l_text5
l_text6
l_text7
l_text8
l_text9
l_text10
l_text11
l_text12
l_text13
l_text14
l_text15
l_text16
INTO i_texts SEPARATED BY
c_horz_tab.
i_texts-line+254(1) = c_newline.
APPEND i_texts.
CLEAR i_texts.
LOOP AT i_texc.
i_att_line-line = i_texc.
APPEND i_att_line.
ENDLOOP.
LOOP AT so_rec.
i_reci-receiver = so_rec-low.
i_reci-express = 'X'.
i_reci-rec_type = 'U'.
APPEND i_reci.
ENDLOOP.
DESCRIBE TABLE i_texts LINES w_tab_lines.
READ TABLE i_texts INDEX w_tab_lines.
wa_doc_chng-doc_size = ( w_tab_lines - 1 ) * 255 + STRLEN( i_texts ).
wa_obj_name = 'ZFI_XX_REL_BLOCKED_INVOICE_01'.
DT = SY-DATUM+6(2).
MON = SY-DATUM+4(2).
YR = SY-DATUM+0(4).
CONCATENATE DT MON YR INTO DATE SEPARATED BY '-'.
CONCATENATE lc_atthead date into lc_final separated by ' '.
MOVE lc_final
TO wa_obj_descr .
wa_doc_chng-obj_name = wa_obj_name.
wa_doc_chng-obj_descr = wa_obj_descr.
CLEAR i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 0.
i_objpack-body_num = w_tab_lines.
i_objpack-doc_type = 'RAW'.
APPEND i_objpack.
APPEND LINES OF i_att_line TO i_texts.
LOOP AT i_arseg INTO wa_arseg.
i_xmplt_d-belnr = wa_arseg-belnr.
i_xmplt_d-budat = wa_arseg-budat.
i_xmplt_d-bukrs = wa_arseg-bukrs.
i_xmplt_d-lifnr = wa_arseg-lifnr.
i_xmplt_d-name1_lifnr = wa_arseg-name1_lifnr.
i_xmplt_d-wrbtr = wa_arseg-wrbtr.
i_xmplt_d-waers = wa_arseg-waers.
i_xmplt_d-ebeln = wa_arseg-ebeln.
i_xmplt_d-ebelp = wa_arseg-ebelp.
i_xmplt_d-reason = wa_arseg-reason.
i_xmplt_d-dmeng = wa_arseg-dmeng.
i_xmplt_d-dwert = wa_arseg-dwert.
i_xmplt_d-bname = wa_arseg-bname.
i_xmplt_d-name_text = wa_arseg-name_text.
i_xmplt_d-udate = wa_arseg-udate.
i_xmplt_d-comment = wa_arseg-comment.
APPEND i_xmplt_d.
ENDLOOP.
LOOP AT i_xmplt_d.
CONCATENATE i_xmplt_d-belnr
i_xmplt_d-budat
i_xmplt_d-bukrs
i_xmplt_d-lifnr
i_xmplt_d-name1_lifnr
i_xmplt_d-wrbtr
i_xmplt_d-waers
i_xmplt_d-ebeln
i_xmplt_d-ebelp
i_xmplt_d-reason
i_xmplt_d-dmeng
i_xmplt_d-dwert
i_xmplt_d-bname
i_xmplt_d-name_text
i_xmplt_d-udate
i_xmplt_d-comment
INTO i_texts SEPARATED
BY c_horz_tab.
i_texts-line+254(1) = c_newline.
APPEND i_texts.
CLEAR i_texts.
ENDLOOP.
DESCRIBE TABLE i_texts LINES w_tab_lines.
READ TABLE i_texts INDEX w_tab_lines.
wa_doc_chng-doc_size = ( w_tab_lines - 1 ) * 255 + STRLEN( i_texts ).
DESCRIBE TABLE i_texts LINES w_tab_lines.
i_objpack-transf_bin = ' '.
i_objpack-head_start = 0.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = w_tab_lines.
i_objpack-doc_type = 'XLS'.
i_objpack-obj_name = 'Attachment'.
i_objpack-obj_descr = w_doc_name.
i_objpack-obj_descr = lc_filename.
i_objpack-doc_size = w_tab_lines * 255.
APPEND i_objpack.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
TABLES
packing_list = i_objpack
contents_txt = i_texts
receivers = i_reci
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
IF sy-subrc = 0.
COMMIT WORK.
ELSE.
WRITE: / 'Error in send E-Mail' .
ENDIF.
please revert me asap. It is very urgent to me. thanks in advance.
ByehI
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.....
Reward Points
Maybe you are looking for
-
Need help with my mac hard drive?
I'm running MacDrive Standard to view my Mac-enabled hard drive on my pc laptop. Worked fine for a year now. Suddenly, Word documents start becoming inaccessible, saying there's something wrong with them, my movies and TV shows on the hard drive lag,
-
Hi All, I am using standard program RM07DOCS and i copied this to my ZRM07DOCS Now according to requirement i want 4 additional fields to display in the ALV Output I have added those field in the internal table , now want to display in ALV.. I tried
-
Trouble viewing in Internet Explorer
Hello, I created a website in Dreamweaver CS3 and everything was going fine until I uploaded it and discovered that most of the content could not be viewed (mostly the flash stuff). I then discovered that Dreamweaver had randomly inserted <noscrript>
-
How to re-install with disc purchase and download purchase
I have bought harddisc version of CS3 standard. After a while i have bought as an addition dreamweaver CS4 as a download. I have now an issue with acrobat (part of my CS3 suite) and it is advised to re-install the whole package. But when i try to re-
-
Hello, Quick question specific to Microsoft Word: I can only print whole documents as the printing dialog won't let me edit the "from: xx to: xx" pages. Any ideas? thanks, Loa