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

sending email

Former Member
0 Likes
1,020

Hi Experts,

I have to send the output of my prg(some records) as email to clients.The spool contains more than 2 lakh records.Am doing this by using the FM "ZSENDEMAIL".If there r huge amt of records the mail is not sent.How can i overcome this?

Pls help me on this.Thanks in advance

Hi Experts,

I have to send the output of my prg(some records) as email to clients.The spool contains more than 2 lakh records.Am doing this by using the FM "ZSENDEMAIL".If there r huge amt of records the mail is not sent.How can i overcome this?

Pls help me on this.Thanks in advance

7 REPLIES 7
Read only

Former Member
0 Likes
983

Jyothi,

for this requirement there is prerequisite is that you have SMTP enable first.

than follow in report output screen in LIST>SEND.

Amit.

Read only

Former Member
0 Likes
983

You cannot send mails that are huge in size.. ask your

technical service team (not related to SAP) to increase the

outgoing email size ..

Read only

Former Member
0 Likes
983

Hi Jyothi,

Try to send the records as an attachment.Pls check the code below:

Creation of the document attachment

LOOP AT IT_ATTACHMENT.

OBJBIN = IT_ATTACHMENT-EMAIL.

APPEND OBJBIN.

CLEAR OBJBIN.

ENDLOOP.

DESCRIBE TABLE OBJBIN LINES TAB_LINES.

OBJHEAD = 'Material details'.

APPEND OBJHEAD.

Creation of the entry for the compressed attachment

OBJPACK-TRANSF_BIN = 'X'.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM = 1.

OBJPACK-BODY_START = 1.

OBJPACK-BODY_NUM = TAB_LINES.

OBJPACK-DOC_TYPE = 'RAW'.

OBJPACK-OBJ_NAME = 'ANLAGE'.

OBJPACK-OBJ_DESCR = 'Representation of object 138'.

OBJPACK-DOC_SIZE = TAB_LINES * 255.

APPEND OBJPACK.

Above is body and below is the complete code

DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE.

DATA: OBJHEAD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.

DATA: OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.

DATA: OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.

DATA: RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.

DATA: DOC_CHNG LIKE SODOCCHGI1.

DATA: TAB_LINES LIKE SY-TABIX.

DATA: L_MSG(100) TYPE C.

  • Creation of the document to be sent

DOC_CHNG-OBJ_NAME = 'Z2318S1B01'.

DOC_CHNG-OBJ_DESCR = EMSUBJ .

*OBJTXT = 'The details are attached.

OBJTXT = 'Pls check the document in the ATTACHMENT'.

APPEND OBJTXT.

DESCRIBE TABLE OBJTXT LINES TAB_LINES.

READ TABLE OBJTXT INDEX TAB_LINES.

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

  • Creation of the entry for the compressed document

CLEAR OBJPACK.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM = 0.

OBJPACK-BODY_START = 1.

OBJPACK-BODY_NUM = TAB_LINES.

OBJPACK-DOC_TYPE = 'RAW'.

APPEND OBJPACK.

  • Creation of the document attachment

LOOP AT IT_ATTACHMENT.

OBJBIN = IT_ATTACHMENT-EMAIL.

APPEND OBJBIN.

CLEAR OBJBIN.

ENDLOOP.

DESCRIBE TABLE OBJBIN LINES TAB_LINES.

OBJHEAD = 'Material details'.

APPEND OBJHEAD.

  • Creation of the entry for the compressed attachment

OBJPACK-TRANSF_BIN = 'X'.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM = 1.

OBJPACK-BODY_START = 1.

OBJPACK-BODY_NUM = TAB_LINES.

OBJPACK-DOC_TYPE = 'RAW'.

OBJPACK-OBJ_NAME = 'ANLAGE'.

OBJPACK-OBJ_DESCR = 'Representation of object 138'.

OBJPACK-DOC_SIZE = TAB_LINES * 255.

APPEND OBJPACK.

  • Completing the recipient list

CLEAR EMAILID.

LOOP AT EMAILID.

TRANSLATE EMAILID-LOW TO LOWER CASE.

RECLIST-RECEIVER = EMAILID-LOW.

RECLIST-REC_TYPE = 'U'.

APPEND RECLIST.

CLEAR RECLIST.

ENDLOOP.

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

DOCUMENT_TYPE_NOT_EXIST = 3

OPERATION_NO_AUTHORIZATION = 4

PARAMETER_ERROR = 5

X_ERROR = 6

ENQUEUE_ERROR = 7

OTHERS = 8.

IF SY-SUBRC = 0.

LOOP AT RECLIST.

IF RECLIST-RETRN_CODE = 0.

CONCATENATE RECLIST-RECEIVER ':'

'The document was sent' INTO L_MSG.

MESSAGE S656 WITH L_MSG.

ELSE.

CONCATENATE RECLIST-RECEIVER ':'

'The document was sent' INTO L_MSG.

MESSAGE E656 WITH L_MSG.

ENDIF.

ENDLOOP.

ELSE.

CONCATENATE RECLIST-RECEIVER ':'

'error occurred in sending mail' INTO L_MSG.

MESSAGE S656 WITH L_MSG.

ENDIF.

Pls reward if helpfull.

Regards,

Sharath

Read only

Former Member
0 Likes
983

Jyothi,

go for report LIST>SEND.

Thanks,

srii.

Read only

Former Member
0 Likes
983

Hi J ,

i think , in this case u need to split the Spool Job into smaller parts then u need to process further for Emails.

are u getting data from spool or ABAP List ?

regards

Prabhu

Read only

0 Likes
983

Hi,

Iam getting records from spool

Read only

0 Likes
983

Hi ,

You can try it by another FM called SO_DOCUMENT_SEND_API1.

Content of the mail stored in I_CONTENT. I_RECWIVERS is to store receivers ID.

call function 'SO_DOCUMENT_SEND_API1'

exporting

document_data = l_doc_chng

put_in_outbox = c_check

sender_address = c_sender

sender_address_type = 'INT'

commit_work = space

tables

packing_list = i_packlist

contents_txt = i_content

receivers = i_receivers

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.