04-04-2006 9:25 AM
Hi Friends,
Iam using the FunctionModule SO_DOCUMENT_SEND_API1 in my BSP Application to send mail to external system. It was working fine for some days but now it gives an error. It is raising an exception X_ERROR.
So, I tried to execute the FM SO_DOCUMENT_SEND_API1 itself and it also gives the same error.i.e., it gives an exception X_ERROR with sy-subrc = 6.
The parameters I have given are...
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_DATA
PUT_IN_OUTBOX = 'X'
SENDER_ADDRESS = SENDERMAILID
SENDER_ADDRESS_TYPE = 'SMTP'
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL = W_SENT_ALL
TABLES
PACKING_LIST = T_PACKING_LIST
contents_bin = t_attachment
CONTENTS_TXT = IT_MESSAGE
RECEIVERS = T_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.
<b>where</b>
W_DOC_DATA-DOC_SIZE = 1.
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = 'Hello'.
W_DOC_DATA-SENSITIVTY = 'F'.
WA_T_PACKING_LIST-TRANSF_BIN = SPACE.
WA_T_PACKING_LIST-HEAD_START = 1.
WA_T_PACKING_LIST-HEAD_NUM = 0.
WA_T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE IT_MESSAGE LINES WA_T_PACKING_LIST-BODY_NUM.
WA_T_PACKING_LIST-DOC_TYPE = 'RAW'.
APPEND WA_T_PACKING_LIST TO T_PACKING_LIST.
WA_T_RECEIVERS-RECEIVER = WA_ITAB1.
WA_T_RECEIVERS-REC_TYPE = 'U'.
WA_T_RECEIVERS-COM_TYPE = 'INT'.
WA_T_RECEIVERS-NOTIF_DEL = 'X'.
WA_T_RECEIVERS-NOTIF_NDEL = 'X'.
APPEND WA_T_RECEIVERS TO T_RECEIVERS.
here WA_ITAB1 contains the receiver MailIds.
So, what could be the reason for the error...How to solve that...
Any sort of help will be appreciated...
Regards,
Raju...
04-04-2006 9:48 AM
Hi Raju,
The one thing i found missing is :-
DOCUMENT_TYPE = 'RAW'
In the Exporting Parameters...
If it is in Html format then Use.....
DOCUMENT_TYPE = 'HTM'
One more thing....
Check for Sy-subrc of FM..
if sy-subrc = 0.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
this report program is used to automatically send the e-mails that are pending in the job queue.
Hope this will solve ur problem
Regards
-
Sachin Dhingra
04-04-2006 9:31 AM
Hi,
Why don't you use the BCS interface?
See also /people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface and /people/eddy.declercq/blog/2006/04/03/unknown-thus-unloved
Eddy
04-04-2006 9:48 AM
Hi Raju,
The one thing i found missing is :-
DOCUMENT_TYPE = 'RAW'
In the Exporting Parameters...
If it is in Html format then Use.....
DOCUMENT_TYPE = 'HTM'
One more thing....
Check for Sy-subrc of FM..
if sy-subrc = 0.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
this report program is used to automatically send the e-mails that are pending in the job queue.
Hope this will solve ur problem
Regards
-
Sachin Dhingra
04-04-2006 10:04 AM
Hi
Just check it is working fine
REPORT ZSENDEXTERNAL.
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: TAB_LINES LIKE SY-TABIX.
Creation of the document to be sent
File Name
DOC_CHNG-OBJ_NAME = 'SENDFILE'.
Mail Subject
DOC_CHNG-OBJ_DESCR = 'Send External Mail'.
Mail Contents
OBJTXT = 'Minimum bid : $250000'.
APPEND OBJTXT.
OBJTXT = 'A representation of the pictures up for auction'.
APPEND OBJTXT.
OBJTXT = 'was included as attachment.'.
APPEND OBJTXT.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
Creation of the entry for the compressed document
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
Creation of the document attachment
(Assume that the data in OBJBIN is in BMP format)
*OBJBIN = ' \O/ '. APPEND OBJBIN.
*OBJBIN = ' | '. APPEND OBJBIN.
*OBJBIN = ' / \ '. APPEND OBJBIN.
*DESCRIBE TABLE OBJBIN LINES TAB_LINES.
*OBJHEAD = 'PICTURE.BMP'.
*APPEND OBJHEAD.
Creation of the entry for the compressed attachment
*OBJPACK-TRANSF_BIN = 'X'.
*OBJPACK-HEAD_START = 1.
*OBJPACK-HEAD_NUM = 1.
*OBJPACK-BODY_START = 1.
*OBJPACK-BODY_NUM = TAB_LINES.
*OBJPACK-DOC_TYPE = 'BMP'.
*OBJPACK-OBJ_NAME = 'PICTURE'.
*OBJPACK-OBJ_DESCR = 'Representation of object 138'.
*OBJPACK-DOC_SIZE = TAB_LINES * 255.
*APPEND OBJPACK.
Completing the recipient list
RECLIST-RECEIVER = 'youremail@sap.com'.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
*RECLIST-RECEIVER = 'SAPUSERNAME'.
*RECLIST-REC_TYPE = 'P'.
*APPEND RECLIST.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
CASE SY-SUBRC.
WHEN 0.
WRITE: / 'Result of the send process:'.
LOOP AT RECLIST.
WRITE: / RECLIST-RECEIVER(48), ':'.
IF RECLIST-RETRN_CODE = 0.
WRITE 'The document was sent'.
ELSE.
WRITE 'The document could not be sent'.
ENDIF.
ENDLOOP.
WHEN 1.
WRITE: / 'No authorization for sending to the specified number',
'of recipients'.
WHEN 2.
WRITE: / 'Document could not be sent to any recipient'.
WHEN 4.
WRITE: / 'No send authorization'.
WHEN OTHERS.
WRITE: / 'Error occurred while sending'.
ENDCASE.
regards
vinod
04-04-2006 12:40 PM
Hi,
Pls chek these links and see if u r able to send a mail:
http://www.sapdevelopment.co.uk/reporting/email/email_mbody.htm
Regards,
Anjali
04-06-2006 10:42 AM
Hi Friends,
Thanks for your reply.
But my problem still exists. I think Iam not clear with my question.
Iam using the FM <b>SO_DOCUMENT_SEND_API1</b> in my BSP application to send mail to external system. It was sending mails for some days. It was working fine.
But now it is rasing an exception X_ERROR in FM. If I go to that FM and execute it iwth all the export and tables values it is giving me error.
Am I sending the correct values to the FM?
Regards,
Raju...
04-06-2006 10:55 AM
Hi,
Did you set the recipient to type 'U' and the sender to type 'INT'?
Check also /people/dezso.pap/blog/2006/03/28/send-mail-fax-with-100-lines-from-a-bsp-application
Eddy
11-10-2014 2:02 PM
Be sure that the it_recipient is not empty or contain empty record
01-18-2023 11:27 AM