‎2007 Oct 01 12:24 PM
Dear Friends,
I am using the following code to send mails but its not working out i mean i am not getting the final output
&----
*& Report ZEMAIL_ZJ
*&
&----
*&
*&
&----
REPORT ZEMAIL_ZJ.
DATA: w_doc_data LIKE sodocchgi1.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
DATA: t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
DATA: v_msg like SOLISTI1 occurs 0 with header line.
DATA: w_sent_all(1) TYPE c.
DATA: ld_error TYPE sy-subrc.
DATA: ld_receiver TYPE sy-subrc.
DATA : it_receiver LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF L_OBJHEAD OCCURS 0.
INCLUDE STRUCTURE SOLI.
DATA: END OF L_OBJHEAD.
parameters: werks like pspar-werks,
pernr like pernr-pernr,
effdt type d,
name(40).
TABLES : P0000, P0001, P0008, pa0000, pa0001, pa0008, t500p, t527x, t528t,t001p,pspar.
DATA: V_LINE(120),
V_TEXT(80),
V_TEXT_R(80),
V_TEXT1(300).
DATA : v_msg1 type p0000-pernr,
v_msg2 type p0001-ename,
v_msg3(10) type c,
v_msg4 type pa0008-trfgr,
v_msg5 type pa0001-orgeh,
v_msg6 type t500p-name1,
v_msg7 type pa0001-werks,
v_msg8 type t527x-orgtx,
v_msg9 type t528t-plstx,
v_msg10 type pa0001-plans,
v_msg11 type pa0001-btrtl.
*NEW-PAGE PRINT ON.
clear v_msg.
commit work.
WRITE : / 'Date :', SY-DATUM.
SKIP 3.
*******Changes start on 04.10.2006 *******
v_msg = 'Dear Sir,'.
v_msg = 'Dear All,'.
******Changes start on 04.10.2006******
append v_msg.
v_msg = ''.
append v_msg.
v_msg1 = pernr.
v_msg2 = name.
******Changes start on 04.10.2006 to change the date format******
concatenate p0000-begda6(2) '.' p0000-begda4(2) '.'
*p0000-begda+0(4) into v_msg3..
*concatenate p0000-begda6(2) '-' p0000-begda4(2) '-'
*p0000-begda+0(4) into v_msg3..
concatenate effdt6(2) '-' effdt4(2) '-'
effdt+0(4) into v_msg3.
******Changes end on 04.10.2006 to change the date format******
*******Changes start on 04.10.2006 to change the text of the mail****
CONCATENATE 'A Leaving action has been performed on Pernr' v_msg1
'Name' v_msg2 'from' v_msg3 '.' into v_msg separated by space.
CONCATENATE v_msg2 ',' 'Emp.No' v_msg1 'shall be separating from TATA Chemicals Ltd.'
' w.e.f.' v_msg3 '.' into v_msg separated by space.
*******Changes end on 04.10.2006 to change the text of the mail****
append v_msg.
v_msg = ''.
append v_msg.
*v_msg = 'You are requested to ensure that the following activities are done to have a smooth joining process.'.
v_msg = 'You are requested to ensure that the activity relevant to you is completed in time, to help us ensure a smooth separation process for the employee'.
append v_msg.
v_msg = ''.
append v_msg.
*v_msg = '1. Adequate support to be extended to the employee for a smooth separation process.'.
*append v_msg.
v_msg = ''.
append v_msg.
v_msg = '1. A communication from the Finance team to verify whether Full and Final settlement is done for the employee.'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = '2.A confirmation that No Dues Clearance form has been approved by all concerned agencies'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = '3. Exit Interview is taken by the Head HR, of the concerned SBU.'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = '4. A confirmation from Admin team on whether Assets like Car, Motorcycle, PC, Laptop, Landline, Mobile, VO Datacard provided by the company have been submitted back by the employee.'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = '5. A confirmation whether the SAP ID & E-Mail ID deletion / blocking process is completed before the leaving date'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = '6. A confirmation whether the Employee has submitted the ID / access card back to the Admin / Personnel department'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = '7. HOD & HR team to ensure that a proper handover document is prepared for the new incubent joining the vacant position.'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = 'HR Manager to hand over the Service certificate and Relieving letter only if all of the above has been co pleted in all respects.'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = 'This is for your information and necessary actions.'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = 'Warm regards,'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = 'SAP HCM Administrator'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = 'TATA CHEMICALS LIMITED'.
append v_msg.
NEW-PAGE PRINT OFF.
Fill the document data.
CLEAR w_doc_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'.
**********Changes start to change the subject line on 04.10.2006
w_doc_data-obj_descr = 'Leaving Action Performed'. "i_subj .
w_doc_data-obj_descr = 'Employee Separation Intimation'. "i_subj .
**********Changes end to change the subject line on 04.10.2006
*w_doc_data-sensitivty = 'O'.
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'.
t_packing_list-obj_descr = 'Test Message For Termination Action'.
APPEND t_packing_list.
Add the recipients email address
IF i_email IS NOT INITIAL.
*******************************************************************
**********Mail ids on the basis of Personnel Area****************
***For CHEM*********
if ( werks = 'CHEM').
clear t_receivers.
refresh t_receivers.
t_receivers-receiver = 'bsudhakar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'anilagarwal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
ELSEIF ( werks = 'AGRI').
**
**
t_receivers-receiver = 'nkchaturvedi@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'kseth@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'rknair@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'shashi.kurup@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bsudhakar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'anilagarwal@tatachemicals.com'. "i_email
t_receivers-receiver = 'satish@tatachemicals.com'. "i_emailg
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
t_receivers-receiver = 'mahesh.ladha@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
*
t_receivers-receiver = 'sanjiv.lal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
*
t_receivers-receiver = 'majid@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
*
t_receivers-receiver = 'bsudhakar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
*
t_receivers-receiver = 'anilagarwal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
*
t_receivers-receiver = 'shashi.kurup@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
t_receivers-receiver = 'ujha@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**************Mansih 10.09.2007
t_receivers-receiver = 'mkkar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
***********************************************************************
*****For FERT*************
ELSEIF werks = 'FERT'.
****************Manish 10.09.2007
t_receivers-receiver = 'tpvarghese@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'santosh.kumar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
*******************************************
t_receivers-receiver = 'nkchaturvedi@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'chiranjit.sen@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'ajaybamzai@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'snehasis.kumar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'kseth@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'rknair@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'pjain@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'abasu@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bsudhakar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'anilagarwal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'shashi.kurup@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
************************************************************************
*********For CORP*********
ELSEIF ( werks = 'CORP').
**
**
t_receivers-receiver = 'yschaugule@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bprao@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'prraut@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bsudhakar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-co _type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'anilagarwal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'shashi.kurup@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
ELSEIF ( werks = 'INNC').
**
**
t_receivers-receiver = 'yschaugule@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bprao@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'prraut@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bsudhakar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'anilagarwal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'shashi.kurup@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
ELSEIF ( werks = 'BIOF').
**
**
t_receivers-receiver = 'yschaugule@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bprao@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'prraut@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bsudhakar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'anilagarwal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
*
t_receivers-receiver = 'shashi.kurup@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikac u
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
ELSEIF ( werks = 'FAB').
**
****************Manish 10.092.007
t_receivers-receiver = 'satish@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'znlangrana@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**************************************************
t_receivers-receiver = 'srajpal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'prraut@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'yschaugule@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'majid@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'shashi.kurup@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
ELSEIF ( werks = 'FRES').
**
**
t_receivers-receiver = 'ppkhambaswadkar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunn
APPEND t_receivers.
**
t_receivers-receiver = 'kseth@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'rknair@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'shashi.kurup@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bsudhakar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'anilagarwal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
ENDIF.
DATA A1.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_DATA
DOCUMENT_TYPE = 'RAW'
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = ' '
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL = w_sent_all
SENT_TO_ALL = A1
NEW_OBJECT_ID =
TABLES
OBJECT_HEADER = L_OBJHEAD
OBJECT_CONTENT = V_MSG
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
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
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
commit work.
Useful answers wil be rewarded.
Regards,
gopi
‎2007 Oct 01 12:31 PM
Hi
To send mail Internally check this sample code it works fine this code was developed by me
*&---------------------------------------------------------------------*
*& Report ZMATURITYREPORT *
*& *
*& Title - Maturity report *
*& ABAP/4 Consultant *
*& Name- Pavan Praveen Valluri Created on 26/07/2007 *
*& FI Consultant- Amit Mistry *
*& Module - FI *
*& *
*&---------------------------------------------------------------------*
REPORT ZMATURITYREPORT.
tables: bseg.
* SELECTION SCREEN--------------------------------------------------- *
parameters: p_email type somlreci1-receiver default
'@gujaratpetro.com'.
* Data: p_email(25) type c value 'pavan@gujaratpetro.com'.
* END OF SELECTION SCREEN ------------------------------------------- *
*----------DATA DECLARATION--------------------------------------------*
data: it_message type standard table of solisti1 initial size 0
with header line.
data: it_message1 type standard table of solisti1 initial size 0
with header line.
data: it_message2(10) type N.
data: it_message3 type standard table of solisti1 initial size 0
with header line.
data: it_message4 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: text(150).
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.
start-of-selection.
data: lv_date type sy-datum.
data: lv_date1 type sy-datum.
data: lv_formatdate(10) type c.
data: lv_formatdate1(10) type c.
data: var1(4) type c,
var2(2) type c,
var3(2) type c.
data: begin of int_bseg occurs 0,
BELNR LIKE BSEG-BELNR,
ZUONR LIKE BSEG-ZUONR,
GJAHR LIKE BSEG-GJAHR,
DMBTR LIKE BSEG-DMBTR,
HKONT LIKE BSEG-HKONT,
end of int_bseg.
data: begin of int_SKAT occurs 0,
TXT50 LIKE SKAT-TXT50,
SAKNR LIKE SKAT-SAKNR,
KTOPL LIKE SKAT-KTOPL,
end of int_SKAT.
data: begin of int_bkpf occurs 0,
BELNR LIKE BKPF-BELNR,
BUKRS LIKE BKPF-BUKRS,
GJAHR LIKE BKPF-GJAHR,
BUDAT LIKE BKPF-BUDAT,
end of int_BKPF.
data: 2days_out type sy-datum.
2days_out = sy-datum + 2.
data: var4(4) type c,
var5(2) type c,
var6(2) type c.
*-------- END OF DATA DECLARATION--------------------------------------*
*--- CONCATENATING AND ARRANGING DATE ---------------------------------*
lv_date = 2days_out.
var1 = lv_date+(4).
var2 = lv_date+4(2).
var3 = lv_date+6(2).
concatenate var3 var2 var1 into lv_formatdate separated by '.'.
*--- END OF CONCATENATING AND ARRANGING DATE -------------------------*
*-------------------------SELECTION FOR BSEG---------------------------*
select zuonr belnr bukrs GJAHR DMBTR HKONT from bseg into
corresponding fields of table int_bseg
where bukrs = 'company name' and
ZUONR = lv_formatdate.
*--------------END OF SSELECTION FOR BSEG--------------------------- *
*-------------------------SELECTION FOR BKPF---------------------------*
select BUDAT BUKRS BELNR GJAHR from BKPF into
corresponding fields of table int_BKPF
where bukrs = 'company name'.
append int_BKPF.
*------------------END OF SELECTION FOR BKPF---------------------------*
*-------------------------SELECTION FOR SKAT---------------------------*
select SAKNR TXT50 from SKAT into
corresponding fields of table int_SKAT
where KTOPL = 'company name'.
*and SAKNR = INT_BSEG-HKONT.
APPEND INT_SKAT.
*--------------END OF SSELECTION FOR SKAT--------------------------- *
*-----------------POPULATING EMAIL SUBJECT ----------------------------*
perform populate_email_message_body.
perform send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Maturity after 2 days'
'XLS'
'filename'
' '
' '
' '
changing gd_error
gd_reciever.
* Instructs mail send program for SAPCONNECT to send email(rsconn01)
perform initiate_mail_execute_program.
*endif.
end-of-selection.
*------------END OF POPULATING EMAIL SUBJECT --------------------------*
*&---------------------------------------------------------------------
*
*& 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.
* 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. "send_file_as_email_attachment
*&---------------------------------------------------------------------
*
*& 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
*&---------------------------------------------------------------------
*
*& Form POPULATE_EMAIL_MESSAGE_BODY
*&---------------------------------------------------------------------
*
* Populate message body text
*----------------------------------------------------------------------
*
form populate_email_message_body.
refresh it_message.
refresh it_message1.
refresh it_message3.
refresh it_message4.
*--------------- LOOP FOR BSEG -----------------------------------------
loop at int_BSEG.
read table int_bKPF WITH KEY BELNR = INT_BSEG-BELNR
GJAHR = INT_BSEG-GJAHR.
read table int_SKAT WITH KEY SAKNR = INT_BSEG-HKONT.
*---CHANGING DATE FORMAT FOR BKPF---------------------------------------
lv_date1 = int_bkpf-budat.
var4 = lv_date1+(4).
var5 = lv_date1+4(2).
var6 = lv_date1+6(2).
concatenate var6 var5 var4 into lv_formatdate1 separated by '.'.
*---END OF CHANGING DATE FORMAT FOR BKPF-------------------------
it_message = int_bseg-belnr.
it_message1 = lv_formatdate1.
it_message2 = int_bseg-dmbtr.
it_message3 = int_bseg-hkont.
IT_MESSAGE4 = INT_SKAT-TXT50.
SHIFT IT_MESSAGE2 LEFT DELETING LEADING '0'.
*-------------POPULATING EMAIL BODY WITH DATA -------------------------
concatenate 'Maturity After 2Days' 'for' 'G/L account-' it_message3
'--' IT_MESSAGE4 ',' 'Amount-' it_message2
into it_message separated by space.
append it_message.
append it_message1.
append it_message3.
clear it_message.
clear it_message1.
clear it_message2.
clear it_message3.
endloop.
*------------END OF LOOP FOR BSEG --------------------------------------
endform. " POPULATE_EMAIL_MESSAGE_BODYTo send an mail with external attachment check this one
first create a Include report with the following coding
&----
*& Include ZPA1_INCLFOR_MAIL *
&----
*----
Data
*----
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
*----
FORM
*----
FORM ml_customize USING objname objdesc.
*----
Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
*----
Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
*----
FORM
*----
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
*----
FORM
*----
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
*----
FORM
*----
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
*----
Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
-----------
Header Data
Already Done Thru FM
-----------
-----------
Main Text
Already Done Thru FM
-----------
-----------
Packing Info For Text Data
-----------
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
-----------
Packing Info Attachment
-----------
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
-----------
Receiver List
Already done thru fm
-----------
ENDFORM. "ml_prepare
*----
FORM
*----
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
OBJECT_PARA =
object_parb =
receivers = 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 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
*----
FORM
*----
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
*----
Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
*----
Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
*----
FORM
*----
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
*----
Data
DATA : pos TYPE i.
DATA : len TYPE i.
*----
Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
Then include that report in the following report and copy the same code and paste it there
&----
*& Report ZPA_TEMP147 *
*& *
&----
*& *
*& *
&----
REPORT ZPA_TEMP147 .
INCLUDE zpa1_inclfor_mail.
*----
DATA
*----
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
*----
SELECTION SCREEN
*----
PARAMETERS : receiver TYPE somlreci1-receiver lower case.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY.
*----
AT SELECTION SCREEN
*----
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
*----
START-OF-SELECTION
*----
START-OF-SELECTION.
PERFORM ml_customize USING 'Tst' 'Testing'.
PERFORM ml_addrecp USING receiver 'U'.
PERFORM upl.
PERFORM doconv TABLES itab objbin.
PERFORM ml_prepare USING 'X' extension name.
PERFORM ml_dosend.
*----
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
*----
FORM
*----
FORM upl.
file_name = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
EXTENSION = extension
NAME = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
.
ENDFORM. "upl
*----
Regards
Pavan
‎2007 Oct 01 12:31 PM
Hi
To send mail Internally check this sample code it works fine this code was developed by me
*&---------------------------------------------------------------------*
*& Report ZMATURITYREPORT *
*& *
*& Title - Maturity report *
*& ABAP/4 Consultant *
*& Name- Pavan Praveen Valluri Created on 26/07/2007 *
*& FI Consultant- Amit Mistry *
*& Module - FI *
*& *
*&---------------------------------------------------------------------*
REPORT ZMATURITYREPORT.
tables: bseg.
* SELECTION SCREEN--------------------------------------------------- *
parameters: p_email type somlreci1-receiver default
'@gujaratpetro.com'.
* Data: p_email(25) type c value 'pavan@gujaratpetro.com'.
* END OF SELECTION SCREEN ------------------------------------------- *
*----------DATA DECLARATION--------------------------------------------*
data: it_message type standard table of solisti1 initial size 0
with header line.
data: it_message1 type standard table of solisti1 initial size 0
with header line.
data: it_message2(10) type N.
data: it_message3 type standard table of solisti1 initial size 0
with header line.
data: it_message4 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: text(150).
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.
start-of-selection.
data: lv_date type sy-datum.
data: lv_date1 type sy-datum.
data: lv_formatdate(10) type c.
data: lv_formatdate1(10) type c.
data: var1(4) type c,
var2(2) type c,
var3(2) type c.
data: begin of int_bseg occurs 0,
BELNR LIKE BSEG-BELNR,
ZUONR LIKE BSEG-ZUONR,
GJAHR LIKE BSEG-GJAHR,
DMBTR LIKE BSEG-DMBTR,
HKONT LIKE BSEG-HKONT,
end of int_bseg.
data: begin of int_SKAT occurs 0,
TXT50 LIKE SKAT-TXT50,
SAKNR LIKE SKAT-SAKNR,
KTOPL LIKE SKAT-KTOPL,
end of int_SKAT.
data: begin of int_bkpf occurs 0,
BELNR LIKE BKPF-BELNR,
BUKRS LIKE BKPF-BUKRS,
GJAHR LIKE BKPF-GJAHR,
BUDAT LIKE BKPF-BUDAT,
end of int_BKPF.
data: 2days_out type sy-datum.
2days_out = sy-datum + 2.
data: var4(4) type c,
var5(2) type c,
var6(2) type c.
*-------- END OF DATA DECLARATION--------------------------------------*
*--- CONCATENATING AND ARRANGING DATE ---------------------------------*
lv_date = 2days_out.
var1 = lv_date+(4).
var2 = lv_date+4(2).
var3 = lv_date+6(2).
concatenate var3 var2 var1 into lv_formatdate separated by '.'.
*--- END OF CONCATENATING AND ARRANGING DATE -------------------------*
*-------------------------SELECTION FOR BSEG---------------------------*
select zuonr belnr bukrs GJAHR DMBTR HKONT from bseg into
corresponding fields of table int_bseg
where bukrs = 'company name' and
ZUONR = lv_formatdate.
*--------------END OF SSELECTION FOR BSEG--------------------------- *
*-------------------------SELECTION FOR BKPF---------------------------*
select BUDAT BUKRS BELNR GJAHR from BKPF into
corresponding fields of table int_BKPF
where bukrs = 'company name'.
append int_BKPF.
*------------------END OF SELECTION FOR BKPF---------------------------*
*-------------------------SELECTION FOR SKAT---------------------------*
select SAKNR TXT50 from SKAT into
corresponding fields of table int_SKAT
where KTOPL = 'company name'.
*and SAKNR = INT_BSEG-HKONT.
APPEND INT_SKAT.
*--------------END OF SSELECTION FOR SKAT--------------------------- *
*-----------------POPULATING EMAIL SUBJECT ----------------------------*
perform populate_email_message_body.
perform send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Maturity after 2 days'
'XLS'
'filename'
' '
' '
' '
changing gd_error
gd_reciever.
* Instructs mail send program for SAPCONNECT to send email(rsconn01)
perform initiate_mail_execute_program.
*endif.
end-of-selection.
*------------END OF POPULATING EMAIL SUBJECT --------------------------*
*&---------------------------------------------------------------------
*
*& 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.
* 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. "send_file_as_email_attachment
*&---------------------------------------------------------------------
*
*& 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
*&---------------------------------------------------------------------
*
*& Form POPULATE_EMAIL_MESSAGE_BODY
*&---------------------------------------------------------------------
*
* Populate message body text
*----------------------------------------------------------------------
*
form populate_email_message_body.
refresh it_message.
refresh it_message1.
refresh it_message3.
refresh it_message4.
*--------------- LOOP FOR BSEG -----------------------------------------
loop at int_BSEG.
read table int_bKPF WITH KEY BELNR = INT_BSEG-BELNR
GJAHR = INT_BSEG-GJAHR.
read table int_SKAT WITH KEY SAKNR = INT_BSEG-HKONT.
*---CHANGING DATE FORMAT FOR BKPF---------------------------------------
lv_date1 = int_bkpf-budat.
var4 = lv_date1+(4).
var5 = lv_date1+4(2).
var6 = lv_date1+6(2).
concatenate var6 var5 var4 into lv_formatdate1 separated by '.'.
*---END OF CHANGING DATE FORMAT FOR BKPF-------------------------
it_message = int_bseg-belnr.
it_message1 = lv_formatdate1.
it_message2 = int_bseg-dmbtr.
it_message3 = int_bseg-hkont.
IT_MESSAGE4 = INT_SKAT-TXT50.
SHIFT IT_MESSAGE2 LEFT DELETING LEADING '0'.
*-------------POPULATING EMAIL BODY WITH DATA -------------------------
concatenate 'Maturity After 2Days' 'for' 'G/L account-' it_message3
'--' IT_MESSAGE4 ',' 'Amount-' it_message2
into it_message separated by space.
append it_message.
append it_message1.
append it_message3.
clear it_message.
clear it_message1.
clear it_message2.
clear it_message3.
endloop.
*------------END OF LOOP FOR BSEG --------------------------------------
endform. " POPULATE_EMAIL_MESSAGE_BODYTo send an mail with external attachment check this one
first create a Include report with the following coding
&----
*& Include ZPA1_INCLFOR_MAIL *
&----
*----
Data
*----
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
*----
FORM
*----
FORM ml_customize USING objname objdesc.
*----
Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
*----
Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
*----
FORM
*----
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
*----
FORM
*----
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
*----
FORM
*----
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
*----
Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
-----------
Header Data
Already Done Thru FM
-----------
-----------
Main Text
Already Done Thru FM
-----------
-----------
Packing Info For Text Data
-----------
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
-----------
Packing Info Attachment
-----------
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
-----------
Receiver List
Already done thru fm
-----------
ENDFORM. "ml_prepare
*----
FORM
*----
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
OBJECT_PARA =
object_parb =
receivers = 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 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
*----
FORM
*----
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
*----
Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
*----
Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
*----
FORM
*----
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
*----
Data
DATA : pos TYPE i.
DATA : len TYPE i.
*----
Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
Then include that report in the following report and copy the same code and paste it there
&----
*& Report ZPA_TEMP147 *
*& *
&----
*& *
*& *
&----
REPORT ZPA_TEMP147 .
INCLUDE zpa1_inclfor_mail.
*----
DATA
*----
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
*----
SELECTION SCREEN
*----
PARAMETERS : receiver TYPE somlreci1-receiver lower case.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY.
*----
AT SELECTION SCREEN
*----
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
*----
START-OF-SELECTION
*----
START-OF-SELECTION.
PERFORM ml_customize USING 'Tst' 'Testing'.
PERFORM ml_addrecp USING receiver 'U'.
PERFORM upl.
PERFORM doconv TABLES itab objbin.
PERFORM ml_prepare USING 'X' extension name.
PERFORM ml_dosend.
*----
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
*----
FORM
*----
FORM upl.
file_name = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
EXTENSION = extension
NAME = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
.
ENDFORM. "upl
*----
Regards
Pavan
‎2007 Oct 01 12:39 PM
hi
good
go through this link
http://sapr3.tripod.com/abap011.htm
http://www.saptechies.com/some-examples-of-the-use-of-so_new_document_send_api1/
reward point if helpful.
thanks
mrutyun^
‎2007 Oct 01 12:44 PM
Hi
<b>Sending External email through SAP</b>
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 = 'EXTERNAL-MAIL-ID@YAHOO.COM'. "-->
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.
<b>Reward if usefull</b>
‎2007 Oct 01 12:48 PM
Hi Gopi,
A small change in your code. which is given in block letters. Try using this. it has to work.
&----
*& Report ZEMAIL_ZJ
*&
&----
*&
*&
&----
REPORT ZEMAIL_ZJ.
DATA: w_doc_data LIKE sodocchgi1.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
DATA: t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
DATA: v_msg like SOLISTI1 occurs 0 with header line.
DATA: w_sent_all(1) TYPE c.
DATA: ld_error TYPE sy-subrc.
DATA: ld_receiver TYPE sy-subrc.
DATA : it_receiver LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
<b>DATA : w_lines type sy-dbcnt.</b>
DATA: BEGIN OF L_OBJHEAD OCCURS 0.
INCLUDE STRUCTURE SOLI.
DATA: END OF L_OBJHEAD.
parameters: werks like pspar-werks,
pernr like pernr-pernr,
effdt type d,
name(40).
TABLES : P0000, P0001, P0008, pa0000, pa0001, pa0008, t500p, t527x, t528t,t001p,pspar.
DATA: V_LINE(120),
V_TEXT(80),
V_TEXT_R(80),
V_TEXT1(300).
DATA : v_msg1 type p0000-pernr,
v_msg2 type p0001-ename,
v_msg3(10) type c,
v_msg4 type pa0008-trfgr,
v_msg5 type pa0001-orgeh,
v_msg6 type t500p-name1,
v_msg7 type pa0001-werks,
v_msg8 type t527x-orgtx,
v_msg9 type t528t-plstx,
v_msg10 type pa0001-plans,
v_msg11 type pa0001-btrtl.
*NEW-PAGE PRINT ON.
clear v_msg.
commit work.
WRITE : / 'Date :', SY-DATUM.
SKIP 3.
*******Changes start on 04.10.2006 *******
v_msg = 'Dear Sir,'.
v_msg = 'Dear All,'.
******Changes start on 04.10.2006******
append v_msg.
v_msg = ''.
append v_msg.
v_msg1 = pernr.
v_msg2 = name.
******Changes start on 04.10.2006 to change the date format******
concatenate p0000-begda6(2) '.' p0000-begda4(2) '.'
*p0000-begda+0(4) into v_msg3..
*concatenate p0000-begda6(2) '-' p0000-begda4(2) '-'
*p0000-begda+0(4) into v_msg3..
concatenate effdt6(2) '-' effdt4(2) '-'
effdt+0(4) into v_msg3.
******Changes end on 04.10.2006 to change the date format******
*******Changes start on 04.10.2006 to change the text of the mail****
CONCATENATE 'A Leaving action has been performed on Pernr' v_msg1
'Name' v_msg2 'from' v_msg3 '.' into v_msg separated by space.
CONCATENATE v_msg2 ',' 'Emp.No' v_msg1 'shall be separating from TATA Chemicals Ltd.'
' w.e.f.' v_msg3 '.' into v_msg separated by space.
*******Changes end on 04.10.2006 to change the text of the mail****
append v_msg.
v_msg = ''.
append v_msg.
*v_msg = 'You are requested to ensure that the following activities are done to have a smooth joining process.'.
v_msg = 'You are requested to ensure that the activity relevant to you is completed in time, to help us ensure a smooth separation process for the employee'.
append v_msg.
v_msg = ''.
append v_msg.
*v_msg = '1. Adequate support to be extended to the employee for a smooth separation process.'.
*append v_msg.
v_msg = ''.
append v_msg.
v_msg = '1. A communication from the Finance team to verify whether Full and Final settlement is done for the employee.'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = '2.A confirmation that No Dues Clearance form has been approved by all concerned agencies'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = '3. Exit Interview is taken by the Head HR, of the concerned SBU.'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = '4. A confirmation from Admin team on whether Assets like Car, Motorcycle, PC, Laptop, Landline, Mobile, VO Datacard provided by the company have been submitted back by the employee.'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = '5. A confirmation whether the SAP ID & E-Mail ID deletion / blocking process is completed before the leaving date'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = '6. A confirmation whether the Employee has submitted the ID / access card back to the Admin / Personnel department'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = '7. HOD & HR team to ensure that a proper handover document is prepared for the new incubent joining the vacant position.'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = 'HR Manager to hand over the Service certificate and Relieving letter only if all of the above has been co pleted in all respects.'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = 'This is for your information and necessary actions.'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = 'Warm regards,'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = 'SAP HCM Administrator'.
append v_msg.
v_msg = ''.
append v_msg.
v_msg = 'TATA CHEMICALS LIMITED'.
append v_msg.
NEW-PAGE PRINT OFF.
Fill the document data.
CLEAR w_doc_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'.
**********Changes start to change the subject line on 04.10.2006
w_doc_data-obj_descr = 'Leaving Action Performed'. "i_subj .
w_doc_data-obj_descr = 'Employee Separation Intimation'. "i_subj .
**********Changes end to change the subject line on 04.10.2006
*w_doc_data-sensitivty = 'O'.
<b>CLEAR w_lines.
DESCRIBE TABLE tbl_text LINES w_lines.
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
t_packing_list-body_num = w_lines.
t_packing_list-doc_type = 'RAW'.
t_packing_list-obj_name = text-m01. "Program name
t_packing_list-doc_size = ( w_lines - 1 ) * 255 + STRLEN( tbl_text-line ).
APPEND t_packing_list.</b>
Add the recipients email address
IF i_email IS NOT INITIAL.
*******************************************************************
**********Mail ids on the basis of Personnel Area****************
***For CHEM*********
if ( werks = 'CHEM').
clear t_receivers.
refresh t_receivers.
t_receivers-receiver = 'bsudhakar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'anilagarwal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
ELSEIF ( werks = 'AGRI').
**
**
t_receivers-receiver = 'nkchaturvedi@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'kseth@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'rknair@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'shashi.kurup@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bsudhakar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'anilagarwal@tatachemicals.com'. "i_email
t_receivers-receiver = 'satish@tatachemicals.com'. "i_emailg
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
t_receivers-receiver = 'mahesh.ladha@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
*
t_receivers-receiver = 'sanjiv.lal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
*
t_receivers-receiver = 'majid@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
*
t_receivers-receiver = 'bsudhakar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
*
t_receivers-receiver = 'anilagarwal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
*
t_receivers-receiver = 'shashi.kurup@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
t_receivers-receiver = 'ujha@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**************Mansih 10.09.2007
t_receivers-receiver = 'mkkar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
***********************************************************************
*****For FERT*************
ELSEIF werks = 'FERT'.
****************Manish 10.09.2007
t_receivers-receiver = 'tpvarghese@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'santosh.kumar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
*******************************************
t_receivers-receiver = 'nkchaturvedi@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'chiranjit.sen@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'ajaybamzai@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'snehasis.kumar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'kseth@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'rknair@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'pjain@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'abasu@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bsudhakar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'anilagarwal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'shashi.kurup@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
************************************************************************
*********For CORP*********
ELSEIF ( werks = 'CORP').
**
**
t_receivers-receiver = 'yschaugule@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bprao@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'prraut@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bsudhakar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-co _type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'anilagarwal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'shashi.kurup@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
ELSEIF ( werks = 'INNC').
**
**
t_receivers-receiver = 'yschaugule@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bprao@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'prraut@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bsudhakar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'anilagarwal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'shashi.kurup@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
ELSEIF ( werks = 'BIOF').
**
**
t_receivers-receiver = 'yschaugule@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bprao@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'prraut@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bsudhakar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'anilagarwal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
*
t_receivers-receiver = 'shashi.kurup@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikac u
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
ELSEIF ( werks = 'FAB').
**
****************Manish 10.092.007
t_receivers-receiver = 'satish@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'znlangrana@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**************************************************
t_receivers-receiver = 'srajpal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'prraut@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'yschaugule@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'majid@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'shashi.kurup@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
ELSEIF ( werks = 'FRES').
**
**
t_receivers-receiver = 'ppkhambaswadkar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunn
APPEND t_receivers.
**
t_receivers-receiver = 'kseth@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'rknair@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'shashi.kurup@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'bsudhakar@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
**
t_receivers-receiver = 'anilagarwal@tatachemicals.com'. "i_email
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = ' '. "'X' - zapne emailer notifikaciu
t_receivers-notif_ndel = ' '. "'X' - dunno
APPEND t_receivers.
ENDIF.
DATA A1.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_DATA
DOCUMENT_TYPE = 'RAW'
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = ' '
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL = w_sent_all
SENT_TO_ALL = A1
NEW_OBJECT_ID =
TABLES
OBJECT_HEADER = L_OBJHEAD
OBJECT_CONTENT = V_MSG
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
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
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
commit work.