Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Error while sending email

Former Member
0 Kudos

Hi ,

In one of BADI the for saving PO in SRM 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

4 REPLIES 4

former_member404244
Active Contributor
0 Kudos

Hi,

Goto SM14 tcode ->press on ALL UPDATE REQUESTS BUTTON->Check ur USER ID->Double click on it,it will take to other screen->now in the appication tool bar u can find the abap editor symbol,click on it and see why u got the update termination error.

Regards,

Nagaraj

former_member188685
Active Contributor
0 Kudos

Amit,

There is some problem with your coding. Are you calling any FM's in update task.

please check your FM's.

if there are no update FM's in your code then passing the parameters to the mentioned FM.

Regards

Vijay

0 Kudos

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.

Former Member
0 Kudos

We need to change setting in SCOT transaction allowing the sending email for different domain such *.yahoo.com or *.msn.com