‎2006 Dec 05 6:45 AM
Hello everyone,
Am using function module SO_NEW_DOCUMENT_SEND_API1 to send mails from SAP...but mails are not going...if anyone can help me out to sort out dis problem ...it wud b grt...
Regards,
sheetika....
‎2006 Dec 05 6:47 AM
Hi,
After the FM check for SY-SUBRC and write below code
IF sy-subrc EQ 0.
SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
ENDIF.
‎2006 Dec 05 6:50 AM
‎2006 Dec 05 7:08 AM
Hi Sheetika,
If the sy-subrc is 0, then the problem is only commit work.
Have u used "COMMIT WORK" after sending mail in the program?
It wont send mail unless u Commit work
Use commit work after the FM SO_NEW_DOCUMENT_SEND_API1.
Rgds,
Prakash
‎2006 Dec 05 7:13 AM
‎2006 Dec 05 7:21 AM
‎2006 Dec 05 7:21 AM
Hi,
chek the sample code..
if not RECLIST[] is initial.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_TYPE = 'RAW'
DOCUMENT_DATA = DOC_CHNG
COMMIT_WORK = COMMIT_WORK
PUT_IN_OUTBOX = 'X'
TABLES
OBJECT_CONTENT = OBJCONT
RECEIVERS = 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.
raise email_cancel.
endif.
endif.
Regards,
nagaraj
‎2006 Dec 05 7:24 AM
DATA: OBJCONT LIKE SOLISTI1 OCCURS 5 WITH HEADER LINE.
DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: ENTRIES LIKE SY-TABIX.
DATA: NAME(15).
* Fill the document
DOC_CHNG-OBJ_NAME = 'URGENT'.
DOC_CHNG-OBJ_DESCR = 'Read at once !'.
DOC_CHNG-SENSITIVTY = 'P'.
OBJCONT = 'Hey guys, time for lunch !!!'.
APPEND OBJCONT.
OBJCONT = 'Lets get going !'.
APPEND OBJCONT.
DESCRIBE TABLE OBJCONT LINES ENTRIES.
READ TABLE OBJCONT INDEX ENTRIES.
DOC_CHNG-DOC_SIZE = ( ENTRIES - 1 ) * 255 + STRLEN( OBJCONT ).
* Fill the receiver list
CLEAR RECLIST.
RECLIST-RECEIVER = SY-UNAME. " replace with <login name>
RECLIST-REC_TYPE = 'B'.
RECLIST-EXPRESS = 'X'.
APPEND RECLIST.
CLEAR RECLIST.
RECLIST-RECEIVER = 'ned.neighbour@ next.door.com'.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
* Send the document
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_TYPE = 'RAW'
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES
OBJECT_CONTENT = OBJCONT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
CASE SY-SUBRC.
WHEN 0.
LOOP AT RECLIST.
IF RECLIST-RECEIVER = SPACE.
NAME = RECLIST-REC_ID.
ELSE.
NAME = RECLIST-RECEIVER.
ENDIF.
IF RECLIST-RETRN_CODE = 0.
WRITE: / NAME, ': succesfully sent'.
ELSE.
WRITE: / NAME, ': error occured'.
ENDIF.
ENDLOOP.
WHEN 1.
WRITE: / 'Too many receivers specified !'.
WHEN 2.
WRITE: / 'No receiver got the document !'.
WHEN 4.
WRITE: / 'Missing send authority !'.
WHEN OTHERS.
WRITE: / 'Unexpected error occurred !'.
ENDCASE.Notes
To send an existing document, you must use the function module SO_OLD_DOCUMENT_SEND_API1.
If the active user is still to be able to process the document after it has been sent, it must be moved to the outbox when sent using the flag PUT_IN_OUTBOX. You can use the function module SO_FOLDER_READ_API1 to read the contents of the outbox and the object ID to find the document sent.
It is not possible to use a user address name as the recipient since this may not be unique. To get around this problem, you can use the function module SO_NAME_CONVERT_API1. This provides a hit list in response to a specified name, for which a dialog is constructed with a choice of required values.
‎2006 Dec 05 11:06 AM
Hi Sheetika,
I hope, after appending com_list for the Receivers list as "INT", call the same FM which you are using to send mails and immediately check for sy-subrc as:
if sy-subrc <> 0.
*--throw some error message
message 'Error Message'.
else.
COMMIT WORK AND WAIT .
*--throw success message here
endif.
Reward points if this works.
-Syed.
‎2006 Dec 05 9:17 PM
Check <b>SCOT</b> configuration. Try to send email without using this function module first (directly through business worklpace). If you are getting mail in your outlook then scot configuration is fine and there is some problem with your code.