Hi - I have created a custom transaction in which I send an email if the user changes a Service Master from my transaction. The first time the user enters my custom transaction and changes a Service Master, the email sends. If the user changes any subsequent Service Master from my transaction - the email does not send and I get the above exception.
I am using FM: SO_NEW_DOCUMENT_SEND_API1.
If I call the FM from a custom program multiple times it sends multiple emails - but in my transaction it throws the exception on the second call.
I started debugging SO_OBJECT_SEND from within the above FM - but have not yet found the inconsistency between the calls.
Any feedback is appreciated.
Dave
(see code and variable refs below)
-
The text elements text-011 thru -013 simply state SM Created, Changed, or Deleted.
c_language is 'EN'
c_doc_type is 'RAW'
p_v_dist is a distribution list
c_rec_type is 'C'
c_com_type is 'INT'
c_express is 'X'
i_content is populated with classification data for the changed Service Masters.
CODE
-
Create Distribution List - email prep
if p_v_dist = c_dist_create.
wa_doc_data-obj_descr = text-011.
wa_doc_data-obj_langu = c_language.
v_doc_type = c_doc_type.
i_receivers-receiver = p_v_dist.
i_receivers-rec_type = c_rec_type.
i_receivers-com_type = c_com_type.
i_receivers-express = c_express.
append i_receivers.
clear i_receivers.
Change Distribution List - email prep
elseif p_v_dist = c_dist_chng.
wa_doc_data-obj_descr = text-012.
wa_doc_data-obj_langu = c_language.
v_doc_type = c_doc_type.
i_receivers-receiver = p_v_dist.
i_receivers-rec_type = c_rec_type.
i_receivers-com_type = c_com_type.
i_receivers-express = c_express.
append i_receivers.
clear i_receivers.
Delete Distribution List - email prep
elseif p_v_dist = c_dist_del.
wa_doc_data-obj_descr = text-013.
wa_doc_data-obj_langu = c_language.
v_doc_type = c_doc_type.
i_receivers-receiver = p_v_dist.
i_receivers-rec_type = c_rec_type.
i_receivers-com_type = c_com_type.
i_receivers-express = c_express.
append i_receivers.
clear i_receivers.
endif.
Function to send the email - for all Create, Change,
or Delete SM actions in transaction
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = wa_doc_data
DOCUMENT_TYPE = c_doc_type
COMMIT_WORK = c_wait
TABLES
OBJECT_CONTENT = i_content
RECEIVERS = i_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
.
Again I appreciate any help you can provide letting me know why the email sends the first time I process a change in my transaction and only the first time. All other changes attempt to send the email but return the exception 'OBJECT_NOT_SENT'.