2023 Jun 07 3:26 PM
I set my purchase order to send mail when it is saved. Mail is sent with pdf and it works fine. But, I want to attach some custom documents in the mail, and my question is which program or BTE or anything is run for mail sending.
Kind regards.
2023 Jun 08 5:50 AM
You can check this by transaction NACE for application EF and output type Z101.
2023 Jun 08 5:50 AM
You can check this by transaction NACE for application EF and output type Z101.
2023 Jun 08 6:06 AM
2023 Jun 08 8:24 PM
Both suggestions worked. The program is SAPFM06P.
But, I fail to debug it. I put breakpoints inside include programs inside this program, but it never stops.
I am using me22n, I go to messages, then I write entries for external mail sending. It sends mail after saving, and I would like to debug when the document is attached to an email. But I fail to find and do it.
Any suggestion?
2023 Jun 21 6:54 AM
When the PO output is processed in an update task then you either need to change the output timing in 'Output further data' from 'Send immediately' to 'Send with application own transaction' or you not set a 'Session' breakpoint but an 'External' breakpoint in the output processing program.
2023 Jun 21 7:47 AM
2023 Jun 08 9:26 PM
There is a BADI definition 'BADI_MM_PO_OC_EMAIL', but it does not provide the capability to add additional attachments. It has methods for changing the sender, the recipients, the subject and the body of the message.
Regards,
Ryan Crosby
2023 Jun 09 12:43 PM
Did you find KBA 2667292 - How to manipulate external mail in MM output
2023 Jun 19 8:19 PM
I did but this can not help me completely.
Do you know maybe when the attachment is attached to mail before sending? When I debug, program FM06PE02 is opened, and form 'entry_neu' is run. But I can not see the place where an attachment is being attached. I see also some FMs inside this form, but I could not find exact place
2023 Jun 19 8:29 PM
alhodzic as I had already answered... the program does not provide a mechanism for adding additional attachments - your only option is to copy and modify which should be used as a last resort. However, the code that executes to place the attachment to the email body would be something like (variances based on your system version😞
* ------------ Call BCS interface ----------------------------------
TRY.
* ---------- create persistent send request ----------------------
send_request = cl_bcs=>create_persistent( ).
* ---------- add document ----------------------------------------
* get PDF xstring and convert it to BCS format
lp_pdf_size = xstrlen( os_formout-pdf ).
PERFORM xstring_to_solix
USING
os_formout-pdf.
* if BAdI is implementet create eMail with body and attach document
IF lo_badi_mm_po_oc_email IS BOUND.
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type = 'TXT'
i_subject = lv_subject
* i_language = lv_language
i_text = lt_body
RECEIVING
result = document .
*--- Add the document as an attachment
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = 'PDF'
i_attachment_size = lp_pdf_size
i_attachment_subject = lv_attachment_subject
* i_attachment_language = lv_language
i_att_content_hex = pdf_content.
ELSE.
lv_subject = fp_outputparams-covtitle.
document = cl_document_bcs=>create_document(
i_type = 'PDF' " cf. RAW, DOC
i_hex = pdf_content
i_length = lp_pdf_size
i_subject = lv_subject ). "#EC NOTEXT
ENDIF.
CALL METHOD document->get_docno "^2805618
RECEIVING
result = doc_no.
IF doc_no IS NOT INITIAL.
sy-msgv1 = doc_no.
ENDIF.
IF nast-nacha EQ 5 OR nast-nacha EQ 2.
MESSAGE i095(vn) WITH sy-msgv1 INTO mesg.
CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
EXPORTING
msg_arbgb = 'VN'
msg_nr = '095'
msg_ty = 'I'
msg_v1 = sy-msgv1
EXCEPTIONS
OTHERS = 1.
ENDIF. "v2805618
* add document to send request
send_request->set_document( document ).