cancel
Showing results for 
Search instead for 
Did you mean: 

Smart form to download in PDF

Former Member
0 Kudos

Hello All,

I have created an smart forms for Shipping Instruction . As per Requirement the smart forms should be downloaded in PDF and Auto mail to Consignee.

Can some one Please provide me details with example how can this will possible.

Thanks in advance.

Swati Namdeo.

Accepted Solutions (1)

Accepted Solutions (1)

jaideeps
Advisor
Advisor
0 Kudos

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Swati,

does your form print with a message ( i hope so ), in this case you have only to configure the medium to 7 and configure the connection between SAP and a SMTP server in transaction SCOT .

also in this transaction you can define the output format of your forms for e-mail .

Let me know if you need more explanation.

best regards.

Former Member
0 Kudos

Hi

In the Smartform Functiona Module we get the Spool ID of the Smartform for the output

use that spool ID and convert to PDF format and send mail using the fun modules

CONVERT_ABAPSPOOLJOB_2_PDF

SO_NEW_DOCUMENT_ATT_SEND_API1

you have to write related code for these fun modules in the Smartform driver program itself

and ask your basis persons to configure the SCOT and SOST tcodes to send mails to Outside Consignee Maid Id's

<b>Reward points for useful Answers</b>

Regards

Anji

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

For downloading,check this code.For mailing, check this link.I am explaining the mail concept here.

https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-001...

DATA: form_name TYPE rs38l_fnam.

DATA: wa_ctrlop TYPE ssfctrlop,

wa_outopt TYPE ssfcompop.

DATA: t_otfdata TYPE ssfcrescl,

t_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.

DATA: t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE.

DATA: w_filesize TYPE i.

DATA: w_bin_filesize TYPE i.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZSMARTFORM_SWAR'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

fm_name = form_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3

.

IF sy-subrc <> 0.

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

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

ENDIF.

wa_ctrlop-getotf = 'X'.

wa_ctrlop-no_dialog = 'X'.

wa_outopt-tdnoprev = 'X'.

CALL FUNCTION form_name

EXPORTING

control_parameters = wa_ctrlop

output_options = wa_outopt

user_settings = 'X'

mydate = p_date

reason = p_rea

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

job_output_info = t_otfdata

  • JOB_OUTPUT_OPTIONS =

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 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.

t_otf[] = t_otfdata-otfdata[].

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

  • ARCHIVE_INDEX = ' '

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

OTHERS = 4

.

IF sy-subrc <> 0.

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

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

ENDIF.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

bin_filesize = w_bin_filesize

filename = 'd: est.PDF'

filetype = 'BIN'

IMPORTING

filelength = w_filesize

TABLES

data_tab = t_pdf_tab

  • FIELDNAMES =

EXCEPTIONS

file_open_error = 1

file_write_error = 2

invalid_filesize = 3

invalid_type = 4

no_batch = 5

unknown_error = 6

invalid_table_width = 7

gui_refuse_filetransfer = 8

customer_error = 9

OTHERS = 10

.

IF sy-subrc <> 0.

MESSAGE i003(z00) WITH 'File not downloaded succesfully'.

ELSE.

MESSAGE i003(z00) WITH 'File Test.pdf downloaded succesfully '

'under D drive'.

ENDIF.