function z*******_sendmail.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_INSPECTION) TYPE QPLOS OPTIONAL
*" VALUE(I_NOTIFICATION) TYPE ZQM_NOTNO OPTIONAL
*" VALUE(I_VENDOR) TYPE ELIFN OPTIONAL
*" TABLES
*" ET_RETURN TYPE BAPIRET2_T OPTIONAL
*"----------------------------------------------------------------------
data : doc_data type sodocchgi1,
it_pack type standard table of sopcklsti1,
wa_pack type sopcklsti1,
it_contents type standard table of solisti1,
wa_contents type solisti1,
it_recv type standard table of somlreci1 with header line,
wa_recv type somlreci1,
tab_lines type i.
data: subject(70).
data: lt_final type table of zqm_supt.
data: lv_final type zqm_supt ,
lv_vendor type adrnr ,
lv_mailid type ad_smtpadr .
data : obj_key type swotobjid-objkey,
cls_name type bapibds01-classname.
data : lt_gos type table of bdn_con,
wa_gos type bdn_con.
data : gc_307 type i value '307',
gc_308 type i value '308',
gv_msg_no type i.
clear : lv_final, lv_vendor, lv_mailid , it_contents[] .
if i_notification is not initial.
select single * from zqm_supt
into lv_final
where notno = i_notification
and block = ''.
select single adrnr from lfa1
into lv_vendor
where lifnr = lv_final-sellifnr.
select single smtp_addr from adr6
into lv_mailid
where addrnumber = lv_vendor.
endif.
wa_recv-rec_type = 'U'.
wa_recv-receiver = lv_mailid.
append wa_recv to it_recv.
concatenate 'QPH Process for notification:' i_notification 'has been created.' into subject separated by space.
doc_data-priority = 1.
doc_data-obj_descr = subject.
***************************************************************************************
wa_contents-line = '<html> <body style="background-color:#FFFFFF;"> <basefont face="arial, verdana, courier" size="2" >'.
append wa_contents to it_contents.
wa_contents-line = '<table style="MARGIN: 10px" bordercolor="#050211" width = "100%" border="1px"> '.
append wa_contents to it_contents.
concatenate '<tr><td width="30%">Vendor No/Name:</td><td>' lv_final-sellifnr ' / ' lv_final-name1 into wa_contents.
append wa_contents to it_contents.
concatenate '<tr><td width="30%">Inspection Lot Number:</td><td>' lv_final-prueflos into wa_contents.
append wa_contents to it_contents.
concatenate '<tr><td width="30%">QPH/Notification Number:</td><td>' lv_final-notno into wa_contents.
append wa_contents to it_contents.
concatenate '<tr><td width="30%">Plant</td><td>' lv_final-werk '</td></tr>' into wa_contents.
append wa_contents to it_contents.
concatenate '<tr><td width="30%">Raised Date</td><td>' lv_final-ddate ' / ' lv_final-ddate+6(2) '.'
lv_final-ddate+4(2) '.' lv_final-ddate(4) '</td></tr>' into wa_contents.
append wa_contents to it_contents.
concatenate '<tr><td width="30%">Part No/Name:</td><td>' lv_final-selmatnr ' / ' lv_final-ktextmat into wa_contents.
append wa_contents to it_contents.
concatenate '<tr><td width="30%">Rejection code/Description:</td><td>' lv_final-rcode ' / ' lv_final-rtext into wa_contents.
append wa_contents to it_contents.
wa_contents-line = '</table> '.
append wa_contents to it_contents.
wa_contents-line = '</body></html>'.
append wa_contents to it_contents.
describe table it_contents lines tab_lines.
******* packlist
wa_pack-head_start = 1.
wa_pack-head_num = 0.
wa_pack-body_start = 1.
wa_pack-body_num = tab_lines.
wa_pack-doc_type = 'HTML'.
append wa_pack to it_pack.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = doc_data
put_in_outbox = 'X'
commit_work = 'X'
tables
packing_list = it_pack
* OBJECT_HEADER =
* CONTENTS_BIN =
contents_txt = it_contents
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
receivers = it_recv
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 'dgsgfds' TYPE 'I'.
move gc_308 to gv_msg_no.
perform collect_msg tables et_return[]
using space
gv_msg_no.
else .
move gc_307 to gv_msg_no.
perform collect_msg tables et_return[]
using space
gv_msg_no.
endif.
endfunction.
*----------------------------------------------------------------------*
***INCLUDE LZQM_QPH_SENDMAILF01 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form COLLECT_MSG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_ET_DMS_RETURN[] text
* -->P_SPACE text
* -->P_GV_MSG_NO text
*----------------------------------------------------------------------*
form collect_msg tables p_et_return type bapiret2_t
using p_space
p_gv_msg_no.
data: gs_message type bapiret2.
*---Constant
constants:gc_msgclass type sy-msgid value 'ZPPS_MC',
gc_msgtype_error type sy-msgty value 'E',
gc_msgtype_sucess type sy-msgty value 'S'.
*--Global Variables
data : gv_msg_value type string,
gv_msg_no type sy-msgno.
clear: gs_message.
if p_gv_msg_no = '308' .
gs_message-id = gc_msgclass .
gs_message-type = gc_msgtype_error.
gs_message-number = p_gv_msg_no.
elseif p_gv_msg_no = '307'.
gs_message-id = gc_msgclass .
gs_message-type = gc_msgtype_sucess.
gs_message-number = p_gv_msg_no.
endif.
call function 'BALW_BAPIRETURN_GET2'
exporting
type = gs_message-type
cl = gs_message-id
number = gs_message-number
* par1 = gs_message-message_v1
importing
return = gs_message.
append gs_message to p_et_return.
clear: gs_message.
endform. " COLLECT_MSG
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
14 | |
10 | |
8 | |
7 | |
4 | |
4 | |
4 | |
4 | |
3 |