02-27-2009 4:56 AM
Please help me find a solution to a problem that : -
I want to send letters / statements / reminders directly to customers / vendors of smartforms thru email using SAP.
Kindly tell me how do I write program in ABAP. Is there any function module for sending smartforms thru email.
Please help me
Thanks in advance
SK Daniel
02-27-2009 4:59 AM
Hi Shuvir
This can be easily done by Workflows...
If you any idea of Workflows,you can do it easily.
regards
Sachin
02-27-2009 4:59 AM
02-27-2009 5:03 AM
We can send smartforms thru mail.
Find the below code.
CONSTANTS: lc_getotf_ex TYPE tdgetotf VALUE 'X',
lc_no_dialog TYPE tdsfflag VALUE 'X',
lc_preview TYPE tdpreview VALUE 'X'.
Set Control Parameters and composer Parameters for requirement.
gwa_control_param-no_dialog = space.
gwa_control_param-preview = lc_preview.
gwa_composer_param-tdimmed = gc_ex.
If the File Save Path Is Specified Smart Form to Covert to PDF.
IF gv_fullpath IS NOT INITIAL.
gwa_control_param-getotf = lc_getotf_ex.
gwa_control_param-no_dialog = lc_no_dialog.
ENDIF.
call Smart Form Function Module
CALL FUNCTION gv_smart_form_fm
EXPORTING
control_parameters = gwa_control_param
mail_recipient = gt_recipient
mail_sender = gt_sender
output_options = gwa_composer_param
user_settings = space
gv_summary = gv_summary
gv_detail = gv_detail
gv_multi = gv_multi
IMPORTING
job_output_info = gwa_job_output_info
TABLES
gt_costsheet = gt_costsheet
gt_firstcost_sf = gt_firstcost_sf
gt_costload_sf = gt_costload_sf
gt_misc = gt_misc
gt_cost = gt_cost
gt_totals = gt_totals
gt_zxparam = gt_zfico
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> gc_subrc.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
If the File Save Path Is Specified
Function Module to Convert Smart Form Output to PDF Formate.
IF gv_fullpath IS NOT INITIAL.
LOOP AT gwa_job_output_info-otfdata INTO gwa_otf.
APPEND gwa_otf TO gt_otf.
ENDLOOP.
Function Module To Conver Smart Form To PDF Formate.
PERFORM call_convert_otf_2_pdf.
ENDIF.
CONSTANTS: lc_tilt1(2) TYPE c VALUE '~ ',
lc_tilt2(2) TYPE c VALUE ' ~'.
DATA: lv_filesize TYPE i,
lv_otf_cmd TYPE c VALUE 'X'.
Conversion From Smart Form to PDF Formate
CALL FUNCTION 'CONVERT_OTF_2_PDF'
EXPORTING
use_otf_mc_cmd = lv_otf_cmd
IMPORTING
bin_filesize = lv_filesize
TABLES
otf = gt_otf
doctab_archive = gt_doc
lines = gt_lines
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
OTHERS = 3.
IF sy-subrc <> gc_subrc.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF lv_filesize = 0.
EXIT.
ENDIF.
LOOP AT gt_lines INTO gwa_lines.
TRANSLATE gwa_lines USING lc_tilt2.
CONCATENATE gv_buffer gwa_lines INTO gv_buffer.
ENDLOOP.
TRANSLATE gv_buffer USING lc_tilt1.
DO.
SHIFT gv_buffer LEFT BY 255 PLACES.
IF gv_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
02-27-2009 5:23 AM
Can you give me a complete sample code for the same?
Thanks
SK Daniel
02-27-2009 5:28 AM
02-27-2009 5:28 AM
Check out this link,
Refer the blogs:
/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
http://www.sapdevelopment.co.uk/reporting/email/attach_xlsmod.htm
Regards,
Joan