PO Output: Medim 7 (Simple Mail)
Hi all,
Has anyone come across with PO output with medium 7 (Simple Mail)?
Any idea of how to configure it in the system?
Thanks.
Tom
Hi Tom,
Basically there are two mail types: Internet mail (external mail) and
SAPOffice mail.
Mail is sent via the output determination in both cases.
If you use the external mail, the message for the purchasing document is
converted into a corresponding text file which is sent to the vendor via
the Internet.
SAPOffice mail is sent only within the R/3 System and has mainly the
function of providing information.
In particular, it is not possible to attach a message (form) for a
purchasing document to a SAPOffice mail.
When using external mail, the following basic settings are required:
1. You must maintain an e-mail address in the address in the vendor
master.
2. The same applies to your own user master. You also have to specify
an e-mail address there in order to identify the sender.
o Note that it is not possible to change the e-mail address of the
vendor via the SAP purchase order transaction (ME21N, ME22N, and
so on).
o You can only make a permanent change using the vendor master
transactions XK02 or MK02.
o You can use a temporary email address in Transaction ME21N.
3. For the output type for default values, a communication strategy
needs to be maintained in the Customizing that supports the e-mail.
You can find the definition of the communication strategy in the
Customizing via the following path: (SPRO -> IMG -> SAP Web
Application Server -> Basic Services -> Message Control -> Define
Communication Strategy). As a default, communication strategy CS01
is delivered. This already contains the necessary entry for the
external communication. Bear in mind that without a suitable
communication strategy it is not possible to communicate with a
partner via Medium 5 (external sending).
4. Use the standard SAP environment (program 'SAPFM06P', FORM routine
'ENTRY_NEU' and form 'MEDRUCK') as the processing routines.
5. In the condition records for the output type (for example,
Transaction MN04), use medium '5' (External send).
6. You can use Transaction SCOT to trigger the output manually. The
prerequisite for a correct sending is that the node is set
correctly. This is not described here, but it must have already been
carried out.
7. To be able to display, for example, the e-mail in Outlook, enter PDF
as the format in the node.
To use the SAPOffice mail, the following basic settings are required:
1. For the output type for default values, a communication strategy
needs to be maintained in the Customizing that supports the e-mail.
You can branch to the maintenance of the communication strategy via
the input help.
2. Use the SAP standard environment (program "RSNASTSO" and FORM
routine "SAPOFFICE_AUFRUF") as the processing routines.
3. In the condition records for the output type (for example,
Transaction MN04), use medium '7' (SAPOffice) and also partner role
'MP' (mail partner).
- Sanjeev
Similar Messages
-
Output thro simple mail concept
Hi
My requirement is sending invoice output to customer. I have option of sending thro' external send(5). But i am looking to use simple mail(5) concept. Can i use this. If i can use what is the program i need mentioned in the nace and also can i use smart form.
i had checked with my programmer, he had stdprogram RSNASTSO and form routine SAPOFFICE_AUFRUF_VX which is used to mail to SAP inbox , he tried to modify this program based on our requirement and add the smartform to it. we got the mail but the information in smartform did not come in the mail i.e program is not accessing the information.
Please let me know your input.
Thanks
sriramHi,
Try the below code.
REPORT z_sd_multi_cust_mail.
TABLES:nast,kna1,vbak.
DATA : v_vbeln LIKE vbak-vbeln,
v_ucomm LIKE sy-ucomm,
v_form_name TYPE rs38l_fnam.
START-OF-SELECTION.
*& Form entry
text
-->RETURN_CODE text
-->US_SCREEN text
FORM entry USING return_code us_screen.
CLEAR return_code.
CLEAR:v_vbeln,v_form_name.
v_vbeln = nast-objky.
v_ucomm = 'PRNT'.
IF v_ucomm = 'PRNT' ."For Mail sending
CALL FUNCTION 'Z_QUOTATION_MAIL_SEND'
EXPORTING
vbeln = nast-objky.
ENDIF.
CLEAR:v_ucomm.
ENDFORM. "entry
In FM 'Z_QUOTATION_MAIL_SEND'
FUNCTION Z_QUOTATION_MAIL_SEND.
""Local Interface:
*" IMPORTING
*" REFERENCE(VBELN) TYPE NAST-OBJKY
Importing Parameter is
VBELN TYPE NAST-OBJKY
TABLES: nast,
kna1,
vbak.
DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
i_tline TYPE TABLE OF tline WITH HEADER LINE,
i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
*---Objects to send mail.
i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
*---Work Area declarations
wa_objhead TYPE soli_tab,
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
wa_doc_chng TYPE sodocchgi1,
w_data TYPE sodocchgi1,
wa_buffer TYPE string, "To convert from 132 to 255
*--- Variables declarations
v_form_name TYPE rs38l_fnam,
v_len_in LIKE sood-objlen,
v_len_out LIKE sood-objlen,
v_len_outn TYPE i,
v_lines_txt TYPE i,
v_lines_bin TYPE i,
v_vbeln TYPE vbak-vbeln.
DATA:BEGIN OF i_adr6 OCCURS 0,
addrnumber LIKE adr6-addrnumber,
consnumber LIKE adr6-consnumber,
smtp_addr LIKE adr6-smtp_addr,
END OF i_adr6.
v_vbeln = vbeln.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Z_SD_SSF_QUOTATION'
IMPORTING
fm_name = v_form_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
CALL FUNCTION v_form_name "'/1BCDWB/SF00000093'
EXPORTING
control_parameters = w_ctrlop
output_options = w_compop
user_settings = 'X'
p_vbeln = v_vbeln
IMPORTING
job_output_info = w_return
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
i_otf[] = w_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
ENDIF.
LOOP AT i_tline.
TRANSLATE i_tline USING '~'.
CONCATENATE wa_buffer i_tline INTO wa_buffer.
ENDLOOP.
TRANSLATE wa_buffer USING '~'.
DO.
i_record = wa_buffer.
APPEND i_record.
SHIFT wa_buffer LEFT BY 255 PLACES.
IF wa_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
*---Attachment
REFRESH:i_reclist,
i_objtxt,
i_objbin,
i_objpack.
CLEAR wa_objhead.
i_objbin[] = i_record[].
*---Create Message Body Title and Description
i_objtxt = 'PDF-Attachment Of Quotation!'.
APPEND i_objtxt.
DESCRIBE TABLE i_objtxt LINES v_lines_txt.
READ TABLE i_objtxt INDEX v_lines_txt.
DATA: v_str1 TYPE char12,
v_str2 TYPE char50.
CONCATENATE 'Quotation' '-' v_vbeln INTO v_str2 SEPARATED BY space.
wa_doc_chng-obj_name = 'smartform'.
wa_doc_chng-expiry_dat = sy-datum + 10.
wa_doc_chng-obj_descr = v_str2.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = v_lines_txt * 255.
*---Main Text
CLEAR i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.
APPEND i_objpack.
*---Attachment (pdf-Attachment)
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
DESCRIBE TABLE i_objbin LINES v_lines_bin.
READ TABLE i_objbin INDEX v_lines_bin.
i_objpack-doc_size = v_lines_bin * 255 .
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'smart'.
i_objpack-obj_descr = 'Quotation'.
APPEND i_objpack.
SELECT SINGLE * FROM vbak WHERE vbeln = v_vbeln.
SELECT SINGLE * FROM kna1 WHERE kunnr = vbak-kunnr.
*---Getting the Multiple MAIL ID'S in this Vendor
SELECT addrnumber
consnumber
smtp_addr
FROM adr6 INTO TABLE i_adr6
WHERE addrnumber = kna1-adrnr
AND flg_nouse = space.
*---Adding the Multiple mail id into Receiptant list
LOOP AT i_adr6.
i_reclist-receiver = i_adr6-smtp_addr.
i_reclist-rec_type = 'U'.
APPEND i_reclist.
CLEAR: i_reclist,i_adr6.
ENDLOOP.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = i_objpack
object_header = wa_objhead
contents_bin = i_objbin
contents_txt = i_objtxt
receivers = i_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.
ENDFUNCTION. -
PO Output - Simple Mail.
Hi,
I configured new PO output type for simple mail. I cannot get the output type to default onto the PO. In the determination analysis screen within the PO messages screen, it finds the condition record, but also has another error:
Message 539: No partner was found for Partner function MP
I assume this is the reason why the output is not defaulting. How do i resolve this such that the output type defaults?
Cheers,Hi,
Please check customising, Check your setting for partner role MP
in partner schema
IMG .> MM > Purchasing > Partner Determination
> Partner Settings in Purchasing documents
> Define Partner Schemas
Check your settings for partner role MP in partner schema XXXX:
- no change
- mandatory
- end
- higherLvl
The recommended settings for these four parameters are yes/yes/no/yes.
Kind regards,
Lorraine -
Send the billing output by e-mail for the user
Hi,
Can you tell me if it's possible to send the billing output by e-mail (Medium = 5 - External send) for the user that create the billing document? the e-mail of the user is in SU01D.
Thanks in advance
DoraHi Dora,
What you can do is when you want to send a mail to customer after you receive the email for bill is do the following settings.
1) Create a condition record VV31 with the required Key combination where you can give the name of the Employee or end user with the email id.
2) Select the trasmission medium as 7 ( Simple Mail)
3) Once the Billing is done E-Mail will be triggered.
4) Downlaod it or forward it to your client with the additional text in the E-Mail.
Hope this helps.
Thanks and Regards
Rohit Dujari -
Quotation output through e-mail
Hi All,
I am working on quotation, i need to send quotation output through e-mail to distributors, i am not finding output type(Method) e-mail in output types in IMG , please help in how to configure this.send me any document related to this to the email ID [email protected]
Regards
satyaHi Satya,
Please make sure the following configurations are done.
1. Goto transaction v/30 choose the output type(SAP provides default output type MAIL for sending emails). Go to the detail view of the output type and to the tab -> default value, Select the transamission medium Simple mail , In the partner functions select the partner function MP.
2.Goto spro->output control settings, Make sure that this output type is added to the output determination procedure.
3.Make sure that the output det procedure is assigned to the sales document header or at the item level.
4.Maintain the condition records for the output type.
If all these settings are apt in your system, You shudn't have any problems in getting the ouput generated.
Let me know if your problem is solved..
Regards,
Girish -
Hi,
I am testing the simple mail functionality in transaction VA01.
In customizing (output determination processing routines) for simple mail is being used a program and a smartform. It was not me who developed them.
The problem is that when I try to test this through VA01 (I choose simple mail, etc), I get a dump saying: Invalid commit work in an update function module. Termination occurred in the ABAP program SAPLSOI1 in SO_DOCUMENT_SEND_API1. The main program was RSM13000.
My problem now is how can I try to debug this when I am in transaction VA02? I am not able to execute the program I have in customizing
How can I found more information about this?
Thanks a lotWeird..
I am working with SAP ECC 6.0 - release 700
In version history no one has modified the program...
function so_document_send_api1.
""Lokale Schnittstelle:
*" IMPORTING
*" VALUE(DOCUMENT_DATA) LIKE SODOCCHGI1 STRUCTURE SODOCCHGI1
*" VALUE(PUT_IN_OUTBOX) LIKE SONV-FLAG DEFAULT SPACE
*" VALUE(SENDER_ADDRESS) LIKE SOEXTRECI1-RECEIVER DEFAULT SY-UNAME
*" VALUE(SENDER_ADDRESS_TYPE) LIKE SOEXTRECI1-ADR_TYP DEFAULT 'B'
*" VALUE(COMMIT_WORK) LIKE SONV-FLAG DEFAULT SPACE
*" EXPORTING
*" VALUE(SENT_TO_ALL) LIKE SONV-FLAG
*" VALUE(NEW_OBJECT_ID) LIKE SOFOLENTI1-OBJECT_ID
*" VALUE(SENDER_ID) LIKE SOUDK STRUCTURE SOUDK
*" TABLES
*" PACKING_LIST STRUCTURE SOPCKLSTI1
*" OBJECT_HEADER STRUCTURE SOLISTI1 OPTIONAL
*" CONTENTS_BIN STRUCTURE SOLISTI1 OPTIONAL
*" CONTENTS_TXT STRUCTURE SOLISTI1 OPTIONAL
*" CONTENTS_HEX STRUCTURE SOLIX OPTIONAL
*" OBJECT_PARA STRUCTURE SOPARAI1 OPTIONAL
*" OBJECT_PARB STRUCTURE SOPARBI1 OPTIONAL
*" RECEIVERS STRUCTURE SOMLRECI1
*" EXCEPTIONS
*" TOO_MANY_RECEIVERS
*" DOCUMENT_NOT_SENT
*" DOCUMENT_TYPE_NOT_EXIST
*" OPERATION_NO_AUTHORIZATION
*" PARAMETER_ERROR
*" X_ERROR
*" ENQUEUE_ERROR
data begin of object_hd_change.
include structure sood1.
data end of object_hd_change.
data begin of attach_hd_change.
include structure sood1.
data end of attach_hd_change.
data begin of object_data.
include structure soodd.
data end of object_data.
data begin of objhead occurs 1.
include structure soli.
data end of objhead.
data begin of objcont occurs 100.
include structure soli.
data end of objcont.
data begin of atthead_tab occurs 1.
include structure soli.
data end of atthead_tab.
data begin of attcont_tab occurs 10.
include structure soli.
data end of attcont_tab.
data begin of atthead occurs 1.
include structure soli.
data end of atthead.
data begin of attcont occurs 10.
include structure soli.
data end of attcont.
data begin of new_pack_list occurs 10.
include structure soxpl.
data end of new_pack_list.
data begin of rec_table occurs 10.
include structure soos1.
data end of rec_table.
data begin of object_fl_change.
include structure sofm1.
data end of object_fl_change.
data rcode like sonv-rcode.
data object_type like sood-objtp.
data object_id_new like soodk.
data file_format(3).
data: originator like soos1-recextnam,
originator_type like soos1-recesc.
data: hex_size like sy-tabix.
data: old_object like swotobjid,
* sh070900 5.0A reconvert R30 into OBJ Docs is possible.
sood_id like soodk.
data: old_folder_id like soodk,
old_object_id like soodk,
old_forwarder like soud-usrnam,
old_object_data like sood2.
data hex_mode type sonv-flag value space.
data dummy_hex type solix_tab.
**data i.
**if sy-uname = ''
while i ne 1.
endwhile.
**endif.
describe table contents_bin lines hex_size.
if hex_size gt 0.
call function 'SO_CONVERT_CONTENTS_BIN'
exporting
it_contents_bin = contents_bin[]
importing
et_contents_bin = contents_bin[].
data l_new_size type i.
data l_line_size type i.
data l_new_doc_size type i.
describe table contents_bin lines l_new_size.
if l_new_size <> hex_size.
describe field contents_bin-line length l_line_size in character mode.
loop at packing_list where transf_bin = on.
packing_list-body_start = packing_list-body_start * 2 - 1.
packing_list-body_num = packing_list-body_num * 2.
l_new_doc_size = packing_list-body_num * l_line_size / 2.
if packing_list-doc_size <= l_new_doc_size.
packing_list-doc_size = l_new_doc_size * 2.
endif.
modify packing_list.
endloop.
endif.
endif.
describe table contents_hex lines hex_size.
if hex_size gt 0.
refresh contents_bin.
MOVE CONTENTS_HEX[] TO CONTENTS_BIN[].
hex_to_cont contents_hex contents_bin.
endif.
* transfer document data
perform transfer_objdat_to_obj using document_data
object_hd_change
object_fl_change.
perform set_default_object_data using object_hd_change.
* read object out of table
* take API1, so no receiver conversion is necessary here
read table packing_list index 1. "first object is document
if sy-subrc ne ok. "no packing list
raise parameter_error.
endif.
perform read_object_out_of_tables tables object_header
contents_txt
contents_bin
objhead
objcont
using packing_list
object_data
rcode.
* parameters for tracing
LOOP AT OBJHEAD.
PERFORM TRACE(RSSOEXTR) USING 'OBJHEAD' OBJHEAD-LINE.
ENDLOOP.
if rcode ne ok. "no object found
raise parameter_error.
endif.
* out of object data use only extern content flag and perhaps the size
move object_data-extct to object_hd_change-extct.
if object_hd_change-objlen = 0 or
object_hd_change-objlen is initial.
move object_data-objlen to object_hd_change-objlen.
endif.
perform format_prepare_for_insert in program sapfssoa "873845
using packing_list-transf_bin
dummy_hex
changing objhead[]
objcont[]
packing_list-doc_type
object_hd_change-file_ext
rcode.
move packing_list-doc_type to object_type.
* for old types move size to header
perform size_to_header tables objhead
using object_type
document_data-doc_size.
get now all attachments, decreibed in packing list
refresh new_pack_list.
refresh atthead_tab.
refresh attcont_tab.
loop at packing_list from 2.
clear new_pack_list.
perform read_object_out_of_tables tables object_header
contents_txt
contents_bin
atthead
attcont
using packing_list
object_data
rcode.
check rcode = ok.
* sh240899 46C check for executable mail attachment (MAPI)
if packing_list-doc_type = 'R3O'.
read table attcont index 21 into old_object.
if old_object-objtype = 'SOFM'.
read table attcont index 22.
if attcont = 'PROCESS'.
* it's an attachment created by MAPI because of an executable
* mail
* read old mail and fill new one with process parameters
move: old_object-objkey(17) to old_folder_id,
old_object-objkey+17(17) to old_object_id,
old_object-objkey+34(12) to old_forwarder.
call function 'SO_OBJECT_READ'
exporting
folder_id = old_folder_id
forwarder = old_forwarder
object_id = old_object_id
importing
object_hd_display = old_object_data
tables
objpara = object_para
objparb = object_parb
exceptions
folder_not_exist = 4
folder_no_authorization = 5
object_not_exist = 6
object_no_authorization = 7
operation_no_authorization = 8
owner_not_exist = 9
parameter_error = 10
others = 15.
if sy-subrc = 0.
move: old_object_data-vmtyp to object_hd_change-vmtyp,
old_object_data-skips to object_hd_change-skips,
old_object_data-acnam to object_hd_change-acnam,
old_object_data-acmem to object_hd_change-acmem.
endif.
continue.
elseif attcont = 'DISPLAYATTACHMENT'.
* sh070900 5.0A reconvert R30 into OBJ Docs is possible.
* get object instance and method into attachment body
refresh: attcont, atthead.
move old_object-objkey+17(17) to sood_id.
perform socx_select(sapfsso0) tables atthead
attcont
object_para
object_parb
using sood_id
hex_mode
rcode.
move atthead[] to attcont[].
* fill new packing list parameter
describe table atthead lines packing_list-head_num.
describe table attcont lines packing_list-body_num.
packing_list-doc_size = '255'.
packing_list-doc_type = obj.
endif.
endif.
endif.
move-corresponding packing_list to new_pack_list.
move: packing_list-obj_descr to new_pack_list-objdes,
packing_list-obj_name to new_pack_list-objnam,
packing_list-doc_size to new_pack_list-objlen,
packing_list-obj_langu to new_pack_list-objla,
packing_list-mess_type to new_pack_list-extct,
packing_list-doc_type to new_pack_list-objtp,
packing_list-transf_bin to new_pack_list-transf_bin."873845
describe table atthead_tab lines new_pack_list-head_start.
add 1 to new_pack_list-head_start.
describe table attcont_tab lines new_pack_list-body_start.
add 1 to new_pack_list-body_start.
perform format_prepare_for_insert in program sapfssoa "873845
using packing_list-transf_bin
dummy_hex
changing atthead[]
attcont[]
new_pack_list-objtp
new_pack_list-file_ext
rcode.
get new sizes (also for attcont, someone forgot this...)
describe table atthead lines new_pack_list-head_num.
describe table attcont lines new_pack_list-body_num.
loop at atthead.
clear atthead_tab.
move atthead to atthead_tab.
append atthead_tab.
endloop.
loop at attcont.
clear attcont_tab.
move attcont to attcont_tab.
append attcont_tab.
endloop.
append new_pack_list.
endloop.
* transfer receiver data
perform transfer_rec_to_tab tables receivers
rec_table.
* sender in right format
move sender_address to originator.
perform convert_sndart_esc using sender_address_type
originator_type.
call function 'SO_OBJECT_SEND'
exporting
EXTERN_ADDRESS = ' '
FOLDER_ID = ' '
FORWARDER = ' '
object_fl_change = object_fl_change
object_hd_change = object_hd_change
OBJECT_ID = ' '
object_type = object_type
outbox_flag = put_in_outbox
originator = originator
originator_type = originator_type
OWNER = ' '
STORE_FLAG = ' '
importing
object_id_new = object_id_new
sent_to_all = sent_to_all
originator_id = sender_id
tables
objcont = objcont
objhead = objhead
objpara = object_para
objparb = object_parb
packing_list = new_pack_list
att_head = atthead_tab
att_cont = attcont_tab
receivers = rec_table
exceptions
object_not_sent = 15
object_type_not_exist = 17
operation_no_authorization = 21
parameter_error = 23
too_much_receivers = 73
others = 1000.
case sy-subrc.
when ok.
move object_id_new to new_object_id.
when object_not_sent.
perform transfer_tab_to_rec tables rec_table
receivers.
raise document_not_sent.
when too_much_receivers.
raise too_many_receivers.
when object_type_not_exist.
raise document_type_not_exist.
when operation_no_authorization.
raise operation_no_authorization.
when parameter_error.
raise parameter_error.
when others.
raise x_error.
endcase.
MOVE OBJECT_ID TO NEW_OBJECT_ID.
perform transfer_tab_to_rec tables rec_table
receivers.
set commit work
if commit_work = on.
commit work.
endif.
endfunction. -
Hi Sd Gurus
i change the output type medium from printout to simple-mail. i got a error( Mail partner not found or empty! Obj
created without partner!). please give the solution.
ThanksHi Hari,
Please Check that you assigned any partner function to the output type.
and that e-mail address is maintained for your required partner.
Thanks
Dasaradha -
Using Simple Mail option In VL03n
In VL03N, in the output, there is a option of Simple Mail ( nast-nacha = 7), wherein we can directly specify the email Id of the receiver of the delivery note.
Can anybody guide me so as what coding needs to be done,if any, in the smartfrom print program so as the mail can be sent to the specified email Id.
Any other pointers to solve this issue are also welcome.
Useful Replies will be highly appreciated and rewarded
Thanks in advance
KrishnaHi Krishna,
I am not aware of smartfomrs. it can be done through scripts by using two function module, one is for converting the output into pdf and another is for send mail.
Regards,
Kumar. -
Sending report output via E-mail (excel pivoted format)
Hi all,
i have a written a report where i need to send the report output to somebody via
E-mail.i am sending this report output via E-mail successfully.The receiver receives, my output in excel format.but this excel is not <b>pivoted</b>.
i want , the receiver should get my output in pivoted excel format.i.e my output data should be exactly fit in the excel sheet.
now the columns in excel sheet are overlapping.once i double clicked, the columns are getting separated.i do not want to double click.i want all the columns should come properly i.e excel field length should be adjusted as per the output field length.
i am giving my coding below.plz suggest how i can do the above thing .it's urgent.
any idea will be highly appreaciated.
Regards
if not p_email1 is initial.
perform fill_report_csv.
perform f_send_internet_mail.
endif.
FORM fill_report_csv.
data : l_text(232) type c,
v_matnr1(21) type c,
v_matnr(21) type c,
v_matkl(14) type c,
v_maktx(45) type c,
v_ttlstk(14) type c,
v_verpr(14) type c,
v_werks(14) type c,
v_lgort(14) type c,
v_char(10) type c,
v_stks type p ,
v_po(40) type c,
v_qty(13) type c,
v_qty1 type sy-datum,
v_date(15) type c,
v_date1(15) TYPE C,
v_name(35) type c,
v_eknam(18) type c,
v_lifnr(15) type c,
l_po(40) type c,
v_matnr(20) type c,
l_rate(11) type p decimals 5,
l_flag type c.
concatenate c_equal c_colon 'PO no.' c_colon
into v_po.
concatenate c_equal c_colon 'Material no.' c_colon
into v_matnr.
concatenate c_equal c_colon 'Description.' c_colon
into v_maktx.
concatenate c_equal c_colon 'Due Qty.' c_colon
into v_qty.
concatenate c_equal c_colon 'Del Date.' c_colon
into v_date.
concatenate c_equal c_colon 'Vendor.' c_colon
into v_name.
concatenate c_equal c_colon 'Buyer.' c_colon
into v_eknam.
concatenate c_equal c_colon 'Vendor Code.' c_colon
into v_lifnr.
concatenate
v_po v_matnr v_maktx v_qty
v_date v_name v_eknam v_lifnr
into i_download
SEPARATED BY con_tab.
append i_download .
clear : v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
clear wa_output.
loop at i_output into wa_output.
on change of wa_output-ebeln.
clear v_lines.
loop at i_eket into wa_eket
where ebeln = wa_output-ebeln.
v_lines = v_lines + 1.
clear wa_eket.
endloop.
**-- Checking of page break
v_lines = sy-linno + v_lines .
if 55 < v_lines .
write:/0(161) sy-uline.
new-page.
endif.
clear v_lines.
loop at i_eket into wa_eket
where ebeln = wa_output-ebeln.
v_lines = v_lines + 1.
clear wa_eket.
endloop.
*-- Calculating the due qty.
wa_output-dumng = wa_output-menge - wa_output-wemng.
*-- Writing the Line items of the PO.
read table i_ekpo into wa_ekpo
with key ebeln = wa_output-ebeln
ebelp = wa_output-ebelp.
l_rate = wa_ekpo-netpr / wa_ekpo-peinh.
*-- Writing of PO detail
if wa_output-dumng gt 0 .
v_qty = wa_output-dumng.
v_date1 = wa_output-eindt.
v_maktx = wa_output-maktx.
if wa_output-maktx+0(1) = '"' .
concatenate c_equal wa_output-maktx
into v_maktx .
else .
concatenate c_equal c_colon wa_output-maktx c_colon
into v_maktx .
endif .
if wa_output-name1+0(1) = '"' .
concatenate c_equal wa_output-name1
into v_name .
else .
concatenate c_equal c_colon wa_output-name1 c_colon
into v_name .
endif .
v_name = wa_output-name1.
v_lifnr = wa_output-lifnr.
write wa_output-eindt to v_date1 DD/MM/YYYY.
concatenate '="' wa_output-ebeln '/'
wa_output-ebelp '"' into v_po .
concatenate '="' wa_output-matnr '"' into v_matnr .
concatenate c_equal c_colon wa_output-maktx c_colon
into v_maktx .
concatenate c_equal c_colon wa_output-dumng c_colon
into v_qty1 .
concatenate c_equal c_colon wa_output-eindt c_colon
into v_date1 .
concatenate c_equal c_colon wa_output-name1 c_colon
into v_name .
concatenate c_equal c_colon wa_output-eknam c_colon
into v_eknam .
concatenate c_equal c_colon wa_output-lifnr c_colon
into v_lifnr .
concatenate c_equal c_colon wa_mard-werks '/'
wa_mard-lgort c_colon
into v_lgort .
concatenate '="' wa_output-lifnr '"' into v_lifnr .
condense:v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
concatenate
v_po v_matnr v_maktx v_qty
v_date1 v_name v_eknam v_lifnr
into i_download
SEPARATED BY con_tab.
concatenate con_cret i_download INTO i_download .
append i_download .
endif.
clear : v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
endloop.
ENDFORM. " fill_report_csv
*& Form f_send_internet_mail
text
--> p1 text
<-- p2 text
FORM f_send_internet_mail.
Variables
data: it_packing_list like sopcklsti1 occurs 0 with header line,
it_contents like solisti1 occurs 0 with header line,
it_receivers like somlreci1 occurs 0 with header line,
it_attachment like solisti1 occurs 0 with header line,
gd_cnt type i,
gd_sent_all(1) type c,
gd_doc_data like sodocchgi1,
gd_error type sy-subrc.
data: it_message type standard table of SOLISTI1 initial size 0
with header line.
data : found_receiver type c,
v_title(80) type c,
l_text(180) type c.
Fill the document data.
gd_doc_data-doc_size = 1.
Adds text to email text table
append 'Pls see attached open purchase order report.' to it_message.
append '' to it_message.
concatenate 'Note: This is system generated report'
', figures may subject to actual physical count.'
into l_text separated by space.
append l_text to it_message.
Populate the subject/generic message attributes
CLEAR gd_doc_data.
READ TABLE i_download INDEX w_cnt.
gd_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( i_download ).
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SAPRPT'.
if p_asdate is initial .
concatenate p_title ' '
sy-datum sy-uzeit into v_title separated by space.
else .
concatenate p_title ' '
p_bldat p_cputm into v_title separated by space.
endif .
gd_doc_data-obj_descr = v_title .
gd_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = i_download[].
Describe the body of the message
clear it_packing_list.
refresh it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
describe table it_message lines it_packing_list-body_num.
it_packing_list-doc_type = 'RAW'.
append it_packing_list.
Create attachment notification
it_packing_list-transf_bin = 'X'.
it_packing_list-head_start = 1.
it_packing_list-head_num = 1.
it_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES it_packing_list-body_num.
it_packing_list-doc_type = 'XLS'.
it_packing_list-obj_descr = 'OPEN PURCHASE ORDER' .
it_packing_list-obj_name = 'PO.XLS' .
it_packing_list-doc_size = it_packing_list-body_num * 255.
APPEND it_packing_list.
assign SAP user smtp address from successful retrieval.
loop at p_email.
Add the recipients email address
found_receiver = 'X' .
it_receivers-receiver = p_email-low.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = ''.
it_receivers-notif_ndel = 'X'.
append it_receivers .
endloop .
Add default recipient email when unable to locate purc group email
if found_receiver is initial .
it_receivers-receiver = p_email.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = ''.
it_receivers-notif_ndel = 'X'.
append it_receivers.
endif .
Call the FM to post the message to SAPMAIL
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
importing
sent_to_all = gd_sent_all
tables
packing_list = it_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = it_receivers
exceptions
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.
Store function module return code
gd_error = sy-subrc.
Get it_receivers return code
loop at it_receivers.
endloop.
Instructs mail send program for SAPCONNECT to send email.
wait up to 2 seconds.
if gd_error eq 0.
submit rsconn01 with mode = 'INT'
with output = ' '
and return.
endif.
ENDFORM. " f_send_internet_mailHi,
go through this link,
http://www.sapdevelopment.co.uk/reporting/email/emailhome.htm
you have some sample programs.
Regards,
Raghavendra -
Hi all,
i have a written a report where i need to send the report output to somebody via
E-mail.i am sending this report output via E-mail successfully.The receiver receives, my output in excel format.but this excel is not <b>pivoted</b>.
i want , the receiver should get my output in pivoted excel format.i.e my output data should be exactly fit in the excel sheet.
now the columns in excel sheet are overlapping.once i double clicked, the columns are getting separated.i do not want to double click.i want all the columns should come properly i.e excel field length should be adjusted as per the output field length.
i am giving my coding below.plz suggest how i can do the above thing .it's urgent.
any idea will be highly appreaciated.
Regards
if not p_email1 is initial.
perform fill_report_csv.
perform f_send_internet_mail.
endif.
FORM fill_report_csv.
data : l_text(232) type c,
v_matnr1(21) type c,
v_matnr(21) type c,
v_matkl(14) type c,
v_maktx(45) type c,
v_ttlstk(14) type c,
v_verpr(14) type c,
v_werks(14) type c,
v_lgort(14) type c,
v_char(10) type c,
v_stks type p ,
v_po(40) type c,
v_qty(13) type c,
v_qty1 type sy-datum,
v_date(15) type c,
v_date1(15) TYPE C,
v_name(35) type c,
v_eknam(18) type c,
v_lifnr(15) type c,
l_po(40) type c,
v_matnr(20) type c,
l_rate(11) type p decimals 5,
l_flag type c.
concatenate c_equal c_colon 'PO no.' c_colon
into v_po.
concatenate c_equal c_colon 'Material no.' c_colon
into v_matnr.
concatenate c_equal c_colon 'Description.' c_colon
into v_maktx.
concatenate c_equal c_colon 'Due Qty.' c_colon
into v_qty.
concatenate c_equal c_colon 'Del Date.' c_colon
into v_date.
concatenate c_equal c_colon 'Vendor.' c_colon
into v_name.
concatenate c_equal c_colon 'Buyer.' c_colon
into v_eknam.
concatenate c_equal c_colon 'Vendor Code.' c_colon
into v_lifnr.
concatenate
v_po v_matnr v_maktx v_qty
v_date v_name v_eknam v_lifnr
into i_download
SEPARATED BY con_tab.
append i_download .
clear : v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
clear wa_output.
loop at i_output into wa_output.
on change of wa_output-ebeln.
clear v_lines.
loop at i_eket into wa_eket
where ebeln = wa_output-ebeln.
v_lines = v_lines + 1.
clear wa_eket.
endloop.
**-- Checking of page break
v_lines = sy-linno + v_lines .
if 55 < v_lines .
write:/0(161) sy-uline.
new-page.
endif.
clear v_lines.
loop at i_eket into wa_eket
where ebeln = wa_output-ebeln.
v_lines = v_lines + 1.
clear wa_eket.
endloop.
*-- Calculating the due qty.
wa_output-dumng = wa_output-menge - wa_output-wemng.
*-- Writing the Line items of the PO.
read table i_ekpo into wa_ekpo
with key ebeln = wa_output-ebeln
ebelp = wa_output-ebelp.
l_rate = wa_ekpo-netpr / wa_ekpo-peinh.
*-- Writing of PO detail
if wa_output-dumng gt 0 .
v_qty = wa_output-dumng.
v_date1 = wa_output-eindt.
v_maktx = wa_output-maktx.
if wa_output-maktx+0(1) = '"' .
concatenate c_equal wa_output-maktx
into v_maktx .
else .
concatenate c_equal c_colon wa_output-maktx c_colon
into v_maktx .
endif .
if wa_output-name1+0(1) = '"' .
concatenate c_equal wa_output-name1
into v_name .
else .
concatenate c_equal c_colon wa_output-name1 c_colon
into v_name .
endif .
v_name = wa_output-name1.
v_lifnr = wa_output-lifnr.
write wa_output-eindt to v_date1 DD/MM/YYYY.
concatenate '="' wa_output-ebeln '/'
wa_output-ebelp '"' into v_po .
concatenate '="' wa_output-matnr '"' into v_matnr .
concatenate c_equal c_colon wa_output-maktx c_colon
into v_maktx .
concatenate c_equal c_colon wa_output-dumng c_colon
into v_qty1 .
concatenate c_equal c_colon wa_output-eindt c_colon
into v_date1 .
concatenate c_equal c_colon wa_output-name1 c_colon
into v_name .
concatenate c_equal c_colon wa_output-eknam c_colon
into v_eknam .
concatenate c_equal c_colon wa_output-lifnr c_colon
into v_lifnr .
concatenate c_equal c_colon wa_mard-werks '/'
wa_mard-lgort c_colon
into v_lgort .
concatenate '="' wa_output-lifnr '"' into v_lifnr .
condense:v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
concatenate
v_po v_matnr v_maktx v_qty
v_date1 v_name v_eknam v_lifnr
into i_download
SEPARATED BY con_tab.
concatenate con_cret i_download INTO i_download .
append i_download .
endif.
clear : v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
endloop.
ENDFORM. " fill_report_csv
*& Form f_send_internet_mail
text
--> p1 text
<-- p2 text
FORM f_send_internet_mail.
Variables
data: it_packing_list like sopcklsti1 occurs 0 with header line,
it_contents like solisti1 occurs 0 with header line,
it_receivers like somlreci1 occurs 0 with header line,
it_attachment like solisti1 occurs 0 with header line,
gd_cnt type i,
gd_sent_all(1) type c,
gd_doc_data like sodocchgi1,
gd_error type sy-subrc.
data: it_message type standard table of SOLISTI1 initial size 0
with header line.
data : found_receiver type c,
v_title(80) type c,
l_text(180) type c.
Fill the document data.
gd_doc_data-doc_size = 1.
Adds text to email text table
append 'Pls see attached open purchase order report.' to it_message.
append '' to it_message.
concatenate 'Note: This is system generated report'
', figures may subject to actual physical count.'
into l_text separated by space.
append l_text to it_message.
Populate the subject/generic message attributes
CLEAR gd_doc_data.
READ TABLE i_download INDEX w_cnt.
gd_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( i_download ).
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SAPRPT'.
if p_asdate is initial .
concatenate p_title ' '
sy-datum sy-uzeit into v_title separated by space.
else .
concatenate p_title ' '
p_bldat p_cputm into v_title separated by space.
endif .
gd_doc_data-obj_descr = v_title .
gd_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = i_download[].
Describe the body of the message
clear it_packing_list.
refresh it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
describe table it_message lines it_packing_list-body_num.
it_packing_list-doc_type = 'RAW'.
append it_packing_list.
Create attachment notification
it_packing_list-transf_bin = 'X'.
it_packing_list-head_start = 1.
it_packing_list-head_num = 1.
it_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES it_packing_list-body_num.
it_packing_list-doc_type = 'XLS'.
it_packing_list-obj_descr = 'OPEN PURCHASE ORDER' .
it_packing_list-obj_name = 'PO.XLS' .
it_packing_list-doc_size = it_packing_list-body_num * 255.
APPEND it_packing_list.
assign SAP user smtp address from successful retrieval.
loop at p_email.
Add the recipients email address
found_receiver = 'X' .
it_receivers-receiver = p_email-low.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = ''.
it_receivers-notif_ndel = 'X'.
append it_receivers .
endloop .
Add default recipient email when unable to locate purc group email
if found_receiver is initial .
it_receivers-receiver = p_email.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = ''.
it_receivers-notif_ndel = 'X'.
append it_receivers.
endif .
Call the FM to post the message to SAPMAIL
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
importing
sent_to_all = gd_sent_all
tables
packing_list = it_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = it_receivers
exceptions
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.
Store function module return code
gd_error = sy-subrc.
Get it_receivers return code
loop at it_receivers.
endloop.
Instructs mail send program for SAPCONNECT to send email.
wait up to 2 seconds.
if gd_error eq 0.
submit rsconn01 with mode = 'INT'
with output = ' '
and return.
endif.
ENDFORM. " f_send_internet_mailans
-
ALV output to be mailed in excel format
Hi All,
Currently we have a alv grid report, but my user requirement is he want this alv grid output to be mailed to his mail id in excel format.
some times data may be huge of about 8000 - 10,000 lines.
is it possiable.
can any one help.hi check this code
Here i'm posting u sample code try to execute it. It will convert all the data in the related tables to excel format and transfer it to respective mail id
code&----
*& Report ZTESTMAIL *
REPORT ZTESTMAIL .
tables: ekko.
parameters: p_email type somlreci1-receiver .
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.
t_object_header = 'Text.xls'. append t_object_header.
*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
object_header = t_object_header
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
*PARAMETERS: psubject(40) type c default 'Testing',
*p_email(40) type c . "use ur email id
*data: it_packing_list like sopcklsti1 occurs 0 with header line,
*it_contents like solisti1 occurs 0 with header line,
*it_receivers like somlreci1 occurs 0 with header line,
*it_attachment like solisti1 occurs 0 with header line,
*gd_cnt type i,
*gd_sent_all(1) type c,
*gd_doc_data like sodocchgi1,
*gd_error type sy-subrc.
*data: it_message type standard table of SOLISTI1 initial size 0
*with header line.
**START-OF-SELECTION.
*START-OF-SELECTION.
*Perform populate_message_table.
**Send email message, although is not sent from SAP until mail send
**program has been executed(rsconn01)
*PERFORM send_email_message.
**Instructs mail send program for SAPCONNECT to send email(rsconn01)
*perform initiate_mail_execute_program.
**& Form POPULATE_MESSAGE_TABLE
Adds text to email text table
*form populate_message_table.
*Append 'Line1' to it_message.
*Append 'Line2' to it_message.
*Append 'Line3' to it_message.
*Append 'Test- 1' to it_message.
*endform. " POPULATE_MESSAGE_TABLE
**& Form SEND_EMAIL_MESSAGE
Send email message
*form send_email_message.
Fill the document data.
*gd_doc_data-doc_size = 1.
DATA: TAB_LINES LIKE sy-tabix.
DESCRIBE TABLE it_message LINES TAB_LINES.
READ TABLE it_message INDEX TAB_LINES.
gd_doc_data-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( it_message )
Populate the subject/generic message attributes
*gd_doc_data-obj_langu = sy-langu.
*gd_doc_data-obj_name = 'SAPRPT'.
*gd_doc_data-obj_descr = psubject.
*gd_doc_data-sensitivty = 'F'.
Describe the body of the message
Information about structure of data tables
*clear it_packing_list.
*refresh it_packing_list.
*it_packing_list-transf_bin = space.
*it_packing_list-head_start = 1.
*it_packing_list-head_num = 0.
*it_packing_list-body_start = 1.
*describe table it_message lines it_packing_list-body_num.
*it_packing_list-doc_type = 'RAW'.
*append it_packing_list.
Add the recipients email address
*clear it_receivers.
*refresh it_receivers.
*it_receivers-receiver = p_email.
*it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = 'X'.
it_receivers-notif_ndel = 'X'.
*append it_receivers.
Call the FM to post the message to SAPMAIL
*call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
*exporting
*document_data = gd_doc_data
*put_in_outbox = 'X'
*importing
*sent_to_all = gd_sent_all
*tables
*packing_list = it_packing_list
*contents_txt = it_message
*receivers = it_receivers
*exceptions
*too_many_receivers = 1
*document_not_sent = 2
*document_type_not_exist = 3
*operation_no_authorization = 4
*parameter_error = 5
*x_error = 6
*enqueue_error = 7
*others = 8.
Store function module return code
*gd_error = sy-subrc.
Get it_receivers return code
*loop at it_receivers.
*endloop.
*endform. " SEND_EMAIL_MESSAGE
**& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
*form initiate_mail_execute_program.
*wait up to 2 seconds.
*if gd_error eq 0.
*submit rsconn01 with mode = 'INT'
*with output = 'X'
*and return.
*endif.
*endform. " INITIATE_MAIL_EXECUTE_PROGRAM
[/code] -
Need to choose fields from alv grid output and send mail
Hi,
I need to choose few orders from alv grid output and send mail as PDF for chosen orders.
Suggest if possible and how.Moderator message - Please do not post your requirements and ask the forum to do your work for you - post locked
Rob -
Simple Mail vs. External Send
Dear Experts,
does anybody know what the difference between email sending method 'SIMPLE MAIL' and 'EXTERNAL SEND' is?
Thanks a lot for any suggestion!
Best regards,
Marchi,
Check these links..
[SIMPLE MAIL TRANSFER PROTOCOL|http://help.sap.com/saphelp_nwpi71/helpdata/en/6b/4493404f673028e10000000a1550b0/frameset.htm]
[External Sending in the SAP System |http://help.sap.com/saphelp_nw70/helpdata/en/55/a8b538891b11d2a25a00a0c943858e/frameset.htm] -
Hi friends,
Please help me out . How to configure the billing output by E-mail to customer
Thanks
SaiHi Sai Krishna,
If your SD output configuration is set up correctly, an e-mail from SAP using medium 5 should go through just fine via SAPconnect (transaction SCOT). When it works, the external recipient should receive an e-mail with a PDF attachment containing the form image, regardless of whether it has been created via SAPscript or Smart Forms. Depending on your output determination settings, this even can happen in the background, without any interaction with the SAP front end (e.g. for invoices created automatically by a batch job).
Typically, a failed send will be flagged in the message control table (NAST), and this table should be monitored closely. However, there are many reasons why a document hasn't gone through, and this can be the case with both outgoing faxes and e-mails from SAP. The solution to both is the same: After identifying the failed document, re-send it manually by going inside it in change mode and repeating the appropriate output. If an obsolete customer e-mail address was the culprit, a customer master change would also be required, along with an audit of any docs recently created for this customer.
If any underlying data has changed since initial issuance, a re-sent document may not appear identical to the (failed) original. Sometimes, as when address info has been corrected, this can be a good thing. After all, the new document is more accurate than the old one.
In other cases, such as when pricing info has changed, it might be a cause for serious concern. There are several ways to deal with this concern:
1) Limit the types of changes allowed on certain docs after creation
2) Set up a doc image archive via ArchiveLink and re-issue output from there instead of from the current doc; or
3) For highly sensitive docs, consider a more secure delivery method.
REFER BELOW LINK
Sending a Smart Form output via e-mail
you need to maintain the email address of the customer in the customer master and then need to configure the output type in the NACE transction .and in the settings choose the medium as email.
http://help.sap.com/saphelp_nw04/helpdata/en/dc/6b7c9f43d711d1893e0000e8323c4f/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/69/e5cb365f6511d2b458006094b9476a/content.htm
check the above links
Rewards if Helpful...
Regards...
Praveen Kumar.D -
Function Module to send output list to mail.
Hi,
Could anyone let me know the function module to send output list to mail.
Regards,
RameshHi,
Please try with following sample code
Sending mail with attachment
This program will allowed you to send email with attachment.
First, specify the attachment file from your local hardisk and execute.
Next, specify the sender email address and click the send button.
report YUP_MAIL.
data method1 like sy-ucomm.
data g_user like soudnamei1.
data g_user_data like soudatai1.
data g_owner like soud-usrnam.
data g_receipients like soos1 occurs 0 with header line.
data g_document like sood4 .
data g_header like sood2.
data g_folmam like sofm2.
data g_objcnt like soli occurs 0 with header line.
data g_objhead like soli occurs 0 with header line.
data g_objpara like selc occurs 0 with header line.
data g_objparb like soop1 occurs 0 with header line.
data g_attachments like sood5 occurs 0 with header line.
data g_references like soxrl occurs 0 with header line.
data g_authority like sofa-usracc.
data g_ref_document like sood4.
data g_new_parent like soodk.
data: begin of g_files occurs 10 ,
text(4096) type c,
end of g_files.
data : fold_number(12) type c,
fold_yr(2) type c,
fold_type(3) type c.
parameters ws_file(4096) type c default 'c:\debugger.txt'.
Can me any file fromyour pc ....either xls or word or ppt etc ...
g_user-sapname = sy-uname.
call function 'SO_USER_READ_API1'
exporting
user = g_user
PREPARE_FOR_FOLDER_ACCESS = ' '
importing
user_data = g_user_data
EXCEPTIONS
USER_NOT_EXIST = 1
PARAMETER_ERROR = 2
X_ERROR = 3
OTHERS = 4
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
fold_type = g_user_data-outboxfol+0(3).
fold_yr = g_user_data-outboxfol+3(2).
fold_number = g_user_data-outboxfol+5(12).
clear g_files.
refresh : g_objcnt,
g_objhead,
g_objpara,
g_objparb,
g_receipients,
g_attachments,
g_references,
g_files.
method1 = 'SAVE'.
g_document-foltp = fold_type.
g_document-folyr = fold_yr.
g_document-folno = fold_number.
g_document-objtp = g_user_data-object_typ.
*g_document-OBJYR = '27'.
*g_document-OBJNO = '000000002365'.
*g_document-OBJNAM = 'MESSAGE'.
g_document-objdes = 'sap-img.com testing by program'.
g_document-folrg = 'O'.
*g_document-okcode = 'CHNG'.
g_document-objlen = '0'.
g_document-file_ext = 'TXT'.
g_header-objdes = 'sap-img.com testing by program'.
g_header-file_ext = 'TXT'.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = sy-uname
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header
FOLMEM_DATA =
RECEIVE_DATA =
File from the pc to send...
method1 = 'ATTCREATEFROMPC'.
g_files-text = ws_file.
append g_files.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header
method1 = 'SEND'.
g_receipients-recnam = 'MK085'.
g_receipients-recesc = 'B'.
g_receipients-sndex = 'X'.
append g_receipients.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header.
*-- End of Program
Thanks,
-Pramod
Maybe you are looking for
-
Can't find services on Windows XP Pro
My iPod touch 4th generation will connect to itunes, but there is a message that says "This iPod cannot be used because the Apple Mobile Device service is not started." Those are the exact words. So I searched for it on the apple website and came up
-
Hp34970a read vi doesnot wait for scan to finish
hi all.... i am facing problem ..im tryin to read DC current values from two channels.. i modified the advanced scan vi example.. the read vi is not waiting for the scan to finish.... i used trigger vi outside a for loop and i want the readings to be
-
Mail crashes when write new mail or reply is selected
Hi All, Ok Mail crashes/quits as soon as I click on compose new message or reply to sender. This has only just started but it happens every time. Have deleted .plist junk filter is cleared and disabled and no other programs running. Error log below.
-
I have now bought PSE 8 and have been issued with a serial number. Can anyone advise how I register this change of status on my existing trial PSE 8 download? I am sure this could have been done at the time I purchased PSE8 online but I apparantly
-
After a clean up utility was used, now I get HP Product Assistant not found.
.msi. The website info only seems to give directions for usb connected devices. I have an HP photosmart C7280 multifunction printer and an HP Pavilion entertainment dv6700us laptop, wirelessly connected. Should I just unplug it? or do I have to unin