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: 

Runtime error while trying to convert script to pdf and sending in mail

Former Member
0 Kudos

Hi all,

I m trying to convert the standard script into pdf using convert_otf fm and trying to send it as an attachment using 'SO_NEW_DOCUMENT_ATT_SEND_API1'.

I m using fm 'SSF_FUNCTION_MODULE_NAME' to get the function module name.

But i m getting a runtime error while executing the program..

Can anyone help me in this issue please.

Thanks in advance,

Ashok

8 REPLIES 8

Former Member
0 Kudos

Hi Ashok,

Can u tell what error u r getting and where...

0 Kudos

Hi Ramesh,

I m getting an runtime error function module not found. I ll paste the code here.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = lf_formname

IMPORTING

fm_name = lf_fm_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

IF sy-subrc = 0.

  • error handling ent_retco = sy-subrc.

  • perform protocol_update_i.

ENDIF.

ls_control_param-getotf = 'X'.

DATA: l_document_output_info TYPE ssfcrespd,

l_job_output_info TYPE ssfcrescl,

l_job_output_options TYPE ssfcresop.

  • check ent_retco eq 0.

CALL FUNCTION 'lf_fm_name'

EXPORTING

archive_index = toa_dara

archive_parameters = arc_params

control_parameters = ls_control_param

mail_recipient = ls_recipient

mail_sender = ls_sender

output_options = ls_composer_param

user_settings = ' '

zxekko = l_doc-xekko

zxpekko = l_doc-xpekko

    • zxaend = l_doc-xaend

IMPORTING

document_output_info = l_document_output_info

job_output_info = l_job_output_info

job_output_options = l_job_output_options

TABLES

l_xekpo = l_doc-xekpo[]

l_xekpa = l_doc-xekpa[]

l_xpekpo = l_doc-xpekpo[]

l_xeket = l_doc-xeket[]

l_xtkomv = l_doc-xtkomv[]

l_xekkn = l_doc-xekkn[]

l_xekek = l_doc-xekek[]

l_xaend = l_doc-xaend[]

l_xkomk = l_xkomk

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

IMPORTING

bin_filesize = v_len_in

TABLES

otf = l_job_output_info-otfdata

lines = tb_pdf

EXCEPTIONS

err_max_linewidth = 0

err_format = 1

err_conv_not_possible = 2

OTHERS = 3.

Former Member
0 Kudos

Hi,

Please go through the link below,

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

Regards,

Mansi

Edited by: MANSI ASNANI on Jan 28, 2010 12:30 PM

Edited by: MANSI ASNANI on Jan 28, 2010 12:30 PM

Former Member
0 Kudos

"I m using fm 'SSF_FUNCTION_MODULE_NAME' to get the function module name."

Why? You're not using a SmartForm....?? If I remember correctly, the FM you're referring to is used to find the function module auto-generated by a SmARtForm, name supplied in the interface to the FM.

If you have the output into a PDF format in an internal table or structure, then all you need is to attach and send the email.... Documentation for the send mail can be found in SAP Notes...Original documentation in SAP is not entirely correct...

Former Member
0 Kudos

Hi Ashok,

Please let us know if you are facing an issue with SAPscript or Smartform.

Only incase of smartforms, we use the 'SSF_FUNCTION_MODULE_NAME' to get the FM name.

Regards,

Vinaya

Former Member
0 Kudos

Hi

First of all if you are converting sap script to pdf then you really don't need to use 'SSF_FUNCTION_MODULE_NAME' .

It is used when you are dealing with smartform.

Please elaborate what exactly you want to do.

Thanks

Khushboo

0 Kudos

Hi,

I m trying to send a mail to external mail ids when a po is created. I m using the standard ZMEDRUCK2. I need to send this as an attachment.

Thanks in advance,

Ashok

0 Kudos

Hi all,

I m trying to convert a sapscript to pdf and then send it as an attachment in the mail. I m using the below fm

1. To get attributes of spool request - 'RSTS_GET_ATTRIBUTES'

2. To convert spool data to pdf - 'CONVERT_OTFSPOOLJOB_2_PDF'

3. To send email with attachment - 'SO_NEW_DOCUMENT_ATT_SEND_API1'.

I am able to view the preview. But i am getting an error spool request 0 does not exists.

Pls guide me in solving the issue..

Thanks in advance,

Ashok