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

e-mail problem

Former Member
0 Likes
805

Hi,

I am sending a mail from an ABAP rogram using function module SO_DOCUMENT_SEND_API1. I am passing the following values in the function module.

Exporting

DOCUMENT_DATA-OBJ_NAME = Mail

DOCUMENT_DATA-OBJ_DESCR = Pending Mails

DOCUMENT_DATA-OBJ_LANGU = E

DOCUMENT_DATA-OBJ_PRIO = 1

Tables:

PACKING_LIST-BODY_START = 1

PACKING_LIST-BODY_NUM = 5

PACKING_LIST-DOC_TYPE = RAW

PACKING_LIST-OBJ_LANGU = E

CONTENTS_TXT-LINE is filled with the message that we want to send in the e-mail.

receivers-receiver = <mailid@abc.com>

receivers-rec_type = U.

Now the problem is that the function module is executed successfully (sy-subrc =0), but when I check in transaction SOST, the status shows "No entry in queue yet" and the mail is not received by the people intended to receive it. Please help!!!!!

Thanks,

Mick

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
740

go to SCOT transaction & click on the button 'start send process' & say ok. your mail will now appear in SOST.

or

in the function module call there is a parameter,

COMMIT_WORK = 'X'. put X for this.

regards

srikanth

7 REPLIES 7
Read only

Former Member
0 Likes
740

Hai Mike

Go through the following Code

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.

DOC_CHNG-OBJ_NAME = 'TEST'.

DOC_CHNG-OBJ_DESCR = 'Test-Dokument fur API1 Test'(001).

OBJTXT = 'Mindestgebot : $250000'.

APPEND OBJTXT.

OBJTXT = 'Eine Abbildung des zur Versteigerung stehenden Bildes'.

APPEND OBJTXT.

OBJTXT = 'wurde als Anlage beigefugt.'.

APPEND OBJTXT.

DESCRIBE TABLE OBJTXT LINES TAB_LINES.

READ TABLE OBJTXT INDEX TAB_LINES.

DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).

  • * ERSTELLEN DES EINTRAGS ZUM KOMPRIMIERTEN DOKUMENT

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.

  • * ERSTELLEN DER ANLAGE FUR DAS DOKUMENT

OBJBIN = '\O/ '. APPEND OBJBIN.

OBJBIN = ' '. APPEND OBJBIN.

OBJBIN = ' / \ '. APPEND OBJBIN.

DESCRIBE TABLE OBJBIN LINES TAB_LINES.

OBJHEAD = 'picasso.txt'. APPEND OBJHEAD.

  • * Erstellen des Eintrags zur komprimierten Anlage

OBJPACK-TRANSF_BIN = 'X'.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM = 1.

OBJPACK-BODY_START = 1.

OBJPACK-BODY_NUM = TAB_LINES.

OBJPACK-DOC_TYPE = 'TXT'.

OBJPACK-OBJ_NAME = 'ANLAGE'.

OBJPACK-OBJ_DESCR = 'Abbildung Objekt 138'.

OBJPACK-DOC_SIZE = TAB_LINES * 255.

APPEND OBJPACK.

  • * Fullen der Empfangerliste

RECLIST-RECEIVER = SY-UNAME.

RECLIST-REC_TYPE = 'B'.

APPEND RECLIST.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

DOCUMENT_DATA = DOC_CHNG

PUT_IN_OUTBOX = 'X'

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

Thanks & regards

Sreenivasulu P

Read only

Former Member
0 Likes
741

go to SCOT transaction & click on the button 'start send process' & say ok. your mail will now appear in SOST.

or

in the function module call there is a parameter,

COMMIT_WORK = 'X'. put X for this.

regards

srikanth

Read only

0 Likes
740

Thanks Srikanth.

In function module SO_DOCUMENT_SEND_API1, added the export parameter commit_work = 'X'. The mail is queued up in transaction SOST and is sent to the receiver.

Regards,

Mick

Read only

0 Likes
740

even without going to SCOT & click on 'start send process' you can write a small piece of code after function module call,

IF sy-subrc = 0.

MESSAGE s027(vv) WITH 'E-mail has been sent'.

*- buffered emails can be released via rsconn01.

SUBMIT rsconn01 USING SELECTION-SET 'SAP&CONNECTINT'

AND RETURN.

ELSE.

MESSAGE s027(vv) WITH 'E-mail not sent'.

ENDIF.

this submit program 'RSCONN01' will do the same what we do manually in SCOT. so if you write this piece of code in your program, mail will sent immediately & for you no need to go to SCOT. you can see it in SOST.

regards,

srikanth

Read only

Former Member
0 Likes
740

this program is used to send mails to the users internet mail addresses.

here is the sample code,

REPORT ZSRIM_PRG_MAIL1 .

DATA : L_TABLE_LINES LIKE SY-TABIX, " table index

L_TAB TYPE X VALUE '09', " TAB value

