on 10-16-2008 8:38 AM
Hello,
I have to Email the customer Account statement.
Stabdard program for this id RFKORD11.
I have copied this RFKOARD11 TO ZF_REPT_RFKORD11.
Where to add the logic for sending customer account statement via email in RFKORD11.
Please Help Me.
Regards,
Anuja Dhondge.
Write the send_email subroutine after FORM top_of_page_log in Z_RFKORI93 in rfkord11 program.
In that send_emai subroutine , write the code to get the email addres to whome we want to send the customer account statement.
and then write
IF sy-subrc EQ 0.
p_email1 = wa_smtp_addr-smtp_addr.
gd_spool_nr = spoolno.
PERFORM convert_spool_to_pdf USING gd_spool_nr.
PERFORM process_email USING p_email1.
PERFORM delete_spool USING gd_spool_nr.
FORM convert_spool_to_pdf USING gd_spool_nr .
SELECT SINGLE * FROM tsp01 WHERE rqident = gd_spool_nr .
IF sy-subrc <> 0.
PERFORM bd_textbox_err(rstxpdft) USING 80
'Spoolauftrag existiert nicht'(003).
EXIT.
ENDIF.
client = tsp01-rqclient.
name = tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4.
IF objtype(3) = 'OTF'.
is_otf = 'X'.
ELSE.
is_otf = space.
ENDIF.
IF is_otf = 'X'.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = ' '
DST_DEVICE = 'ZLOC'
DST_DEVICE = SAVE_TDDEST1 "manish
PDF_DESTINATION =
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
OTF_PAGECOUNT =
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11.
ELSE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = ' '
DST_DEVICE = 'ZLOC'
PDF_DESTINATION =
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
LIST_PAGECOUNT =
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = pdf
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11.
ENDIF.
Transfer the 132-long strings to 255-long strings
LOOP AT pdf.
TRANSLATE pdf USING ' ~'.
CONCATENATE gd_buffer pdf INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM. " CONVERT_SPOOL_TO_PDF
FORM process_email USING p_email.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
select single name1 name3
from kna1
into wa_compname
where kunnr = v_kunnr.
Default subject matter
gd_subject = 'Subject'.
*+001
CONCATENATE 'Customer Statement-' WA_COMPNAME-NAME1 WA_COMPNAME-NAME3 into gd_attachment_desc separated by space.
gd_attachment_desc = 'Customer Statement-'.
*+001
it_mess_bod = text-900.
APPEND it_mess_bod.
If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
TABLES it_mess_bod
it_mess_att
USING p_email
text-901
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
CHANGING gd_error
gd_reciever.
ENDFORM. " PROCESS_EMAIL
FORM delete_spool USING p_spool TYPE itcpp-tdspoolid.
DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
ld_spool_nr = p_spool.
CHECK p_delspl <> c_no.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = ld_spool_nr.
ENDFORM. "delete_spool
declartions
Spool to PDF conversions
DATA: gd_spool_nr LIKE prot_ausgabe-tdspoolid ,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string,
v_text1 type string,
v_text2 type string,
date1 type string,
date2 type string.
DATA: spoolno LIKE prot_ausgabe-tdspoolid .
and the call send_email subroutine in subroutine prot_print , in that there is on loop at prot_ausgabe. call send_email in that loop.
Have a look on follwing code:
LOOP AT prot_ausgabe.
ADD 1 TO LV_CTR.
PERFORM print_immediately.
PERFORM send_email USING LV_CTR.
ENDLOOP.
PERFORM send_email.
PERFORM output_alv.
ENDIF.
ENDFORM. "PROT_PRINT
Have a look on follwing code:
PERFORM prot_print1.
ELSE.
PERFORM prot_export.
ENDIF.
ENDIF.
PERFORM prot_print.
ENDFORM. "KONTOAUSZUEGE
call that prot_print in subroutine KONTOAUSZUEGE before endform.This form is not in Z_RFKORI93 but on first page of zrfkord11.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.