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.
Showing results for 
Search instead for 
Did you mean: 

Email Billing document as PDF Attachment while saving from VF01/02

Former Member
0 Kudos


Can anybody suggest if there is any BADI/User Exit/Configuration exists in order to email Billing document as a PDF attachment while saving from VF01 or VF02?

We need to trigger this while saving the Output type say, VF02 GOTO -> HEADER -> OUTPUT (select the output type) -> SAVE - should send an email with PDF attachment.

I have written the code for sending email with PDF attachment. Presently this code is included in the Print program for the sapscript and an email is sent when an output is issued from VF01/02/03 where as the requirement is to send email whenever the document is saved.

Thanks in Advance,



Former Member
0 Kudos


Define communication strategy with communication type having email as the first preference. Configure your output type to use that communication strategy with Transmission Medium 5 (External send). You configure which partner to be used, and the email address will be picked from the partner. In the transaction SCOT, on the node for internet connection, only allow PDF format, and maintain the conversion rules such that OTF are converted to PDF before sending.

This should help you send the output directly as email to a partner from the billing document.


0 Kudos

Hi Raj,

Thanks for the quick response.

Under transaction SCOT i can already see a node created below INTERNET which is configured for a mail server with mail host & mail port. i can also see under 'Supported address types' Internet check box is selected, on selecting the 'Set' button i can see 'Output Formats for SAP Dcouments' - SAPScipt/Smart form = PDF be selected from the drop down list. i think this is what you were recomending for mapping the OTF to PDF conversion?

If this is correct then could you please clarify this configuration holds for all the INTERNET activities from SCOT?

Secondly, i have many Output types for the same Layout set and print program for the given billing document. so would it be possible for you to elaborate on the customizing for the output types with communication strategy.


0 Kudos


The conversion rules are configured in SCOT using the menu path Settings->Conversion Rule.

Set up OTF to PDF as rank 1.

In SPRO, SD->Basis Functions->Output Determination-> Determine communication strategy, set up your communication strategy with INT as the first position. You can set PRT as the second option.

Then you maintain your output types (v/40). For each output you want to send via email, you set the communication strategy to the one you just defined. Set up the processing routines with medium 5 (external send)as the same program and sapscript as for medium 1(print). Also set up the partner function for medium 5 to the correct partner function which will have the email address.


0 Kudos

Hi Raj,

Thanks Your solution is working. An email will be sent to the mail ID present in the partner. Instead of this, is it possible to send to different ID? for eg,

For Output type ZZZZ - Partner email ID = (but i need to send a mail to Currently mail is sent to


for output type ZZYY - Partner email ID = (but i need to send a mail to Currently mail is sent to

Secondly, is it possible to control the Email parameters like, 'Subject', 'Mail body', 'PDF Document name'....?

Thanks in Advance for your suggestions,


0 Kudos

Hi Raj

I have almost all the same type of requirement that Naren has asked you.......i.e... When ever the user selects the OUTPUT TYPE in VF02....thru

navigation GOTO -

> OUTPUT. and when he clicks on SAVE my requirement asks to generate a popup containing and input field. In this input field the user will enter an email address upon clicking OK button in this popup ....the invoice must be emailed to address specified in the POPUP. I am using a Zoutput type having BP as partner and External Send (5) as Transmission medium. Can you please suggest me...............How to work out on this bcoz I have searched for user-exits and could find none that could match this requirement and moreover I have called the popup in the FORM ENTRY of the print program i.e Z printprogram but it is not getting called after SAVE ..........Will the SAVE button trigger a print program before sending Email bcoz I have checked it by putting a break-point on the code I have return for POPUP in Z printprogram...................Please suggest me on this.....

Thanks in advance for your reply


0 Kudos


While saving subroutine FORM_OPEN will get triggerred, and this will be included in the Z Program. If it is not contained in the Z program, include this subroutine. This subroutine will have include RVADOPFO.

The above include will have the function module ADDR_GET_NEXT_COMM_TYPE, and the import parameter LVS_COMM_VALUES will contain the address number and email address to whom the pdf needs to be sent.

So here, i.e. In place of standard include RVADOPFO, put custom include ZRVADOPFO, and modify the code as below.

After the function module ADDR_GET_NEXT_COMM_TYPE, read the email address from any custom table based on the various conditions or hard coded value, then move it to the below variable.


And remaining functionality will be taken care by the standard code. i.e. converting the spool to PDF and attaching it while sending the email etc....

If I am not wrong, the same functionality will work even while saving the sales order etc..



0 Kudos

Hi ,

I have the same requirement as yours can you elaborate about the settings which has to be done in SCOT because Settings->Conversion Rule ( i am not able to find this option) we are using ECC 5.0 also what are the necessary settings required in SPRO.

I have implemented the requirement for VF31 but how to do for VF02/VF01 when SAVE.