L_MANDT TYPE SY-MANDT. " Client

DATA: X_DOC_CHNG LIKE SODOCCHGI1, " document attributes

IT_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,

" attachment table

IT_OBJHEAD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,

" object header table

IT_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,

" binary table

IT_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,

IT_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.

CLEAR IT_RECLIST.

REFRESH IT_RECLIST.

*-popualate email ids

IT_RECLIST-RECEIVER = 'mailid@abc.com'.

IT_RECLIST-REC_TYPE = 'U'.

*-append receiver table

APPEND IT_RECLIST.

CLEAR IT_RECLIST.

*-populate document attributes

CLEAR: X_DOC_CHNG.

X_DOC_CHNG-OBJ_NAME = 'HEADING'.

X_DOC_CHNG-OBJ_DESCR = 'SOME DESCRIPTION'.

*-populate body text

IT_OBJTXT = 'ARCOS Reporting Extraction Error file is attached'.

APPEND IT_OBJTXT.

*-document size

CLEAR : L_TABLE_LINES.

DESCRIBE TABLE IT_OBJTXT LINES L_TABLE_LINES.

READ TABLE IT_OBJTXT INDEX L_TABLE_LINES.

X_DOC_CHNG-DOC_SIZE =

( L_TABLE_LINES - 1 ) * 255 + STRLEN( IT_OBJTXT ).

*-populate packing list for body text

CLEAR IT_OBJPACK-TRANSF_BIN.

IT_OBJPACK-HEAD_START = 1.

IT_OBJPACK-HEAD_NUM = 0.

IT_OBJPACK-BODY_START = 1.

IT_OBJPACK-BODY_NUM = L_TABLE_LINES.

IT_OBJPACK-DOC_TYPE = 'RAW'.

APPEND IT_OBJPACK.

CLEAR IT_OBJPACK.

*-populate object header

IT_OBJHEAD = 'Arcos Error Report'(057).

APPEND IT_OBJHEAD.

CLEAR IT_OBJHEAD.

*--for attachment ---start

*-populate object bin table for attachment

*-column header

CONCATENATE 'Document No.'

'Year'

  • 'Item'

  • 'Material No.'

'Error Text'

INTO IT_OBJBIN SEPARATED BY L_TAB.

APPEND IT_OBJBIN.

CLEAR IT_OBJBIN.

*-error details

CONCATENATE '1'

'1st record'

'1st record in attachment'

INTO IT_OBJBIN SEPARATED BY L_TAB.

APPEND IT_OBJBIN.

CLEAR IT_OBJBIN.

CONCATENATE '2'

'2st record'

'2st record in attachment'

INTO IT_OBJBIN SEPARATED BY L_TAB.

APPEND IT_OBJBIN.

CLEAR IT_OBJBIN.

*-get total no.of lines of Object table(attachment)

CLEAR : L_TABLE_LINES.

DESCRIBE TABLE IT_OBJBIN LINES L_TABLE_LINES.

*-populate object header

IT_OBJHEAD = 'Report'.

APPEND IT_OBJHEAD.

CLEAR IT_OBJHEAD.

*-packing list for attachment

IT_OBJPACK-TRANSF_BIN = 'X'.

IT_OBJPACK-HEAD_START = 1.

IT_OBJPACK-HEAD_NUM = 1.

IT_OBJPACK-BODY_START = 1.

IT_OBJPACK-BODY_NUM = L_TABLE_LINES .

IT_OBJPACK-DOC_TYPE = 'RAW' .

IT_OBJPACK-OBJ_NAME = 'ABCD'.

IT_OBJPACK-OBJ_DESCR = 'ERROR REPORT'.

IT_OBJPACK-DOC_SIZE = L_TABLE_LINES * 255.

APPEND IT_OBJPACK.

CLEAR IT_OBJPACK.

*--code for attachment -- end

*-Sending the document

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

DOCUMENT_DATA = X_DOC_CHNG

COMMIT_WORK = 'X'

PUT_IN_OUTBOX = 'X'

  • IMPORTING

  • SENT_TO_ALL =

  • NEW_OBJECT_ID =

TABLES

PACKING_LIST = IT_OBJPACK

OBJECT_HEADER = IT_OBJHEAD

CONTENTS_BIN = IT_OBJBIN

CONTENTS_TXT = IT_OBJTXT

  • CONTENTS_HEX =

  • OBJECT_PARA =

  • OBJECT_PARB =

RECEIVERS = IT_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.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Read only

Former Member
0 Likes
740

Hi Mick,

Commiting the work while calling the FM will solve your purpose as this will enable the sending process and you can then see the mail in SOST .

Regards,

Richa

Read only

Former Member
0 Likes
740

Hai Mick james

What is wrong with my Code?

P.S Check My Code Once Again

Check the F.M 'SO_NEW_DOCUMENT_ATT_SEND_API1'

Thanks & regards

Sreenivasulu P