on 08-19-2011 9:05 PM
Hello Gurus,
I have created a form based on Shipment Data, which will be working from VT02N transaction. Now, the generated form should be send as an email to different users. I could find several ways to send an email with pdf file as attachment. Now, i need to send the generated pdf form as an attachment to different users. I have written a custom program as the driver program which is used to configure this form in nace. I need to extend this logic so as to send an email also.
Please help me in solving this issue.
Thanks,
Rakesh.
Edited by: rakhi966 on Aug 19, 2011 10:08 PM
It is a serious pain to code in ABAP to send a pdf attachment.
We generate forms in the background and attach them to send to who ever requested them.
We use FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' - you have to convert your pdf to binary and pass it in along with all the other require information.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
when you receive your form data, run it through FM 'SCMS_XSTRING_TO_BINARY' to convert it.
here's a code snippet of converting to binary and attaching it.
*------Convert xstring to binary
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = output-pdf
TABLES
binary_tab = lt_bcs_pdf.
*-----packing list for attachment
CLEAR ls_packlist.
ls_packlist-head_start = '1'.
ls_packlist-head_num = '1'.
ls_packlist-body_start = '1'.
lv_line = lines( lt_bcs_pdf ).
ls_packlist-body_num = lv_line.
ls_packlist-doc_type = 'BIN'.
ls_packlist-transf_bin = 'X'.
ls_packlist-obj_name = 'Attachment'(006).
ls_packlist-obj_descr = 'Form Name.pdf'.
ls_packlist-doc_size = lv_pdf_size.
APPEND ls_packlist TO lt_packlist.
*----send the email out
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = ls_docdata
commit_work = 'X'
TABLES
packing_list = lt_packlist
object_header = lt_objhead
contents_txt = lt_cont_text
contents_bin = lt_bcs_pdf
receivers = lt_receiver
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.
Hello Robert,
I got another problem while configuring the form for the output. When I directly execute the program, mail is being sent directly along with attachment, but when I confiure the output and send from there, it is failing at commit work. It is saying "Output Terminated" when I check the same in ST22 it is giving me the detail as "COMMIT IN POSTING".
could you please help me in solving this issue. Hope my question is clear.
Thanks,
Rakesh.
I got another error while configuring the form as "COMMIT IN POSTING" and it is going into dump.
could any one please help me in resolving the issue
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello All,
I could solve the question by myself. Error "COMMIT_IN_POSTING" comes when another commit occurs in between a commit(probably commit used while saving standard transaction).
I could write a customize program with out commit and later allowed standard transaction to commit my work.
Thanks,
Rakesh
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.