cancel
Showing results for 
Search instead for 
Did you mean: 

Send SAP script through mail

Former Member
0 Kudos

Hi Experts,

I want to send a script through mail.

I know I need to convert it into PDF format first and then send it using SO_NEW_DOCUMENT_ATT_SEND_API1 FM.

I am using the FM CONVERT_OTF to convert it into PDF but the data is not coming into the internal table.

Please guide me in this regard and also tell me the exact position where I should use the above FM's.

Thanks,

Manish

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try pass 'GETOTF' equal to 'X' in control paramters of smartform FM.

eg:

DATA ls_control_parameters TYPE ssfctrlop.

ls_control_parameters-getotf = 'X'.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'Z07ME_BANF_LIEFERANT_N'

IMPORTING

fm_name = gf_form_fm

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

CALL FUNCTION gf_form_fm -


> Smartform FM name.

EXPORTING

*0003.sn

ARCHIVE_INDEX = toa_dara

ARCHIVE_PARAMETERS = arc_params

*0003.en

control_parameters = ls_control_parameters

output_options = ls_output_options

user_settings = space

IMPORTING

job_output_info = ls_output_data

TABLES

data = lt_data

text = gt_text

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

Now, call CONVERT_OTF FM to convert into PDF...

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

IMPORTING

bin_filesize = l_pdf_len

bin_file = l_pdf_xstring

TABLES

otf = ls_output_data-otfdata

lines = lt_lines

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

err_bad_otf = 4

OTHERS = 5.

Hope it helps!!

Regards,

Pavan

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Before using the Convert_otf function module you have to get the otf data by the export/table parameter of the CLOSE_FORM Function module.

Regards,

Jagadeesh.

Former Member
0 Kudos

Hi Jagdeesh,

I have got the data from CLOSE_FORM and converted it as well using CONVERT_OTF

Now how to use the FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send the mail to SBWP?

Thanks,

Manish

Former Member
0 Kudos

Hi

Go through the link given below:

With Regards

Nikunj Shah

Former Member
0 Kudos

Use below code:

*Convert to OTF Format

t_otf[] = t_otfdata-otfdata[].

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

IMPORTING

bin_filesize = w_bin_filesize

TABLES

otf = t_otf

lines = t_pdf_tab

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

err_bad_otf = 4

OTHERS = 5.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.