cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Sending a smartforms output to external mail id

former_member242166
Participant
0 Kudos

Hi experts,

I have a smartforms attached for standard tcode VF03. How do i send that smartforms output into external mail id.  In VF03 tcode when i give billing document number and see issue output type, after printing the forms , the smartforms will goto the customer mail id automatically. How can i do this?

Please Help me.

Regards,

Linganathan.K

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member242166
Participant
0 Kudos

Please any one help me for my requirements. I want send a smartforms(invoice) to customer mail id.

Please still i did not get output.

Thanks and Regards,

Linganathan.K

Former Member
0 Kudos

Hi ,

The code i gave above is the steps to be followed to achieve your scenario.

What is the status of your code? Where did you got stuck up ? update .

Thanks,

Pradeep.

Former Member
0 Kudos

Hi Linga,

When you generate a smartform you will need an external report to send an email.

All you have to do is,

1. Call your smartform in the report using the FM SSF_FUNCTION_MODULE_NAME.

2. When you execute the smartform the smartform will return you the OTF data.

3. If your mail format has to be in PDF then you will need a PDF conversion with the FM OTF_2_PDF.

4. Collect the PDF data content in an internal table.

5. Then finally call the FM SO_NEW_DOCUMENT_SEND_API1. (For Sending Email)

Follow these steps it will be quite simple.

Hope it helps.

Thanks,

Pradeep.

former_member242166
Participant
0 Kudos

Dear pradeep mohan,

Thanks for your reply,

If possible can you send sample code for this

Former Member
0 Kudos

Hi Ling,

Yes i can send the sample code but you just try as you can.

former_member242166
Participant
0 Kudos

Hi pradeep,  I am continue to try, 

You to send the code if possible.pls

Thanks,

Linganathan.K

Former Member
0 Kudos

Hi Linga,

Try This,



CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname           = c_formname
IMPORTING
fm_name            = fm_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.

*   Assigning values to Form Control Structure and Form Composer

      gs_ctrlop-getotf = 'X'.
gs_ctrlop-device = 'PRINTER'.
gs_ctrlop-preview = 'X'.
gs_ctrlop-no_dialog = ' '.
gs_outopt-tddest = 'LP01'.
gs_outopt-xsfformat = 'X'.
gs_outopt-tdimmed = 'X'.
gs_outopt-tddelete = ' ' .
gs_outopt-tdnewid   = 'X'.

CALL FUNCTION fm_name
EXPORTING
control_parameters = gs_ctrlop
output_options     = gs_outopt
user_settings      = ' '
IMPORTING
job_output_info    = gs_otfdata
TABLES
i_final            = lt_data
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.
ENDIF.

*  Assigning the OTFDATA to OTF Structure table

    CLEAR gt_otf.
gt_otf[] = gs_otfdata-otfdata[].

*   Convert the OTF DATA to SAP Script Text lines

    CLEAR gt_pdf_tab.

CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize           = gv_bin_filesize
TABLES
otf                    = gt_otf
doctab_archive         = it_docs
lines                  = gt_pdf_tab
EXCEPTIONS
err_conv_not_possible  = 1
err_otf_mc_noendmarker = 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.

*   Passing the SAP Script text lines to
*     SAPoffice: Single List with Column Length 255 table

    CLEAR : gs_objbin, gs_pdf_tab.

LOOP AT gt_pdf_tab INTO gs_pdf_tab.
gv_pos = 255 - gv_len.
IF gv_pos > 134. "length of pdf_table
gv_pos = 134.
ENDIF.
gs_objbin+gv_len = gs_pdf_tab(gv_pos).
gv_len = gv_len + gv_pos.

IF gv_len = 255. "length of out (contents_bin)
APPEND gs_objbin TO gt_objbin.
CLEAR: gs_objbin, gv_len.
IF gv_pos < 134.
gs_objbin = gs_pdf_tab+gv_pos.
gv_len = 134 - gv_pos.
ENDIF.
ENDIF.
ENDLOOP.
IF gv_len > 0.
APPEND gs_objbin TO gt_objbin.
ENDIF.

*   Filling the details in SAPoffice: Description of Imported Object Components table

    DESCRIBE TABLE gt_objbin LINES gv_tab_lines.

CLEAR gs_objbin.
READ TABLE gt_objbin INTO gs_objbin INDEX gv_tab_lines.

IF sy-subrc = 0.
gs_objpack-doc_size = ( gv_tab_lines - 1 ) * 255 + STRLEN( gs_objbin ).
gs_objpack-transf_bin = 'X'.
gs_objpack-head_start = 1.
gs_objpack-head_num = 0.
gs_objpack-body_start = 1.
gs_objpack-body_num = gv_tab_lines.
gs_objpack-doc_type = 'PDF'.
gs_objpack-obj_name = 'ATTACHMENT'.
gs_objpack-obj_descr = 'test'.
APPEND gs_objpack TO gt_objpack.
ENDIF.

*   Sending the Form Output in the PDF format to email

    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data              = gs_docdata
put_in_outbox              = ' '
commit_work                = 'X'
TABLES
packing_list               = gt_objpack
contents_bin               = gt_objbin
receivers                  = gt_reclist
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.

former_member242166
Participant
0 Kudos

dear pradeep,

Send the full code,  I cant get the output.. some error occurs

Regards,

Linga