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: 

How to send the Billing document in pdf format when the billing is saved

Former Member
0 Kudos

Hey Guys,

I have a requirement while creating Billing Document. When the billing document is created automatically the mail should be sent to particular user. Is there any standard option available. Please help.

Regards,

Shankar

9 REPLIES 9

Former Member
0 Kudos

I guess we can create an output type ( As we do for scripts ), write a Driver program reading the details of the document, created spool, and convert that to pdf , and mail it.

Regards

Srikanth

0 Kudos

If your SAP system is enabled with an email SXC connection, you can configure your output for billing documents in VV32 with a medium of 5 for External Send and time of 4 for immediate. As long as the bill to party's customer master data contains an email address the output should be sent as pdf. As long as the output type is configured in NACE for external sends.

Former Member
0 Kudos

For converting to PDF this particular fm is used,check it out it may help u.

call function 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

IMPORTING

bin_filesize = v_len_in

TABLES

otf = i_otf

lines = i_tline

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

others = 4.

  • Fehlerhandling

if sy-subrc <> 0.

endif.

Regards

Former Member
0 Kudos

Hi,

Thanks for your input. I have a SMARTFORMS and Program name. I had assigned the SMARTFORMS and Program name to the message type. When I try to issue the output for a billing document, the SMARTFORMS output should be converted into pdf and sent to email for Sold to party. The email id will be maintained in the customer master (Sold to Party). Please help.

Regards,

Shankar

0 Kudos

Need to set fields getotf and no_dialog of structure <b>control_parameters</b> to X and tdnoprev of strcuture <b>output_options</b> to X of smartform FM.Then you will get OTF format in the table OTFDATA of the structure job_output_info of Smartform FM. Pass the output to CONVERT_OTF to get PDF format.

Regards,

Arun.

Former Member
0 Kudos

I think u have to maintain that once u create the dcoument.For sending the mail check the code it may help u.

FORM send_mail USING p_y16m_rcp_par STRUCTURE y16m_rcp_par.

  • Have a subject for the mail

g_s_document_data-obj_name = text-t02.

g_s_document_data-obj_descr = text-t03.

  • Fill receiver information

g_s_receivers-rec_type = p_y16m_rcp_par-rec_type.

g_s_receivers-rec_id = p_y16m_rcp_par-rec_id.

g_s_receivers-express = 'X'.

APPEND g_s_receivers TO g_t_receivers.

  • Call function to send mail

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_data = g_s_document_data

document_type = 'RAW'

  • PUT_IN_OUTBOX = ' '

  • IMPORTING

  • SENT_TO_ALL =

  • NEW_OBJECT_ID =

TABLES

  • OBJECT_HEADER =

object_content = g_t_object_content

  • CONTENTS_HEX =

  • OBJECT_PARA =

  • OBJECT_PARB =

receivers = g_t_receivers

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

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " SEND_MAIL

Regards

Former Member
0 Kudos

Hi,

I had implemented the coding for converting to OTF and then converting from OTF to PDF and then i implemented the function module for downloding the pdf file in hard drive. But I enconter the following error.

<b>OTF end command // missing in OTF data</b>

Please help.

Regards,

Shankar

0 Kudos

check ur OPTIONS-TDGETOTF = 'X'.

regards

Prabhu

Former Member
0 Kudos

Hi,

The following code were used in the program. please help.

call function 'CONVERT_OTF'

EXPORTING

FORMAT = 'PDF'

IMPORTING

BIN_FILESIZE = P_BIN_FILESIZE

BIN_FILE = P_BIN_FILETYPE

TABLES

otf = P_OTF

lines = P_LINE.

Regards,

Shankar