2014 Aug 05 2:39 PM
Hello,
This program works good in Foreground, can some one help me to execute it in Background?
I tried via sm37 - sm36 (job wizar) - right button execute in Background, but it doesn't succeed.
It's work perfect in Foreground...
<irrelevant code is removed>
Message was edited by: Suhas Saha
Thank u,
How can i correct that ?
2014 Aug 07 1:09 PM
2014 Aug 07 1:11 PM
2014 Aug 07 1:14 PM
yes, i need to send itab data to my email address in outlook in background.
i need a abap code not configuration in SCOT or SOST....
Do you know?
2014 Aug 07 1:33 PM
Hi
Yes I know but as I said before
To send a mail via ABAP is easy, one sample is in link posted by Stefan, but there are many samples in SCN:
Have you tried to look for it?
Max
2014 Aug 07 1:44 PM
i tried already this code in Fore and background,
constants:
gc_subject type so_obj_des value 'ABAP Email with CL_BCS',
gc_raw type char03 value 'RAW'.
data:
gv_mlrec type so_obj_nam,
gv_sent_to_all type os_boolean,
gv_email type adr6-smtp_addr,
gv_subject type so_obj_des,
gv_text type bcsy_text,
gr_send_request type ref to cl_bcs,
gr_bcs_exception type ref to cx_bcs,
gr_recipient type ref to if_recipient_bcs,
gr_sender type ref to cl_sapuser_bcs,
gr_document type ref to cl_document_bcs.
try.
"Create send request
gr_send_request = cl_bcs=>create_persistent( ).
"Email FROM...
gr_sender = cl_sapuser_bcs=>create( sy-uname ).
"Add sender to send request
call method gr_send_request->set_sender
exporting
i_sender = gr_sender.
"Email TO...
gv_email = '[email protected]'.
gr_recipient = cl_cam_address_bcs=>create_internet_address( gv_email ).
"Add recipient to send request
call method gr_send_request->add_recipient
exporting
i_recipient = gr_recipient
i_express = 'X'.
"Email BODY
append 'Hello world! My first ABAP email!' to gv_text.
gr_document = cl_document_bcs=>create_document(
i_type = gc_raw
i_text = gv_text
i_length = '12'
i_subject = gc_subject ).
"Add document to send request
call method gr_send_request->set_document( gr_document ).
"Send email
call method gr_send_request->send(
exporting
i_with_error_screen = 'X'
receiving
result = gv_sent_to_all ).
if gv_sent_to_all = 'X'.
write 'Email sent!'.
endif.
"Commit to send email
commit work.
"Exception handling
catch cx_bcs into gr_bcs_exception.
write:
'Error!',
'Error type:',
gr_bcs_exception->error_type.
endtry.
i receive no mail, when i check in SOST, i find "Message cannot be transferred to node SMTP due to connection error (final)"
2014 Aug 07 1:56 PM
this shows that somehow your scot configuration is wrong since mail got created correctly.
unfortunately i cant help you with scot configuration
regards
Stefan Seeburger
2014 Aug 07 2:09 PM
2014 Aug 07 2:27 PM
i did all of those step my SCOT,
Scot Configuration &amp; Troubleshooting
but still have the error connection !!
2014 Aug 07 2:30 PM
Probably you should ask an help to your basis, I suppose there's a reason if SCOT is not set in your system
Max
2014 Aug 07 2:33 PM
2014 Aug 07 2:49 PM
2014 Aug 07 3:06 PM
2014 Aug 07 3:45 PM
Wow
I've never set SCOT but if you've changed the system parameter as shown in the first step of the link you've posted I believe you need to restart the system
Max
2014 Aug 07 4:02 PM
ok Max,
i don't want to send email :-), there is any way in background to use it to send me information via pop up or message or any thing that help me to say "aah there is some thing wrong, i get signal ".... ?
2014 Aug 07 4:41 PM
Hi
try this code:
data objcont type standard table of soli with header line.
data receiver type standard table of somlreci1 with header line.
data doc_data type sodocchgi1.
* insert receiver (sap name)
refresh receiver.
clear receiver.
move: sy-uname to receiver-receiver,
'X' to receiver-express,
'B' to receiver-rec_type.
append receiver.
* insert mail description
write 'My express message' to doc_data-obj_descr.
objcont-line = 'Hello! This is my message sent by program &'.
replace '&' with sy-repid into objcont-line.
append objcont.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = doc_data
tables
object_content = objcont
receivers = receiver
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.
You'll receive a popup message as soon as you log on or do something (if you're log in)
Max
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |