FUNCTION SO_OBJECT_SEND
I have created a batch program to run weekly very early before our
accounting personnel arrive. If a specific event occurs, I want to send an
"Express Document" to a predetermined individual in accounting. I have used
function SO_OBJECT_SEND to accomplish the task with one exception. If the
receiver is not logged in, the message box does not appear when they do log
in. I need the message box, or some other indicator, to inform the user as
soon as they log in that an Express Document is waiting to be view. I was
wondering if anyone has used this function, or another, and has attempted to
do the same, and if so, how.
Try using function SO_NEW_DOCUMENT_SEND_API1
For the input of the "RECEIVERS" table parameter, use rec_type = 'B' andexpress = 'X'
We are using this function(in 31H) for a similar requirement and as soonas the user logs in, they receive a popup box notifying them that anExpress Document is waiting for them to review.
Similar Messages
-
How to use SO_OBJECT_SEND function module
Hi friends,
how to use SO_OBJECT_SEND function module in 4.0B Server .hi
good
check this code
REPORT ZTSAPMAIL.
DATA: X_OBJECT_TYPE LIKE SOOD-OBJTP.
DATA: BEGIN OF X_OBJECT_HD_CHANGE.
INCLUDE STRUCTURE SOOD1.
DATA: END OF X_OBJECT_HD_CHANGE.
DATA: BEGIN OF X_OBJCONT OCCURS 10.
INCLUDE STRUCTURE SOLI.
DATA: END OF X_OBJCONT.
DATA: BEGIN OF X_OBJHEAD OCCURS 0.
INCLUDE STRUCTURE SOLI.
DATA: END OF X_OBJHEAD.
DATA: BEGIN OF RAW_HEAD.
INCLUDE STRUCTURE SORH.
DATA: END OF RAW_HEAD.
DATA: BEGIN OF X_RECEIVERS OCCURS 0.
INCLUDE STRUCTURE SOOS1.
DATA: END OF X_RECEIVERS.
PARAMETERS: RECEIVER LIKE X_RECEIVERS-RECNAM. " Name
*BUILD MESSAGE HEADER
MOVE 'Sort field goes here' TO X_OBJECT_HD_CHANGE-OBJSRT. " Sort field
MOVE 'Name of the object goes here' TO X_OBJECT_HD_CHANGE-OBJNAM. " Name
MOVE 'Document title goes here' TO X_OBJECT_HD_CHANGE-OBJDES. " Title
MOVE 'F' TO X_OBJECT_HD_CHANGE-OBJSNS. " Functional OBJECT
MOVE 'E' TO X_OBJECT_HD_CHANGE-OBJLA. " Language
Object type of the new document
MOVE 'RAW' TO X_OBJECT_TYPE.
CLEAR X_OBJCONT.
MOVE 'Contents of mail' TO X_OBJCONT-LINE.
APPEND X_OBJCONT.
CLEAR X_OBJCONT-LINE. APPEND X_OBJCONT.
MOVE 'More contents' TO X_OBJCONT-LINE.
APPEND X_OBJCONT.
MOVE 'Still more contents'
to x_objcont-line.
APPEND X_OBJCONT.
MOVE ' ' TO X_OBJCONT-LINE.
APPEND X_OBJCONT.
Specific header (Dependent on the object type, here RAW)
REFRESH X_OBJHEAD.
DESCRIBE TABLE X_OBJCONT LINES RAW_HEAD-RAWSIZ.
MOVE RAW_HEAD TO X_OBJHEAD.
APPEND X_OBJHEAD.
*RECEIVERS table
CLEAR X_RECEIVERS.
REFRESH X_RECEIVERS.
MOVE RECEIVER TO X_RECEIVERS-RECNAM. " Name
MOVE 'B' TO X_RECEIVERS-RECESC. " Receiver type
MOVE 'X' TO X_RECEIVERS-SNDCP. " Send as a copy
MOVE 'X' TO X_RECEIVERS-SNDEX. " EXPRESS DOCUMENT
APPEND X_RECEIVERS.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
folder_id = 'OUTBOX'
forwarder = x_forwarder
object_fl_change = x_object_fl_change
OBJECT_HD_CHANGE = X_OBJECT_HD_CHANGE
object_id = x_object_id
OBJECT_TYPE = X_OBJECT_TYPE
OUTBOX_FLAG = 'X'
OWNER = SY-UNAME
store_flag = x_store_flag
importing
object_id_new = x_object_id_new
sent_to_all = x_sent_to_all "May need to use
TABLES
OBJCONT = X_OBJCONT
OBJHEAD = X_OBJHEAD
objpara = x_objpara
objparb = x_objparb
RECEIVERS = X_RECEIVERS.
reward point if hlepful.
thanks
mrutyun^ -
Mail sending using sender importing parameter using so_object_send function
Hi all,
I using so_object_send function module to send mail. My requirement is with respect to any user
logged in the sender mail address should be taken by V_SENDER parameter in exporting
parameter.
<code>
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
folder_id = wa_folder_id
forwarder = w_forwarder
object_fl_change = wa_object_fl_change
object_hd_change = wa_object_hd_change
object_id = wa_object_id
object_type = w_object_type
outbox_flag = w_outbox_flag
owner = w_owner
store_flag = w_store_flag
IMPORTING
object_id_new = wa_object_id_new
sent_to_all = w_sent_to_all
sender = v_sender
TABLES
objcont = i_objcont
objhead = i_objhead
objpara = i_objpara
objparb = i_objparb
receivers = i_receivers
EXCEPTIONS
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
originator_not_exist = 20
x_error = 21
OTHERS = 22.
IF sy-subrc 0.
ENDIF.
</code>
My Requirement is V_SENDER can be any user of that SAP system,noot particularly logged in user.
I tried using this functionality my sy-subrc is zero. but i am not able to get any mails with that user name in V_SENDER.
Do i need to do any further settings or any more code is required.
Even i tired giving SUBMIT rsconn01 .
still its not working.
Please suggest any solutions if we have.
Thanks,
satishHi,
to send mails check this:
FORM docu_send_email USING pv_otfdata TYPE tsfotf
pv_emailid TYPE any
pv_formname TYPE any.
DATA: lv_filesize TYPE i,
lv_buffer TYPE string,
lv_attachment TYPE i,
lv_testo TYPE i.
DATA: li_pdfdata TYPE STANDARD TABLE OF tline,
li_mess_att TYPE STANDARD TABLE OF solisti1,
li_mtab_pdf TYPE STANDARD TABLE OF tline,
li_objpack TYPE STANDARD TABLE OF sopcklsti1,
li_objtxt TYPE STANDARD TABLE OF solisti1,
li_objbin TYPE STANDARD TABLE OF solisti1,
li_reclist TYPE STANDARD TABLE OF somlreci1,
li_objhead TYPE soli_tab.
DATA: lwa_pdfdata TYPE tline,
lwa_objpack TYPE sopcklsti1,
lwa_mess_att TYPE solisti1,
lwa_objtxt TYPE solisti1,
lwa_objbin TYPE solisti1,
lwa_reclist TYPE somlreci1,
lwa_doc_chng TYPE sodocchgi1.
CONSTANTS: lc_u TYPE char1 VALUE 'U',
lc_0 TYPE char1 VALUE '0',
lc_1 TYPE char1 VALUE '1',
lc_pdf TYPE char3 VALUE 'PDF',
lc_raw TYPE char3 VALUE 'RAW',
lc_ordform TYPE char15 VALUE 'ZORDCONFIRM_01',
lc_attachment TYPE char10 VALUE 'ATTACHMENT'.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = lc_pdf
max_linewidth = 132
IMPORTING
bin_filesize = lv_filesize
TABLES
otf = pv_otfdata
lines = li_pdfdata
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 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.
LOOP AT li_pdfdata INTO lwa_pdfdata.
TRANSLATE lwa_pdfdata USING ' ~'.
CONCATENATE lv_buffer lwa_pdfdata INTO lv_buffer.
CLEAR lwa_pdfdata.
ENDLOOP.
TRANSLATE lv_buffer USING '~ '.
DO.
lwa_mess_att = lv_buffer.
APPEND lwa_mess_att TO li_mess_att.
CLEAR lwa_mess_att.
SHIFT lv_buffer LEFT BY 255 PLACES.
IF lv_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Object with PDF.
REFRESH li_objbin.
li_objbin] = li_mess_att[.
DESCRIBE TABLE li_objbin LINES lv_attachment.
Object with main text of the mail.
lwa_objtxt = space.
APPEND lwa_objtxt TO li_objtxt.
CLEAR lwa_objtxt.
DESCRIBE TABLE li_objtxt LINES lv_testo.
Create the document which is to be sent
lwa_doc_chng-obj_name = text-008.
lwa_doc_chng-obj_descr = text-008.
lwa_doc_chng-sensitivty = lc_0.
lwa_doc_chng-obj_prio = lc_1.
lwa_doc_chng-doc_size = lv_testo * 225.
Pack to main body.
CLEAR lwa_objpack-transf_bin.
header
lwa_objpack-head_start = 1.
The document needs no header (head_num = 0)
lwa_objpack-head_num = 0.
body
lwa_objpack-body_start = 1.
lwa_objpack-body_num = lv_testo.
lwa_objpack-doc_type = lc_raw.
APPEND lwa_objpack TO li_objpack.
CLEAR lwa_objpack.
Create the attachment.
Fill the fields of the packing_list for the attachment:
lwa_objpack-transf_bin = gc_x .
header
lwa_objpack-head_start = 1.
lwa_objpack-head_num = 1.
body
lwa_objpack-body_start = 1.
lwa_objpack-body_num = lv_attachment.
lwa_objpack-doc_type = lc_pdf.
lwa_objpack-obj_name = lc_attachment.
lwa_objpack-obj_descr = text-008.
lwa_objpack-doc_size = lv_attachment * 255.
APPEND lwa_objpack TO li_objpack.
CLEAR lwa_objpack.
lwa_reclist-receiver = pv_emailid.
lwa_reclist-rec_type = lc_u.
lwa_reclist-notif_del = gc_x.
lwa_reclist-notif_ndel = gc_x.
APPEND lwa_reclist TO li_reclist.
IF li_reclist IS NOT INITIAL.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
put_in_outbox = gc_x
TABLES
packing_list = li_objpack
object_header = li_objhead
contents_bin = li_objbin
contents_txt = li_objtxt
receivers = li_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDFORM. " DOCU_SEND_EMAIL -
SO_OBJECT_SEND function does not work without an explicit COMMIT WORK
Hi,
We have used this Function module (SO_OBJECT_SEND) inside a custom BAdI Implementation , which sends e-mails when some of the fields inside an infotype are modified using transaction PA30 (HR-Maintain master data).
After the system was upgraded to BASIS version 7.0 , as per SAP note 489286 ,the calling program of the send interface must execute an explicit COMMIT WORK.But inside an update , COMMIT WORK should not be executed.
So we did not execute explicit COMMIT WORK inside BAdI.
But after this upgrade, the emails are not sent out of R/3 , and the status message 672 (Still no entry in queue) is displayed on the program 'Administration of External Send Processes' - Transaction SOST.
Can anyone suggest a solution , if you have used this Function module (SO_OBJECT_SEND) inside a BAdI during update?
Thanks,
KiranHi Kiran,
create one remote enable function module, write your required logic in this remote enableD function module.
Now call this function module in Badi as below,
eg. suppose Remote enable function module created is 'ztest'.
then,
In BadI write logic,
CALL FUNCTION 'ZTEST' SEPARATE TASK 'T'
EXPORTING ......
IMPORTING.......
also inside this function module
call function 'SO_OBJECT_SEND' separate task 'T'
exporting....
importing....
committwork.
after doing this what will happen is your mail logic will be in saperate session, so your current program will pass the data and execution of this RFC and Program having BADI, will be in two saperate sessions, so although you are using committ work standred program will not get affected.
This will improve performance too...:)
Please Give points if it is going to help you. -
Function Module SO_OBJECT_SEND
Hi Gurus,
Can we send the attachments using Function Module 'SO_OBJECT_SEND'. ?
If so please do let me know the code for filling the attachment and using this FM.
Promise to reward points.
Thanks & Regards
MacHai ,
SAP supplies a function module 'SO_OBJECT_SEND' to allow you send SAPOffice mails from within your ABAP programs.
Just try this.
Author: Kevin Wilson
FUNCTION z_send_email_itab_uname.
""Local interface:
*" IMPORTING
*" VALUE(APPLICATION) LIKE SOOD1-OBJNAM
*" VALUE(EMAILTITLE) LIKE SOOD1-OBJDES
*" VALUE(RECEXTNAM) LIKE SOOS1-RECEXTNAM OPTIONAL
*" VALUE(SENDER) LIKE SOUD-USRNAM DEFAULT SY-UNAME
*" VALUE(UNAME) LIKE SOOS1-RECEXTNAM OPTIONAL
*" EXPORTING
*" VALUE(RETURN_CODE) LIKE SY-SUBRC
*" TABLES
*" TEXTTAB STRUCTURE SOLI
tables
TABLES: pa0105, "Employee detail for username and email address
usr21, "Login addition address data
adr6. "Address table for email addresses
*- local data declaration
DATA: ohd LIKE sood1,
oid LIKE soodk,
to_all LIKE sonv-flag,
t_uname LIKE sy-uname,
okey LIKE swotobjid-objkey.
DATA: BEGIN OF receivers OCCURS 0.
INCLUDE STRUCTURE soos1.
DATA: END OF receivers.
*- fill odh
CLEAR ohd.
ohd-objla = sy-langu.
ohd-objnam = application.
ohd-objdes = emailtitle.
ohd-objpri = 3.
ohd-objsns = 'F'.
ohd-ownnam = sy-uname.
IF NOT uname IS INITIAL.
Find personnel number of username
CONDENSE uname NO-GAPS.
WHILE uname CS ','.
t_uname = uname+0(sy-fdpos).
ADD 1 TO sy-fdpos.
SHIFT uname LEFT BY sy-fdpos PLACES.
PERFORM find_email_address USING t_uname
CHANGING recextnam.
ENDWHILE.
*Do the last record
IF uname <> space.
t_uname = uname.
PERFORM find_email_address USING t_uname
CHANGING recextnam.
ENDIF.
ENDIF.
*- send Email
IF NOT recextnam IS INITIAL.
CONDENSE recextnam NO-GAPS.
CHECK recextnam CS '@'.
ENDIF.
*- for every individual recipient send an Email
(see OSS message 0120050409/0000362105/1999)
WHILE recextnam CS ','.
PERFORM init_rec TABLES receivers.
READ TABLE receivers INDEX 1.
receivers-recextnam = recextnam+0(sy-fdpos).
ADD 1 TO sy-fdpos.
SHIFT recextnam LEFT BY sy-fdpos PLACES.
MODIFY receivers INDEX 1.
PERFORM so_object_send_rec
TABLES texttab receivers
USING ohd
sender.
ENDWHILE.
*- check last recipient in recipient list
IF recextnam <> space.
PERFORM init_rec TABLES receivers.
READ TABLE receivers INDEX 1.
receivers-recextnam = recextnam.
MODIFY receivers INDEX 1.
PERFORM so_object_send_rec
TABLES texttab receivers
USING ohd
sender.
ENDIF.
ENDFUNCTION.
FORM SO_OBJECT_SEND_REC *
FORM so_object_send_rec
TABLES objcont STRUCTURE soli
receivers STRUCTURE soos1
USING object_hd STRUCTURE sood1
sender LIKE soud-usrnam.
DATA: oid LIKE soodk,
to_all LIKE sonv-flag,
okey LIKE swotobjid-objkey.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
extern_address = 'X'
object_hd_change = object_hd
object_type = 'RAW'
outbox_flag = 'X'
sender = sender
IMPORTING
object_id_new = oid
sent_to_all = to_all
office_object_key = okey
TABLES
objcont = objcont
receivers = receivers
EXCEPTIONS
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
x_error = 20
OTHERS = 21.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 1.
MESSAGE i999(b1) WITH 'Activer user does not exist.'
'Send Mail failed!'.
WHEN 2.
MESSAGE i999(b1) WITH 'Communication Failure.'
'Send Mail failed!'.
WHEN 3.
MESSAGE i999(b1) WITH 'Component not available.'
'Send Mail failed!'.
WHEN 4.
MESSAGE i999(b1) WITH 'Folder does not exist..'
'Send Mail failed!'.
WHEN 5.
MESSAGE i999(b1) WITH 'No authorization for folder.'
'Send Mail failed!'.
WHEN 6.
MESSAGE i999(b1) WITH 'Forwarder does not exist.'
'Send Mail failed!'.
WHEN 7.
MESSAGE i999(b1) WITH 'Note does not exist.'
'Send Mail failed!'.
WHEN 8.
MESSAGE i999(b1) WITH 'Object does not exist.'
'Send Mail failed!'.
WHEN 9.
MESSAGE i999(b1) WITH 'Object not sent.'
'Send Mail failed!'.
WHEN 10.
MESSAGE i999(b1) WITH 'No authorization for object.'
'Send Mail failed!'.
WHEN 11.
MESSAGE i999(b1) WITH 'Object type does not exist.'
'Send Mail failed!'.
WHEN 12.
MESSAGE i999(b1) WITH 'No authorization for operation.'
'Send Mail failed!'.
WHEN 13.
MESSAGE i999(b1) WITH 'Owner does not exist.'
'Send Mail failed!'.
WHEN 14.
MESSAGE i999(b1) WITH 'Parameter Error.'
'Send Mail failed!'.
WHEN 15.
MESSAGE i999(b1) WITH 'Substitute not active.'
'Send Mail failed!'.
WHEN 16.
MESSAGE i999(b1) WITH 'Substitute not defined.'
'Send Mail failed!'.
WHEN 17.
MESSAGE i999(b1) WITH 'System failure.'
'Send Mail failed!'.
WHEN 18.
MESSAGE i999(b1) WITH 'Too many receivers.'
'Send Mail failed!'.
WHEN 19.
MESSAGE i999(b1) WITH 'User does not exist.'
'Send Mail failed!'.
WHEN 20.
MESSAGE i999(b1) WITH 'Unknown error ocurred.'
'Send Mail failed!'.
WHEN 21.
MESSAGE i999(b1) WITH 'Unknown error ocurred.'
'Send Mail failed!'.
ENDCASE.
ENDIF.
ENDFORM.
FORM INIT_REC *
FORM init_rec TABLES receivers STRUCTURE soos1.
CLEAR receivers.
REFRESH receivers.
MOVE sy-datum TO receivers-rcdat .
MOVE sy-uzeit TO receivers-rctim.
MOVE '1' TO receivers-sndpri.
MOVE 'X' TO receivers-sndex.
MOVE 'U-' TO receivers-recnam.
MOVE 'U' TO receivers-recesc.
MOVE 'INT' TO receivers-sndart.
MOVE '5' TO receivers-sortclass.
APPEND receivers.
ENDFORM.
*& Form find_email_address
Returns the email address for a USERID whether they are an
employee or just a user.
<--P_RECEXTNAM Email address
-->P_UNAME USERID
FORM find_email_address USING p_uname
CHANGING p_recextnam LIKE soos1-recextnam.
DATA: t_pernr LIKE pa0105-pernr,
t_email LIKE pa0105-usrid_long.
STEP 1 - Find personnel number for UNAME
SELECT SINGLE pernr INTO t_pernr
FROM pa0105
WHERE subty = '0001' AND
endda >= sy-datum AND
begda <= sy-datum AND
usrid = p_uname.
Employee record found
IF sy-subrc = 0.
STEP 2 - Find email address for personnel number
SELECT SINGLE usrid_long INTO t_email
FROM pa0105
WHERE pernr = t_pernr AND
subty = '0022' AND
endda >= sy-datum AND
begda <= sy-datum.
IF sy-subrc = 0.
IF NOT p_recextnam IS INITIAL.
CONCATENATE p_recextnam t_email
INTO p_recextnam SEPARATED BY ','.
ELSE.
p_recextnam = t_email.
ENDIF.
ELSE. "Never found an email address for employee
WHO SHOULD WE SEND TO HERE??? ***
ENDIF.
Employee number not found. Search in ADR6 table
ELSE.
See if user name is in the username table.
i.e. The user is not an employee
SELECT SINGLE addrnumber persnumber
INTO (usr21-addrnumber, usr21-persnumber)
FROM usr21
WHERE bname = p_uname.
IF sy-subrc = 0.
Found user name now let's get the email address
SELECT SINGLE smtp_addr INTO t_email
FROM adr6
WHERE addrnumber = usr21-addrnumber AND
persnumber = usr21-persnumber.
IF sy-subrc <> 0 OR t_email IS INITIAL.
WHO SHOULD WE SEND TO HERE??? ***
ELSE. "Found email
IF NOT p_recextnam IS INITIAL.
CONCATENATE p_recextnam t_email
INTO p_recextnam SEPARATED BY ','.
ELSE.
p_recextnam = t_email.
ENDIF.
ENDIF.
ELSE. "UNAME just does not have an email address addigned at all
WHO SHOULD WE SEND TO HERE??? ***
ENDIF.
ENDIF.
ENDFORM. " find_email_address
Regards.
Sowjanya.B. -
Reg : Issue for Sending of external email using SO_OBJECT_SEND
There is one issue while sending external email using SO_OBJECT_SEND functional module.
1. The body of the mail is also included as attachment.
I want to avoid the same.
Please anyone can give the solution.hi check this example ,
Sending mail with attachment report in Background
Content Author: Fernando Faian
I have read the hint about "Sending mail with attachment report".
It's great, but how can I make this function work in background??
I had that needed last year too. See attachment a function group with two functions. The second one has that functionality to send email or fax (SAP office) with attachment objects in background job using SO_ATTACHMENT_INSERT function.
Pay attention because its working with output list from spool converted to pdf.
=================================================================================
z_send_email_fax_global
FUNCTION-POOL z_gfaian_mail_fax. "MESSAGE-ID ..
WORK TABLE AREAS
TABLES: tsp01.
INTERNAL TABLES
DATA: lt_rec_tab LIKE STANDARD TABLE OF soos1 WITH HEADER LINE,
lt_note_text LIKE STANDARD TABLE OF soli WITH HEADER LINE,
lt_attachments LIKE STANDARD TABLE OF sood5 WITH HEADER LINE.
DATA: lt_objcont LIKE STANDARD TABLE OF soli WITH HEADER LINE,
lt_objhead LIKE STANDARD TABLE OF soli WITH HEADER LINE.
DATA: pdf_format LIKE STANDARD TABLE OF tline WITH HEADER LINE.
TYPES: BEGIN OF y_files,
file(60) TYPE c,
END OF y_files.
DATA: lt_files TYPE STANDARD TABLE OF y_files WITH HEADER LINE.
DATA: l_objcont LIKE soli OCCURS 0 WITH HEADER LINE.
DATA: l_objhead LIKE soli OCCURS 0 WITH HEADER LINE.
STRUCTURES
DATA: folder_id LIKE soodk,
object_id LIKE soodk,
link_folder_id LIKE soodk,
g_document LIKE sood4,
g_header_data LIKE sood2,
g_folmem_data LIKE sofm2,
g_header_data LIKE sood2,
g_receive_data LIKE soos6,
g_ref_document LIKE sood4,
g_new_parent LIKE soodk,
l_folder_id LIKE sofdk,
v_email(50).
DATA: hd_dat like sood1.
VARIABLES
DATA: client LIKE tst01-dclient,
name LIKE tst01-dname,
objtype LIKE rststype-type,
type LIKE rststype-type.
DATA: numbytes TYPE i,
arc_idx LIKE toa_dara,
pdfspoolid LIKE tsp01-rqident,
jobname LIKE tbtcjob-jobname,
jobcount LIKE tbtcjob-jobcount,
is_otf.
DATA: outbox_flag LIKE sonv-flag VALUE 'X',
store_flag LIKE sonv-flag,
delete_flag LIKE sonv-flag,
owner LIKE soud-usrnam,
on LIKE sonv-flag VALUE 'X',
sent_to_all LIKE sonv-flag,
g_authority LIKE sofa-usracc,
w_objdes LIKE sood4-objdes.
DATA: c_file LIKE rlgrap-filename,
n_spool(6) TYPE n.
DATA: cancel.
DATA: desired_type LIKE sood-objtp,
real_type LIKE sood-objtp,
attach_type LIKE sood-objtp,
otf LIKE sood-objtp VALUE 'OTF', " SAPscript Ausgabeformat
ali LIKE sood-objtp VALUE 'ALI'. " ABAP lists
CONSTANTS
CONSTANTS: ou_fol LIKE sofh-folrg VALUE 'O',
c_objtp LIKE g_document-objtp VALUE 'RAW',
c_file_ext LIKE g_document-file_ext VALUE 'TXT'.
=================================================================================
z_send_email_fax2
FUNCTION z_faian_mail_fax2.
""Interface local:
*" IMPORTING
*" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
*" REFERENCE(FAX_MAIL_NUMBER) TYPE SO_NAME
*" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
*" REFERENCE(OBJECT_TYPE) TYPE SO_ESCAPE
*" TABLES
*" LT_BODY_EMAIL STRUCTURE SOLI
*" EXCEPTIONS
*" ERR_NO_ABAP_SPOOLJOB
Fist part: Verify if the spool really exists
SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
IF sy-subrc NE 0.
RAISE err_no_abap_spooljob. "doesn't exist
ELSE.
client = tsp01-rqclient.
name = tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
IF objtype(3) = 'OTF'.
desired_type = otf.
ELSE.
desired_type = ali.
ENDIF.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = src_spoolid
desired_type = desired_type
IMPORTING
real_type = real_type
TABLES
buffer = l_objcont
EXCEPTIONS
no_such_job = 14
type_no_match = 94
job_contains_no_data = 54
no_permission = 21
can_not_access = 21
read_error = 54.
IF sy-subrc EQ 0.
attach_type = real_type.
ENDIF.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
owner = sy-uname
region = ou_fol
IMPORTING
folder_id = l_folder_id
EXCEPTIONS
OTHERS = 5.
fill out informations about the header of the email
CLEAR: g_document.
g_document-foltp = l_folder_id-foltp.
g_document-folyr = l_folder_id-folyr.
g_document-folno = l_folder_id-folno.
g_document-objtp = c_objtp.
g_document-objdes = header_mail.
g_document-file_ext = c_file_ext.
g_header_data-objdes = header_mail.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = 'SAVE'
office_user = sy-uname
IMPORTING
authority = g_authority
TABLES
objcont = lt_body_email
attachments = lt_attachments
CHANGING
document = g_document
header_data = g_header_data
EXCEPTIONS
OTHERS = 1.
folder_id-objtp = l_folder_id-foltp.
folder_id-objyr = l_folder_id-folyr.
folder_id-objno = l_folder_id-folno.
object_id-objtp = c_objtp.
object_id-objyr = g_document-objyr.
object_id-objno = g_document-objno.
link_folder_id-objtp = l_folder_id-foltp.
link_folder_id-objyr = l_folder_id-folyr.
link_folder_id-objno = l_folder_id-folno.
REFRESH lt_rec_tab.
CLEAR lt_rec_tab.
lt_rec_tab-sel = 'X'.
lt_rec_tab-recesc = object_type. "This field for FAX/MAIL
lt_rec_tab-recnam = 'U-'.
lt_rec_tab-deliver = 'X'.
lt_rec_tab-not_deli = 'X'.
lt_rec_tab-read = 'X'.
lt_rec_tab-mailstatus = 'E'.
lt_rec_tab-adr_name = fax_mail_number.
lt_rec_tab-sortfield = fax_mail_number.
lt_rec_tab-recextnam = fax_mail_number.
lt_rec_tab-sortclass = '5'.
APPEND lt_rec_tab.
lt_rec_tab-recextnam = fax_mail_number.
lt_rec_tab-recesc = object_type.
lt_rec_tab-sndart = 'INT'.
lt_rec_tab-sndpri = 1.
APPEND lt_rec_tab.
lt_files-file = c_file.
APPEND lt_files.
begin of insertion by faianf01
hd_dat-objdes = header_mail.
CALL FUNCTION 'SO_ATTACHMENT_INSERT'
EXPORTING
object_id = object_id
attach_type = attach_type
object_hd_change = hd_dat
owner = sy-uname
TABLES
objcont = l_objcont
objhead = l_objhead
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
object_type_not_exist = 17
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
x_error = 1000.
IF sy-subrc > 0.
ENDIF.
end of insertion by faianf01
send email from SAPOFFICE
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
folder_id = folder_id
object_id = object_id
outbox_flag = outbox_flag
link_folder_id = link_folder_id
owner = sy-uname
check_send_authority = 'X'
TABLES
receivers = lt_rec_tab
note_text = lt_note_text
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
component_not_available = 1
folder_no_authorization = 5
folder_not_exist = 6
forwarder_not_exist = 8
object_no_authorization = 13
object_not_exist = 14
object_not_sent = 15
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
too_much_receivers = 73
user_not_exist = 35.
ENDIF.
ENDFUNCTION.
=================================================================================
z_send_email_fax
FUNCTION ZCBFS_SEND_MAIL.
""Interface local:
*" IMPORTING
*" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
*" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
*" TABLES
*" LIST_FAX_MAIL_NUMBER STRUCTURE SOLI
*" EXCEPTIONS
*" ERR_NO_ABAP_SPOOLJOB
DATA: vg_achou(1) TYPE n.
Fist part: Verify if the spool really exists
vg_achou = 1.
DO 60 TIMES.
SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
IF sy-subrc IS INITIAL.
CLEAR vg_achou.
EXIT.
ELSE.
WAIT UP TO 1 SECONDS.
ENDIF.
ENDDO.
IF vg_achou = 1.
RAISE err_no_abap_spooljob. "doesn't exist
ENDIF.
client = tsp01-rqclient.
name = tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
IF objtype(3) = 'OTF'.
desired_type = otf.
ELSE.
desired_type = ali.
ENDIF.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = src_spoolid
desired_type = desired_type
IMPORTING
real_type = real_type
TABLES
buffer = l_objcont
EXCEPTIONS
no_such_job = 14
type_no_match = 94
job_contains_no_data = 54
no_permission = 21
can_not_access = 21
read_error = 54.
IF sy-subrc EQ 0.
attach_type = real_type.
ENDIF.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
owner = sy-uname
region = ou_fol
IMPORTING
folder_id = l_folder_id
EXCEPTIONS
OTHERS = 5.
fill out informations about the header of the email
CLEAR: g_document.
g_document-foltp = l_folder_id-foltp.
g_document-folyr = l_folder_id-folyr.
g_document-folno = l_folder_id-folno.
g_document-objtp = c_objtp.
g_document-objdes = header_mail.
g_document-file_ext = c_file_ext.
g_header_data-objdes = header_mail.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = 'SAVE'
office_user = sy-uname
IMPORTING
authority = g_authority
TABLES
attachments = lt_attachments
CHANGING
document = g_document
header_data = g_header_data
EXCEPTIONS
OTHERS = 1.
folder_id-objtp = l_folder_id-foltp.
folder_id-objyr = l_folder_id-folyr.
folder_id-objno = l_folder_id-folno.
object_id-objtp = c_objtp.
object_id-objyr = g_document-objyr.
object_id-objno = g_document-objno.
link_folder_id-objtp = l_folder_id-foltp.
link_folder_id-objyr = l_folder_id-folyr.
link_folder_id-objno = l_folder_id-folno.
REFRESH lt_rec_tab.
LOOP AT LIST_FAX_MAIL_NUMBER.
lt_rec_tab-recextnam = LIST_FAX_MAIL_NUMBER-LINE.
lt_rec_tab-recesc = 'U'.
lt_rec_tab-sndart = 'INT'.
lt_rec_tab-sndpri = 1.
APPEND lt_rec_tab.
ENDLOOP.
lt_files-file = c_file.
APPEND lt_files.
hd_dat-objdes = header_mail.
CALL FUNCTION 'SO_ATTACHMENT_INSERT'
EXPORTING
object_id = object_id
attach_type = attach_type
object_hd_change = hd_dat
owner = sy-uname
TABLES
objcont = l_objcont
objhead = l_objhead
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
object_type_not_exist = 17
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
x_error = 1000.
IF sy-subrc > 0.
ENDIF.
send email from SAPOFFICE
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
folder_id = folder_id
object_id = object_id
outbox_flag = outbox_flag
link_folder_id = link_folder_id
owner = sy-uname
TABLES
receivers = lt_rec_tab
note_text = lt_note_text
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
component_not_available = 1
folder_no_authorization = 5
folder_not_exist = 6
forwarder_not_exist = 8
object_no_authorization = 13
object_not_exist = 14
object_not_sent = 15
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
too_much_receivers = 73
user_not_exist = 35.
ENDFUNCTION.
=================================================================================
regards,
venkat. -
Function Module to send a mail in PDF/ XLS format
Can you please tell me the name of a function module where a mail to be send in a non-sap box. And then mail which will be send is in a PDF/ XLS format.
Regards,
SubhasishHi Subhasish,
These are the FM for sending external email :-
SO_DOCUMENT_SEND_API1
SAPoffice: Send new document with attachments via RFC
SO_NEW_DOCUMENT_ATT_SEND_API1
(In 4.6C only, You can go to SE37 and click the documentation on how to use it. A sample program is provided there.)
SAPoffice: Send new document with attachments via RFC
Note : If you are using FM SO_NEW_DOCUMENT_ATT_SEND_API1 then Export Parameter DOCUMENT_DATA-OBJ_DESCR contains the Subject.
SO_NEW_DOCUMENT_SEND_API1
SAPoffice: Send new document
How to send a report to an external mail-id?
Try this sample code :-
REPORT ZREPORT_TO_EMAIL NO STANDARD PAGE HEADING LINE-SIZE 200.
DATA : BEGIN OF ITAB OCCURS 0,
PERNR LIKE PA0001-PERNR,
ENAME LIKE PA0001-ENAME,
END OF ITAB.
DATA: message_content LIKE soli OCCURS 10 WITH HEADER LINE,
receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,
packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,
listobject LIKE abaplist OCCURS 10,
compressed_attachment LIKE soli OCCURS 100 WITH HEADER LINE,
w_object_hd_change LIKE sood1,
compressed_size LIKE sy-index.
START-OF-SELECTION.
SELECT PERNR ENAME
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM PA0001
WHERE PERNR < 50.
LOOP AT ITAB.
WRITE :/02 SY-VLINE , ITAB-PERNR, 15 SY-VLINE , ITAB-ENAME, 50
SY-VLINE.
ENDLOOP.
Receivers
receiver_list-recextnam = '[email protected]'. "-->
EMAIL ADDRESS
RECEIVER_list-RECESC = 'E'. "<-
RECEIVER_list-SNDART = 'INT'."<-
RECEIVER_list-SNDPRI = '1'."<-
APPEND receiver_list.
General data
w_object_hd_change-objla = sy-langu.
w_object_hd_change-objnam = 'Object name'.
w_object_hd_change-objsns = 'P'.
Mail subject
w_object_hd_change-objdes = 'Message subject'.
Mail body
APPEND 'Message content' TO message_content.
Attachment
CALL FUNCTION 'SAVE_LIST'
EXPORTING
list_index = '0'
TABLES
listobject = listobject.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
compressed_size = compressed_size
TABLES
in = listobject
out = compressed_attachment.
DESCRIBE TABLE compressed_attachment.
CLEAR packing_list.
packing_list-transf_bin = 'X'.
packing_list-head_start = 0.
packing_list-head_num = 0.
packing_list-body_start = 1.
packing_list-body_num = sy-tfill.
packing_list-objtp = 'ALI'.
packing_list-objnam = 'Object name'.
packing_list-objdes = 'Attachment description'.
packing_list-objlen = compressed_size.
APPEND packing_list.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = w_object_hd_change
object_type = 'RAW'
owner = sy-uname
TABLES
objcont = message_content
receivers = receiver_list
packing_list = packing_list
att_cont = compressed_attachment.
Reward points if useful..
Regards,
Goutham. -
SO_OBJECT_SEND??
HI
I want to know that what exactly is the purpose of the function module --> SO_OBJECT_SEND.
And how can I test this FM in my server?
Also where to check the e-mails of a person in SAP?
ThanksHi,
SO_OBJECT_SEND is used to send the messages / mails to SAP users as well as the external mail ids.
Please go thru the article / example below
SAP supplies a function module 'SO_OBJECT_SEND' to allow you send SAPOffice mails from within your ABAP programs. However, using that function module is complex and takes a lot of time to understand the usage of it.
The following function module is just a wrap around for SO_OBJECT_SEND and takes away much of the complexity out of the process. This function module not only sends a SAPOffice mail but also points to the current spool list. As you can see, many of the parameters have their defaults.
Parameter Descriptions
Either RECEPIENT or DLI must be specified. If the mail should be sent to several people, create a distribution list and supply its name for DLI.
Internal table TEXT should contain the body of the mail message.
While this function module can be used as it is, it is just an example. SO_OBJECT_SEND is very comprehensive and many of the features are omitted from this example. You are encouraged to examine SO_OBJECT_SEND, see all the available features, and change this function module to suit your requirements.
FUNCTION Z_SEND_MAIL_FOR_SPOOLLIST.
""Local interface:
*" IMPORTING
*" VALUE(SPOOLNUMBER) LIKE SY-SPONO DEFAULT SY-SPONO
*" VALUE(MAILNAME) LIKE SOOD1-OBJNAM DEFAULT 'NOTE'
*" VALUE(SUBJECT) LIKE SOOD1-OBJDES
*" VALUE(RECEPIENT) LIKE SY-UNAME OPTIONAL
*" VALUE(DLI) LIKE SOOS1-DLINAM OPTIONAL
*" TABLES
*" TEXT STRUCTURE SOLI OPTIONAL
*" EXCEPTIONS
*" ERROR
DATA: OBJECT_HD_CHANGE LIKE SOOD1 OCCURS 0 WITH HEADER LINE,
OBJPARA LIKE SELC OCCURS 0 WITH HEADER LINE,
RECEIVERS LIKE SOOS1 OCCURS 0 WITH HEADER LINE.
OBJECT_HD_CHANGE-OBJLA = SY-LANGU.
OBJECT_HD_CHANGE-OBJNAM = MAILNAME.
OBJECT_HD_CHANGE-OBJDES = SUBJECT.
OBJECT_HD_CHANGE-OBJSNS = 'F'.
OBJECT_HD_CHANGE-VMTYP = 'T'.
OBJECT_HD_CHANGE-SKIPS = 'X'.
OBJECT_HD_CHANGE-ACNAM = 'SP01'.
OBJECT_HD_CHANGE-OBJCP = 'X'.
RECEIVERS-RCDAT = SY-DATUM.
RECEIVERS-RCTIM = SY-UZEIT.
IF DLI IS INITIAL.
RECEIVERS-RECNAM = RECEPIENT.
RECEIVERS-RTUNAM = RECEPIENT.
ELSE.
RECEIVERS-RECNAM = DLI.
RECEIVERS-ADR_NAME = DLI.
RECEIVERS-RECESC = 'C'.
ENDIF.
RECEIVERS-SNDEX = 'X'. " Express-Mail
APPEND RECEIVERS.
OBJPARA-NAME = 'SPI'.
OBJPARA-LOW = SPOOLNUMBER.
APPEND OBJPARA.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
OBJECT_HD_CHANGE = OBJECT_HD_CHANGE
OBJECT_TYPE = 'RAW'
OWNER = SY-UNAME
TABLES
OBJCONT = TEXT
OBJPARA = OBJPARA
RECEIVERS = RECEIVERS
EXCEPTIONS
OTHERS = 01.
IF SY-SUBRC NE 0.
RAISE ERROR.
ENDIF.
ENDFUNCTION.
You can check the messages sent from SAP in trx SCOT / SOST.
Hope it helps.
Regards,
Shashank -
SO_OBJECT_SEND Title issue
Hi,
I am using SO_OBJECT_SEND to send outlookmail in my function module.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = ps_hd_change
object_type = p_object_type
owner = p_owner
originator = p_originator
originator_type = p_orig_type
TABLES
objcont = t_content
receivers = t_receivers
ps_hd_change-objla = 'E'.
ps_hd_change-objnam = 'Service Contract Status Change'.
ps_hd_change-objsns = 'O'.
ps_hd_change-file_ext = 'HTM'.
In ps_hd_change-objdes i am passing the title of the mail - "Service contract <VBELN> changed in <ESTAT> status."
the size of objdes is 50 characters only and the title is truncating at "Service contract <VBELN> changed in".
Please guide me how i can display the complete title.
thanks in advance.
ajayHi,
ps_hd_change-objla = 'E'.
ps_hd_change-objnam = text-001.
ps_hd_change-objsns = 'O'.
ps_hd_change-file_ext = 'HTM'.
double click in the text-001.it goes to text elements and write 'Service Contract Status Change'.
save and activate.
Regards,
Raj. -
SO_OBJECT_SEND,what are the input parameters ,how topass is it right
SO_OBJECT_SEND,
can any one tell how to use this function module to download the data from internal table to pdf file,i have just debugg, it
SO_NEW_DOCUMENT_ATT_SEND_API1, and found it, it may be correct or not i dont klnow, if there is some thing other plz tell me, its an urgent one, i need deatil parameters to be input , so that i can achieve to download information in pdfHi,
Good ex: for you...
REPORT zmbundal_email_out .
DATA BEGIN OF object_hd_change. "SAPoffice: object definition,
INCLUDE STRUCTURE sood1. "change attributes
DATA END OF object_hd_change.
DATA BEGIN OF object_content OCCURS 5. "SAPoffice: Single List with
INCLUDE STRUCTURE solisti1. "Column Length 255
DATA END OF object_content.
DATA BEGIN OF rec_table OCCURS 1. "SAPoffice: recipient with
INCLUDE STRUCTURE soos1. "attributes
DATA END OF rec_table.
Build email recipient table...........................................
CLEAR rec_table.
rec_table-sel = 'X'.
rec_table-recesc = 'B'.
rec_table-recesc = 'U'.
rec_table-recnam = 'U-'.
rec_table-recextnam = '[email protected]'.
rec_table-adr_name = '[email protected]'.
rec_table-sndex = 'X'.
rec_table-sndpri = '1'.
rec_table-mailstatus = 'E'.
rec_table-SNDSPO = 442355.
rec_table-SNDCP = 'X'.
COLLECT rec_table.
*.Email.content.........................................................
object_content = 'dannyboy baboy'. APPEND object_content.
object_content = 'dannyboy pogi'. APPEND object_content.
object_content = 'dannyboy fagg*t'. APPEND object_content.
*...Subject.Line........................................................
object_hd_change-objnam = 'Test email'.
object_hd_change-objdes = ' Email for Baboy'.
Send Email............................................................
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = object_hd_change
object_type = 'RAW'
outbox_flag = 'X'
TABLES
objcont = object_content
receivers = rec_table
EXCEPTIONS
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
originator_not_exist = 20
x_error = 21
OTHERS = 22.
*...SAPconnect..........................................................
SUBMIT rsconn01 "SAPconnect Start Send Process
WITH mode EQ '*'
WITH output EQ ''
TO SAP-SPOOL
DESTINATION 'LOCAL'
IMMEDIATELY ' '
KEEP IN SPOOL 'X'
WITHOUT SPOOL DYNPRO
AND RETURN. -
Error raise OPERATION_NO_AUTHORIZATION. in FM SO_OBJECT_SEND
Hi Experts,
Any idea why the FM is raising an exception OPERATION_NO_AUTHORIZATION.
I have coded :
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
FOLDER_ID = FOLDER_ID
FORWARDER = ' '
OBJECT_FL_CHANGE =
OBJECT_HD_CHANGE = ' '
OBJECT_ID = object_id
OBJECT_TYPE = ' '
OUTBOX_FLAG = 'X'
OWNER = sy-uname
STORE_FLAG = ' '
DELETE_FLAG = ' '
SENDER = ' '
CHECK_SEND_AUTHORITY = 'X'
CHECK_ALREADY_SENT = ' '
GIVE_OBJECT_BACK =
ORIGINATOR = ''
ORIGINATOR_TYPE = 'J'
LINK_FOLDER_ID = link_folder_id
SEND_REQUEST_OID = ' '
IP_ENCRYPT = 'U'
IP_SIGN = 'U'
IP_REC_COUNT_ADD =
IMPORTING
OBJECT_ID_NEW =
SENT_TO_ALL =
ALL_BINDING_DONE =
OFFICE_OBJECT_KEY =
ORIGINATOR_ID =
E_SEND_REQUEST_OID =
TABLES
OBJCONT =
OBJHEAD =
OBJPARA =
OBJPARB =
RECEIVERS = it_RECEIVERS
PACKING_LIST =
ATT_CONT =
ATT_HEAD =
NOTE_TEXT =
LINK_LIST =
APPLICATION_OBJECT =
EXCEPTIONS
ACTIVE_USER_NOT_EXIST = 1
COMMUNICATION_FAILURE = 2
COMPONENT_NOT_AVAILABLE = 3
FOLDER_NOT_EXIST = 4
FOLDER_NO_AUTHORIZATION = 5
FORWARDER_NOT_EXIST = 6
NOTE_NOT_EXIST = 7
OBJECT_NOT_EXIST = 8
OBJECT_NOT_SENT = 9
OBJECT_NO_AUTHORIZATION = 10
OBJECT_TYPE_NOT_EXIST = 11
OPERATION_NO_AUTHORIZATION = 12
OWNER_NOT_EXIST = 13
PARAMETER_ERROR = 14
SUBSTITUTE_NOT_ACTIVE = 15
SUBSTITUTE_NOT_DEFINED = 16
SYSTEM_FAILURE = 17
TOO_MUCH_RECEIVERS = 18
USER_NOT_EXIST = 19
ORIGINATOR_NOT_EXIST = 20
X_ERROR = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks
PapiyaHi,
I presume you dont have authorization to access the particular object. -
Send Mail using SO_OBJECT_SEND
Hi All,
What are all the parameters that has to be filled in order to send a internal mail to SAP to a User using the function module SO_OBJECT_SEND?
A sample code or link will be helpful.
Regards, Senthil G.Here is one of the sample code for FM <b>SO_OBJECT_SEND</b>
DATA: OBJECT_HD_CHANGE LIKE SOOD1 OCCURS 0 WITH HEADER LINE,
OBJPARA LIKE SELC OCCURS 0 WITH HEADER LINE,
RECEIVERS LIKE SOOS1 OCCURS 0 WITH HEADER LINE.
OBJECT_HD_CHANGE-OBJLA = SY-LANGU.
OBJECT_HD_CHANGE-OBJNAM = MAILNAME.
OBJECT_HD_CHANGE-OBJDES = SUBJECT.
OBJECT_HD_CHANGE-OBJSNS = 'F'.
OBJECT_HD_CHANGE-VMTYP = 'T'.
OBJECT_HD_CHANGE-SKIPS = 'X'.
OBJECT_HD_CHANGE-ACNAM = 'SP01'.
OBJECT_HD_CHANGE-OBJCP = 'X'.
RECEIVERS-RCDAT = SY-DATUM.
RECEIVERS-RCTIM = SY-UZEIT.
IF DLI IS INITIAL.
RECEIVERS-RECNAM = RECEPIENT.
RECEIVERS-RTUNAM = RECEPIENT.
ELSE.
RECEIVERS-RECNAM = DLI.
RECEIVERS-ADR_NAME = DLI.
RECEIVERS-RECESC = 'C'.
ENDIF.
RECEIVERS-SNDEX = 'X'. " Express-Mail
APPEND RECEIVERS.
OBJPARA-NAME = 'SPI'.
OBJPARA-LOW = SPOOLNUMBER.
APPEND OBJPARA.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
OBJECT_HD_CHANGE = OBJECT_HD_CHANGE
OBJECT_TYPE = 'RAW'
OWNER = SY-UNAME
TABLES
OBJCONT = TEXT
OBJPARA = OBJPARA
RECEIVERS = RECEIVERS
EXCEPTIONS
OTHERS = 01.
IF SY-SUBRC NE 0.
RAISE ERROR.
ENDIF.
ENDFUNCTION.
<b>
Please go thru the documentation of the FM in T-code SE37</b> -
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 guys,
somebody could tell me which is the function to send e-mail in abap program?... have an example with this functions?
Thanks in advance.
regards.
MarisolHi , this will help u.
How to send a report to an external mail-id?
Try this sample code :-
REPORT ZREPORT_TO_EMAIL NO STANDARD PAGE HEADING LINE-SIZE 200.
DATA : BEGIN OF ITAB OCCURS 0,
PERNR LIKE PA0001-PERNR,
ENAME LIKE PA0001-ENAME,
END OF ITAB.
DATA: message_content LIKE soli OCCURS 10 WITH HEADER LINE,
receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,
packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,
listobject LIKE abaplist OCCURS 10,
compressed_attachment LIKE soli OCCURS 100 WITH HEADER LINE,
w_object_hd_change LIKE sood1,
compressed_size LIKE sy-index.
START-OF-SELECTION.
SELECT PERNR ENAME
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM PA0001
WHERE PERNR < 50.
LOOP AT ITAB.
WRITE :/02 SY-VLINE , ITAB-PERNR, 15 SY-VLINE , ITAB-ENAME, 50
SY-VLINE.
ENDLOOP.
Receivers
receiver_list-recextnam = '[email protected]'. "-->
EMAIL ADDRESS
RECEIVER_list-RECESC = 'E'. "<-
RECEIVER_list-SNDART = 'INT'."<-
RECEIVER_list-SNDPRI = '1'."<-
APPEND receiver_list.
General data
w_object_hd_change-objla = sy-langu.
w_object_hd_change-objnam = 'Object name'.
w_object_hd_change-objsns = 'P'.
Mail subject
w_object_hd_change-objdes = 'Message subject'.
Mail body
APPEND 'Message content' TO message_content.
Attachment
CALL FUNCTION 'SAVE_LIST'
EXPORTING
list_index = '0'
TABLES
listobject = listobject.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
compressed_size = compressed_size
TABLES
in = listobject
out = compressed_attachment.
DESCRIBE TABLE compressed_attachment.
CLEAR packing_list.
packing_list-transf_bin = 'X'.
packing_list-head_start = 0.
packing_list-head_num = 0.
packing_list-body_start = 1.
packing_list-body_num = sy-tfill.
packing_list-objtp = 'ALI'.
packing_list-objnam = 'Object name'.
packing_list-objdes = 'Attachment description'.
packing_list-objlen = compressed_size.
APPEND packing_list.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = w_object_hd_change
object_type = 'RAW'
owner = sy-uname
TABLES
objcont = message_content
receivers = receiver_list
packing_list = packing_list
att_cont = compressed_attachment
with regards,
Hema.
pls reward if helpful. -
Apart from thr FM "SO_OBJECT_SEND" is theer any other FM for mailing
Hi I am using the function module "SO_OBJECT_SEND" and i am passing the following in this FM
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
folder_id = w_folder_id
object_hd_change = w_object_hd_change
object_id = w_object_id
object_type = 'EXT'
outbox_flag = 'X'
check_send_authority = 'X'
TABLES
receivers = it_receipients
note_text = lt_note
EXCEPTIONS
active_user_not_exist = 1
communication_failure = 2
My Problem is that i am getting an Extra attachment, can any one suggest me the solution ..why i am getting this extra attachment and how can it be avoided..In the T_OBJTXT you can add the body text.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_docdata
put_in_outbox = c_x
commit_work = c_x
TABLES
packing_list = t_objpack
object_header = t_objhead
contents_bin = t_objbin
contents_txt = t_objtxt
receivers = t_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc EQ 0.
COMMIT WORK AND WAIT.
ENDIF.
Maybe you are looking for
-
hi gurus, i have a problem in bdc programm there is 3 screen using transaction f-27 there is two amount field as(wrbtr,wrbtr2) two screen are run fine but the 3 screen does't take data automatically from flat file plz help me its urgent see my codes
-
Is Flash 10.3.181.34 a 64-bit version?
I am running Fedora 14 64 bit version of Linux and I am having a problem with Flash. When I try to look at what should be a Flash item, I get a blank spot. If I right click in there I get the message Movie not loaded and a place to click About Flas
-
Event... won't... die!! Why?
OK, iCal had been working for me ever since the first day it came out. Until Leopard. I have 2 recurring events that seemed to be causing problems. When the alarm for these 2 would pop up, it would take minutes for me to be able to click on a reminde
-
Executing multiple DDL statements with OracleCommand
hi.. im having trouble executing multiple ddl statements with the the oracle command object. i have tried to enclose them within Begin.. End; block but with no use. this problem seems to occur only with DDL statements,.. as my DML like update, delete
-
How to change async to sync after deploying the process.? Thanks
How to change async to sync after deploying the process.? Thanks