Application Development 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: 

Send email from PA30 user exit

Former Member
0 Kudos

When I try to send an email from user exit in ZXPADU02 it never makes it to SOST. WIll always go to SBWP outbox if I set the flag but never gets sent to receiver address.

If I paste the following code into a report it works fine. Is there some other parameter for this FM or some additional process needed to send email from a user exit?

DATA: maildata TYPE sodocchgi1.

DATA: mailtxt TYPE TABLE OF solisti1 WITH HEADER LINE.

DATA: mailrec TYPE TABLE OF somlrec90 WITH HEADER LINE.

CLEAR maildata.

REFRESH: mailtxt, mailrec.

maildata-obj_name = 'SRVC_EMAIL'.

maildata-obj_descr = 'Email test'.

maildata-obj_langu = sy-langu.

mailtxt-line = 'Test line from user exit'.

APPEND mailtxt.

mailrec-receiver = 'me@mywork.com'.

mailrec-rec_type = 'U'.

APPEND mailrec.

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_data = maildata

document_type = 'RAW'

put_in_outbox = 'X'

commit_work = 'X'

TABLES

object_header = mailtxt

object_content = mailtxt

receivers = mailrec

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Put the function call 'SO_NEW_DOCUMENT_SEND_API1'

in a report Program & SUBMIT that report from ZXPADU02.

Arya

3 REPLIES 3

Former Member
0 Kudos

Put the function call 'SO_NEW_DOCUMENT_SEND_API1'

in a report Program & SUBMIT that report from ZXPADU02.

Arya

Former Member
0 Kudos

That worked. Thanks.

Former Member
0 Kudos

Just found out from a co-worker that if you use IN BACKGROUIND TASK it works fine and no need to create any additional code.