on 02-11-2008 8:14 AM
Hi all,
I have one issue regarding sending the Adobe form to email as an attachment. I am using the CL_BCS to send the email.
I am not to send it to different recipients (email ids retrieved from the database table). Please let me know if there is any other method to send the adobe form to email attachment.
Its very urgent. Please respond as soon as possible.
Thanks,
Geeta
Hi,
Please send a sample code that how we can send Adobe form as attachment in email to different receipents.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
This sample code send an ADOBE Forms to 20 user define in the sap system
Hope this help you
Regards.
&----
*& Report ZENVOI_PDF_MAIL
*&
&----
*&
*&
&----
REPORT zenvoi_pdf_mail MESSAGE-ID ad.
TYPE-POOLS : abap .
DATA : data_for_update TYPE zdemopdf ,
hexa TYPE solix_tab.
DATA : fm_name TYPE funcname ,
param TYPE sfpoutputparams,
doc_param TYPE sfpdocparams ,
output TYPE fpformoutput .
param-nodialog = abap_true. " suppress printer dialog popup
param-getpdf = abap_true.
doc_param-langu = sy-langu.
doc_param-country = 'FR'.
doc_param-fillable = abap_true.
doc_param-dynamic = abap_true.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = 'ZDEMO_PDF'
IMPORTING
e_funcname = fm_name.
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = param
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4.
CHECK sy-subrc EQ 0.
CALL FUNCTION fm_name
EXPORTING
/1bcdwb/docparams = doc_param
data_for_update = data_for_update
IMPORTING
/1bcdwb/formoutput = output
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3.
CALL FUNCTION 'FP_JOB_CLOSE'
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = output-pdf "PDF file from function module
TABLES
binary_tab = hexa.
Envoi du mail
**----
**
CLASS-DEFINITIONS
**
**----
**
DATA: send_request TYPE REF TO cl_bcs.
DATA: document TYPE REF TO cl_document_bcs.
*DATA: sender TYPE REF TO cl_sapuser_bcs.
data: sender TYPE REF TO if_sender_bcs.
DATA: recipient TYPE REF TO if_recipient_bcs.
*
**----
**
INTERNAL TABLES
**
**----
**
DATA: l_mailtext TYPE soli_tab.
DATA: iaddsmtp TYPE TABLE OF bapiadsmtp.
DATA: ireturn TYPE TABLE OF bapiret2.
*
**----
**
VARIABLES
**
**----
**
DATA: mail_line LIKE LINE OF l_mailtext.
DATA: bapiadsmtp TYPE bapiadsmtp.
DATA: subject TYPE so_obj_des.
DATA : att_subject TYPE so_obj_des.
*
DATA : w_except TYPE REF TO cx_root .
FIELD-SYMBOLS : <smtp> TYPE bapiadsmtp.
*Set subject of the mail
subject = 'Sample Interactive Form By Mail'.
Set text of the mail
mail_line = 'Find enclosed a Sample Interactive Form'..
APPEND mail_line TO l_mailtext .
att_subject = 'PDF Sample'.
TRY.
Create persistent send request
send_request = cl_bcs=>create_persistent( ).
Get sender object
sender = cl_sapuser_bcs=>create( sy-uname ).
Add sender
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
Read the E-Mail address for the user
tables usr01 .
select * from usr01
up to 20 rows .
free ireturn.
free iaddsmtp.
CALL FUNCTION 'BAPI_USER_GET_DETAIL'
EXPORTING
username = sy-uname
TABLES
return = ireturn
addsmtp = iaddsmtp.
LOOP AT it_addsmtp ASSIGNING <smtp> WHERE std_no = 'X'.
recipient =
cl_cam_address_bcs=>create_internet_address( <smtp>-e_mail ).
EXIT.
ENDLOOP.
IF recipient IS INITIAL.
recipient = cl_sapuser_bcs=>create( <recipient>-uname ).
ENDIF.
Add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = SPACE
i_copy = space
i_blind_copy = space
i_no_forward = space.
endselect.
Set that you don't need a Return Status E-mail
CALL METHOD send_request->set_status_attributes
EXPORTING
i_requested_status = 'E'
i_status_mail = 'E'.
set send immediately flag
send_request->set_send_immediately( 'X' ).
*Build Document
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = l_mailtext
i_subject = subject ).
add attachment to document
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = 'PDF'
i_attachment_subject = att_subject
i_att_content_hex = hexa.
Add document to send request
CALL METHOD send_request->set_document( document ).
Send document
CALL METHOD send_request->send( ).
COMMIT WORK.
CATCH cx_send_req_bcs INTO w_except.
CATCH cx_address_bcs INTO w_except.
CATCH cx_document_bcs INTO w_except.
ENDTRY.
{code]
I got the solution. I am able to send mail to different receipients.
Thanks,
Geeta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I don't really understand your problem . You want to send Adobe forms by mail to recipients. recipients are SAP user , that's rigth ?
I don't find any problme to this . I'll do it several times and that works fine ( with one or several recipient )
Best regards.
Bertrand
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Are you sending it from the friver program.
Please give the full details.
Regards
sasi
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 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.