Application Development and Automation 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: 
Read only

ABAP: MAIL prograM

vallamuthu_madheswaran2
Active Contributor
0 Likes
554

hai friends

the following program is Email program

it run successfully but the mail not send.

but i send a mail via TC SBWP it'll go to my mail-id please help me

thanks & regards

vallamuthu

&----


*& Report ZTEST_EMAIL *

*& *

&----


*& *

*& *

&----


REPORT ZTEST_EMAIL .

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'.

*loop at itab.

OBJCONT = 'sapuser.!!!'.

  • objcont = itab-vbeln.

APPEND OBJCONT.

OBJCONT = 'clent 800 !'.

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 = 'SAPUSER'. " replace with <login name>

RECLIST-REC_TYPE = 'B'.

RECLIST-EXPRESS = 'X'.

APPEND RECLIST.

CLEAR RECLIST.

RECLIST-RECEIVER = 'here i give mail_id'.

RECLIST-REC_TYPE = 'U'.

APPEND RECLIST.

CLEAR RECLIST.

RECLIST-RECEIVER = 'Patni Developer'.

RECLIST-REC_TYPE = 'U'.

APPEND RECLIST.

CLEAR RECLIST.

RECLIST-RECEIVER = 'mail-id'.

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.

3 REPLIES 3
Read only

Former Member
0 Likes
522

do u see the email in the system queue

check in tcode SOST.

The system must be enabled to send emails from the queue only then u will get it in ur inbox.

If u find the email in SOST then use SCOT and send the email.

Cheers

VJ

Read only

0 Likes
522

i want se38 program to send a mail not TC

this is mu client requrement

thanks & regards

vallamuthu

Read only

0 Likes
522

Hi,

Your program can only send email if the system is enabled to do so.

What ever code u write will trigger an email and it will be in the queue. If the system is not enabled to send email the email will be lying in the queue.

Check with ur basis team if they have enabled the email sending from the QUEUE.

SCOT is used to do it manually if the system is not enabled.

Hope this clarifies.

Cheers

VJ