2010 Mar 10 3:49 AM
Hi friends,
1. I have created a report by using the function module 'SO_DOCUMENT_SEND_API1' to send mail to
the user with attachments.But in my report i can able to send only one attachment. Now I want to send more
than one attachment in the mail. How can i send?
2. while using document type 'XLS' type , I can able to get '.XLS' attachment but i cant get the attached datas
in correct alignment. Instead of getting line items one by one, i am getting all the line item details in a single line in the excel
sheet. How can i clear this problem? Thanks in advance...
Regards,
Sakthivel.VT
2010 Mar 10 4:33 AM
Hi,
Refer the below wiki:-
Multiple Attachments Explanation
http://wiki.sdn.sap.com/wiki/display/Snippets/MultipleAttachmentsExplanation
Hope this helps you in some way.
Regards,
Tarun
Hi friends,
1. I have created a report by using the function module 'SO_DOCUMENT_SEND_API1' to send mail to
the user with attachments.But in my report i can able to send only one attachment. Now I want to send more
than one attachment in the mail. How can i send?
2. while using document type 'XLS' type , I can able to get '.XLS' attachment but i cant get the attached datas
in correct alignment. Instead of getting line items one by one, i am getting all the line item details in a single line in the excel
sheet. How can i clear this problem? Thanks in advance...
Regards,
Sakthivel.VT
2010 Mar 10 4:27 AM
hi,
yes you can send more then one attachment in a mail.
see below/:-
DATA:objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE, " internal tables declared for sending attachments to the mail
"***********************************************************************
"*Attachment
"***********************************************************************
n = 1. "for sending 1st attachment
DESCRIBE TABLE objbin1 LINES tab_lines.
objpack-doc_size = tab_lines * 255.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = n.
objpack-body_num = tab_lines.
objpack-doc_type = 'XLS'.
docdata-obj_name = 'Excel_File_Attachment1'.
objpack-obj_descr = 'Excel File Attachment1'.
APPEND objpack.
n = n + tab_lines. "for sending 2nd attachment
DESCRIBE TABLE objbin2 LINES tab_lines.
objpack-doc_size = tab_lines * 255.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = n.
objpack-body_num = tab_lines.
objpack-doc_type = 'XLS'.
docdata-obj_name = 'Excel_File_Attachment2'.
objpack-obj_descr = 'Excel File Attachment2'.
APPEND objpack.
n = n + tab_lines. "for sending 3rd attachment
DESCRIBE TABLE objin3 LINES tab_lines.
objpack-doc_size = tab_lines * 255.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = n.
objpack-body_num = tab_lines.
objpack-doc_type = 'XLS'.
docdata-obj_name = 'Excel_File_Attachment3'.
objpack-obj_descr = 'Excel File Attachment3'.
APPEND objpack.
***********************************************************************
*Create the list of recipients
***********************************************************************
reclist-receiver = p_email1.
reclist-rec_type = 'U'.
reclist-express = 'X'.
APPEND reclist.
***********************************************************************
*Send the e-mail by using this function module
***********************************************************************
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = objpack
contents_bin = objbin_final
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.
COMMIT WORK.
regards
Ritesh
2010 Mar 10 4:33 AM
Hi,
Refer the below wiki:-
Multiple Attachments Explanation
http://wiki.sdn.sap.com/wiki/display/Snippets/MultipleAttachmentsExplanation
Hope this helps you in some way.
Regards,
Tarun
2010 Mar 10 11:19 AM
Hi friends,
Thanks for your replies.
Now i can able to get more than one attachment.
I am having two internal tables( i.e : two attachments).
In both attachments,i am getting the second internal table datas.i cant get first internal table values in first attachment.
Through FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' ,
we can pass only one internal table values. ( i.e: CONTENTS_BIN = I_OBJBIN )
Here how can i send more than one internal table values.This is what the actual problem.
for your reference,
WA_OBJTEXT[] = IT_ATTACH[]. "'This is attachment 1.'.
I_OBJBIN[] = WA_OBJTEXT[].
CLEAR WA_OBJTEXT.
WA_OBJTEXT[] = IT_ATTACH1[]. "'This is attachment 2.'.
I_OBJBIN[] = WA_OBJTEXT[].
CLEAR WA_OBJTEXT.
DESCRIBE TABLE IT_ATTACH LINES LINE.
WA_OBJPACK-TRANSF_BIN = C_X.
WA_OBJPACK-HEAD_START = 2.
WA_OBJPACK-HEAD_NUM = 1.
WA_OBJPACK-BODY_START = 1. "Itab i_objbin row number
WA_OBJPACK-BODY_NUM = LINE.
WA_OBJPACK-DOC_SIZE = WA_OBJPACK-BODY_NUM * 255 + STRLEN( IT_ATTACH ). "Approximately for 2 Lines-> 255 * 2
WA_OBJPACK-DOC_TYPE = 'RAW'.
WA_OBJPACK-OBJ_NAME = 'Attachment List 1'.
WA_OBJPACK-OBJ_DESCR = 'Attachment List 1'.
WA_OBJPACK-OBJ_LANGU = ' '.
APPEND WA_OBJPACK TO I_OBJPACK.
CLEAR LINE.
DESCRIBE TABLE IT_ATTACH1 LINES LINE.
WA_OBJPACK-TRANSF_BIN = C_X.
WA_OBJPACK-HEAD_START = 3.
WA_OBJPACK-HEAD_NUM = 1.
WA_OBJPACK-BODY_START = 3. "Itab i_objbin row number
WA_OBJPACK-BODY_NUM = LINE.
WA_OBJPACK-DOC_SIZE = WA_OBJPACK-BODY_NUM * 255 + STRLEN( IT_ATTACH1 ). . "Approximately for 1 Line
WA_OBJPACK-DOC_TYPE = 'RAW'.
WA_OBJPACK-OBJ_NAME = 'Attachment 2'.
WA_OBJPACK-OBJ_DESCR = 'Attachment 2'.
WA_OBJPACK-OBJ_LANGU = ' '.
APPEND WA_OBJPACK TO I_OBJPACK.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'.
Thanks & Regards,
Sakthivel.VT
2010 Mar 10 4:35 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |