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: 

Problem in sending mail..

former_member799868
Participant
0 Kudos

I am sending mail to four different adresses in that .mail is going for one mail id always.for other three it is giving that error some times NOT ALWAYS. i am using recipient type as 'U'.

My code.

structure s_cust_mapp contains 4 mail ids.

IF NOT s_cust_mapp-dmail IS INITIAL.

MOVE s_zmusa_cust_mapp-dmail TO l_reclist-receiver.

l_reclist-rec_type = 'U'.

APPEND l_reclist.

CLEAR:l_reclist.

ENDIF.

IF NOT s_cust_mapp-bmail IS INITIAL.

l_reclist-receiver = s_zmusa_cust_mapp-bmail.

l_reclist-rec_type = 'U'.

APPEND l_reclist.

CLEAR:l_reclist.

ENDIF.

IF NOT s_cust_mapp-pmail IS INITIAL.

l_reclist-receiver = s_zmusa_cust_mapp-pmail.

l_reclist-rec_type = 'U'.

APPEND l_reclist.

CLEAR:l_reclist.

ENDIF.

IF NOT s_cust_mapp-amail IS INITIAL.

l_reclist-receiver = s_zmusa_cust_mapp-amail.

l_reclist-rec_type = 'U'.

APPEND l_reclist.

CLEAR:l_reclist.

ENDIF.

*l_objhex =

v_send_add = 'SAPUSER'.

u2022 Send Message

IF NOT l_reclist[] IS INITIAL.

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

document_data = l_docdata

commit_work = 'X'

sender_address = v_send_add

sender_address_type = 'A'

u2022 IMPORTING

u2022 SENT_TO_ALL =

u2022 NEW_OBJECT_ID =

u2022 SENDER_ID =

TABLES

packing_list = l_objpack

object_header = l_objhead

contents_bin = l_objbin

contents_txt = l_objtxt

u2022 CONTENTS_HEX =

u2022 OBJECT_PARA =

u2022 OBJECT_PARB =

receivers = l_reclist

u2022 EXCEPTIONS

u2022 TOO_MANY_RECEIVERS = 1

u2022 DOCUMENT_NOT_SENT = 2

u2022 DOCUMENT_TYPE_NOT_EXIST = 3

u2022 OPERATION_NO_AUTHORIZATION = 4

u2022 PARAMETER_ERROR = 5

u2022 X_ERROR = 6

u2022 ENQUEUE_ERROR = 7

u2022 OTHERS = 8

.

IF sy-subrc NE 0.

u2022 MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

u2022 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

WAIT UP TO 2 SECONDS.

SUBMIT rsconn01 WITH mode = 'INT'

WITH output = ' '

AND RETURN.

ENDIF.

ENDIF.

1 REPLY 1

Former Member
0 Kudos

Hi,

Try the following changes in the program


IF NOT s_cust_mapp-dmail IS INITIAL.
MOVE s_zmusa_cust_mapp-dmail TO l_reclist-receiver.
l_reclist-rec_type = 'U'.
l_reclist-com_type = 'INT'.   "<--- Integer Format for all mail ID's
APPEND l_reclist.
CLEAR:l_reclist.
ENDIF.


CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = l_docdata
put_in_outbox              = 'X'    "<---Outbox
commit_work = 'X'
sender_address = v_send_add
sender_address_type = 'A'

Cheers,

Kothand