‎2008 Oct 08 1:25 PM
Hi,
I am using FM to send external mail in a user exit.For that i have to write a commit work otherwise mail is not sent to external user although sy-subrc = 0. I tried to use COMMIT WORK but it is giving me A DUMP
showing calling program is not committed. Is it ok to call commit in an exit or else what need to be done.
i tried using standard parameter of FM while commit but it is also giving me dump.
Send External Mail To Sales Associate{code} CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = lf_doc_data
document_type = lf_doc
COMMIT_WORK = c_x
put_in_outbox = c_x
TABLES
object_content = lt_mailbody
receivers = lt_receiver_tab
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.
‎2008 Oct 08 1:28 PM
COMMIT_WORK is already there(Imporn parameter in FM) but its an optional entry just use this.
no need to use explicit commit work after the FM.
‎2008 Oct 08 1:42 PM
And in addition: keep it as a rule to avoid COMMIT in a user exit. You might trigger some nice nested commits or database inconsistencies.
‎2008 Oct 08 1:47 PM
‎2008 Oct 08 2:03 PM
‎2008 Oct 08 2:03 PM
Hi,
have a look into sap-note: 190669 (use: SO_DOCUMENT_SEND_API1 ...)
Regards, Dieter