on 06-29-2007 2:19 PM
Hi ,
I am using BADI 'BBP_DOC_SAVE_BADI' with business object '2201' for sending email.
I am using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' for sending email.
When I debug the code FM is returning sy-subrc ZERO. But after some time system display message as 'Update was terminated by <b>USER NAME'</b>
Could you please help me out in this issue ?
Thanks and Regards,
Amit Raut
We need to change setting in SCOT transaction allowing the sending email for different domain such *.yahoo.com or *.msn.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Which SRM version are you using ?
Have you used 'COMMIT WORK AND WAIT' after calling FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' ?
Please provide the detailed code in your next reply..
Regards
- Atul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is the code I have written,
My SRM version 4.00
*********************************************************************
METHOD if_ex_bbp_doc_save_badi~bbp_doc_save.
DATA: lt_item TYPE STANDARD TABLE OF bbp_pds_po_item_d,
lt_partner TYPE STANDARD TABLE OF bbp_pds_partner,
lt_objtxt TYPE STANDARD TABLE OF solisti1,
lt_objhead TYPE STANDARD TABLE OF solisti1,
lt_objbin TYPE STANDARD TABLE OF solisti1,
lt_reclist TYPE STANDARD TABLE OF somlreci1,
lt_doc_chng TYPE sodocchgi1,
lt_objpack TYPE TABLE OF sopcklsti1.
DATA: ls_item TYPE bbp_pds_po_item_d,
ls_partner TYPE bbp_pds_partner,
ls_header TYPE bbp_pds_po_header_d,
ls_objtxt TYPE solisti1,
ls_reclist TYPE somlreci1,
ls_objpack TYPE sopcklsti1.
DATA: lv_email TYPE ad_smtpadr,
lv_tab_lines TYPE sy-tabix.
CONSTANTS : lc_text1(22) VALUE 'A inter company PO no.',
lc_text2(40) VALUE 'has been created for your business unit.'.
CONSTANTS: lc_prtn_vendor TYPE crmt_partner_fct VALUE '00000027'.
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
i_guid = iv_doc_guid
IMPORTING
e_header = ls_header
TABLES
e_item = lt_item
e_partner = lt_partner.
LOOP AT lt_item INTO ls_item.
LOOP AT lt_partner INTO ls_partner
WHERE p_guid = ls_item-guid AND
partner_fct = lc_prtn_vendor.
Sending email process.
Get email address of partner function 'Ship-to-party:00000027'
SELECT SINGLE smtp_addr FROM adr6
INTO lv_email
WHERE addrnumber = ls_partner-addr_no.
Fill receiver list
ls_reclist-receiver = lv_email.
ls_reclist-rec_type = 'U'.
APPEND ls_reclist TO lt_reclist.
Fill subject
lt_doc_chng-obj_name = ls_header-object_id. "IV_OBJ_NAME.
CONCATENATE 'Intercompany PO.'
ls_header-object_id '/'
ls_item-number_int
INTO lt_doc_chng-obj_descr SEPARATED BY space.
Fill body
CLEAR ls_objtxt.
ls_objtxt = 'Dear Sir,'.
APPEND ls_objtxt TO lt_objtxt.
CLEAR ls_objtxt.
ls_objtxt = 'Workflow admin'.
APPEND ls_objtxt TO lt_objtxt.
Creating the entry for the compressed document
DESCRIBE TABLE lt_objtxt LINES lv_tab_lines.
lt_doc_chng-doc_size = lv_tab_lines * 255.
CLEAR ls_objpack-transf_bin.
ls_objpack-head_start = 1 .
ls_objpack-head_num = 0.
ls_objpack-body_start = 1.
ls_objpack-body_num = lv_tab_lines.
ls_objpack-doc_type = 'RAW' .
APPEND ls_objpack TO lt_objpack.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lt_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = lt_objpack
object_header = lt_objhead
contents_bin = lt_objbin
contents_txt = lt_objtxt
receivers = lt_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 sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
EXIT.
ENDLOOP.
ENDLOOP.
ENDMETHOD.
*****************************************************************
Do I need to change anytihng in code ? Please advice.
Thanks in advance,
Amit R.
Hi
<u>Some suggestions...</u>
Instead of looping at lt_partner table..
*LOOP AT lt_partner INTO ls_partner
*HERE p_guid = ls_item-guid AND*
* partner_fct = lc_prtn_vendor.
You can use ...
READ table lt_partner into ls_partner
where p_guid = ls_item-guid AND
partner_fct = lc_prtn_vendor.
IF sy-subrc eq 0.
....
............
..........
Endif.
<u>Go through this link for details on usage of 'SO_NEW_DOCUMENT_ATT_SEND_API1'. Function module.</u>
Do let me know.
Regards
- Atul
User | Count |
---|---|
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.