2007 Aug 13 3:20 PM
Hi Guys,
I know there has been several post about this but i can get it to work.
I have taken the example from function module.
The sending of an express document to an internal user work.
But as soon as i use receiver type U i dont get anything send.
In the end i get
&ADU00100000094 : succesfully sent
RASS : succesfully sent
This means that the my@email.com has been deleted an it is only showing the id.
Here is my code.
REPORT ZMON_SEND_MAIL3 .
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... Not'.
DOC_CHNG-OBJ_DESCR = 'Read at once !'.
DOC_CHNG-SENSITIVTY = ''.
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 = 'my@email.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.
I have test through the work place that I am able to send email out of the house.
So the SMTP server is working.
Any help is appreciated.
2007 Aug 13 3:44 PM
Rasmus,
ADD parameter:
COMMIT_WORK = 'X'
to your CALL FUNCTION
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_TYPE = 'RAW'
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X' " <---- here
TABLES
2007 Aug 13 3:26 PM
Hi,
Go and check in the Transaction SCOT if some mails are waiting toi be send..
Thanks
Mahesh
2007 Aug 13 3:30 PM
I did.
No mail are coming through from the abap.
I can see it in the workplace though.
From here I also tried to send it to my mail.
And this works fine, it shows in transaction SCOT and is delivered to my mail.
But the abap is not working.
2007 Aug 13 3:35 PM
Hi,
Try this way
REPORT ZMON_SEND_MAIL3 .
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... Not'.
DOC_CHNG-OBJ_DESCR = 'Read at once !'.
DOC_CHNG-SENSITIVTY = ''.
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.
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.
CLEAR RECLIST. REFRESH RECLIST.
RECLIST-RECEIVER = 'my@email.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.
COMMIT WORK.
aRs
2007 Aug 13 3:44 PM
Rasmus,
ADD parameter:
COMMIT_WORK = 'X'
to your CALL FUNCTION
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_TYPE = 'RAW'
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X' " <---- here
TABLES
2007 Aug 14 9:25 AM
2007 Aug 13 3:44 PM
Hi,
Just put a commit work and wait at the end of your coding.
That should do the trick.
Brest regards,
Dirk.