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

Need to send Smart form via email through Driver program

Former Member
0 Kudos

Hi All,

We need to send smart form via email through a new driver program (z program). Can you please guide me on this.

I have used the following code to achieve this. We are getting message saying 'Mail request has created' when executed, but the mail is not sent.

lvs_comm_type = 'INT'.
lvs_comm_values-adsmtp-SMTP_ADDR = e_mail.
lvs_comm_values-adsmtp-R3_USER = 'X'.
lvs_comm_values-adsmtp-ENCODE = '0'.

call function 'CONVERT_COMM_TYPE_DATA'
exporting
pi_comm_type = lvs_comm_type
pi_comm_values = lvs_comm_values
pi_screen = ' '
pi_newid = 'X'
importing
pe_itcpo = lvs_itcpo
pe_device = lvf_device
pe_mail_recipient = p_mail_recipient
pe_mail_sender = p_mail_sender
exceptions
comm_type_not_supported = 1
recipient_creation_failed = 2
sender_creation_failed = 3
others = 4.
if sy-subrc ne 0.
raise COMMUNICATION_ERROR.
endif.

control_parameters-device = 'MAIL'.

output_options-TDIMMED = 'X'.
output_options-TDDELETE = 'X'.

CALL FUNCTION fm_name
exporting
CONTROL_PARAMETERS = control_parameters
MAIL_RECIPIENT = mail_recipient
MAIL_SENDER = mail_sender
OUTPUT_OPTIONS = output_options
USER_SETTINGS = space
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.

Thank you

4 REPLIES 4

Former Member
0 Kudos

This message was moderated.

0 Kudos

Hi Khushboo,

Thanks for the reply!

But we do not want to send the smart form as an attachment, i.e., we do not want to use FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'. We need to send smart form directly through the mail. Can you please help me out in this approach?

Thank you,

Former Member
0 Kudos

Hi Rajesh

You can send smartform output only by making it as an attachment.There is no other way.

If you find some other way , then do tell me.

Thanks

Khushboo

Former Member
0 Kudos

Hi,

For sending smartform output into mail you first have to generate spool request and convert it into PDF and then

only it can be sended into mail, please find the sample code in the mail below:

http://wiki.sdn.sap.com/wiki/display/sandbox/ConversionofSpoolRequestDataintoPDFandExcelFormatandSenditintoMail

Mansi

Edited by: Matt on Jan 29, 2010 8:25 AM - removed code, instead point to wiki that Mansi authored.