on 08-01-2009 10:57 AM
Dear Experts,
How to send pdf file as email atachment, can some one give me some codings or links.
Thanks and REgards,
Thirukumaran. R
Hi Thirukumaran, <li>Check the below link. It explains clearly. <strong>[Mail with PDF Attachment|http://an-abaper.blogspot.com/2008/03/mail-with-pdf-attachment.html]</strong> Thanks Venkat.O
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this link not open :
http://an-abaper.blogspot.com/2008/03/mail-with-pdf-attachment.html
When i open the file in email it is gving the follg. error,
Adobe reader could not open 'Offer letter_200023234.824.pdf'
because it is either not a supported file type or because the
file has been damaged(for example, it was an email attachment and
wasn't correctly decoded).
even after the adobe upgradation(8.0), i am facing the same problem...
can anyone help in this regard?..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Mailing is possible when i open the pdf file it's giving the decoding error
i here with attached the codings for ur ref.
FUNCTION Z_HRFM_SEND_OFFERLETTER_MAIL.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(IV_APPLID) TYPE PERSNO
*" VALUE(IV_REPMGR) TYPE PERSNO
*" VALUE(IV_CONTROLMGR) TYPE PERSNO
*" VALUE(IV_REPFMGR) TYPE PERSNO
*" VALUE(IV_ACTION) TYPE MASSN
*" VALUE(JOIN_1000) TYPE DATS
*" VALUE(POSITION_1000) TYPE STEXT
*" VALUE(PLACE_1000) TYPE ORT01
*" VALUE(LOC_1000) TYPE ORT01
*" VALUE(GROSS_1000) TYPE NUMC7
*" VALUE(BASIC_1000) TYPE NUMC5
*" VALUE(CONV_1000) TYPE NUMC5
*" VALUE(FOOD_1000) TYPE NUMC5
*" VALUE(VAR_1000) TYPE NUMC5
*" VALUE(PERNR1_1000) TYPE PERSNO
*" VALUE(COMP_ADD) TYPE CHAR200
*" EXCEPTIONS
*" APPLICANT_NOT_FOUND
*" REPFORM_MGR_NOT_FOUND
*" REPMGR_NOT_FOUND
*" CONTROLMGR_NOT_FOUND
*" NO_EMAILID_FOUND
*" SENT
*" NOT_SENT
*"----------------------------------------------------------------------
*&----------------------------------------------------------------------------------------------*
*& *
*& CREATION INFORMATION *
*&----------------------------------------------------------------------------------------------*
*& AUTHOR : thiruKumaran
*& CREATION DATE : 29.07.2009 *
*& TRANSPORT REQUEST: *
*& FUNCTIONAL SPEC# : *
*& TECHNICAL SPEC# : *
*& PURPOSE :
*&
*&----------------------------------------------------------------------------------------------*
*------------------------------------------------------------------------
* Local Variable Declaration
*------------------------------------------------------------------------
data : EV_APPLNAME TYPE EMNAM,
EV_REPMGR_NAME TYPE EMNAM,
EV_CONTROLMGR_NAME TYPE EMNAM,
EV_CONTROLMGR_GEN TYPE CHAR2,
EV_REPMGR_GEN TYPE CHAR2,
EV_APPL_GEN TYPE CHAR2,
EV_REPFORM_GEN TYPE CHAR2,
EV_REPFORM_NAME TYPE EMNAM,
EV_STRAS TYPE STRAS,
EV_ORT01 TYPE ORT01,
EV_ORT02 TYPE ORT02.
DATA : l_APPname TYPE emnam,
l_evaluation_date TYPE begda,
l_extension_date TYPE begda,
l_emailid TYPE comm_id_long,
tab_lines TYPE sy-tabix,
fm_name TYPE rs38l_fnam.
data:/1BCDWB/FORMOUTPUT type FPFORMOUTPUT ,
/1BCDWB/DOCPARAMS type SFPDOCPARAMS ,
ie_outputparams type SFPOUTPUTPARAMS .
DATA : CONTENTS_HEX TYPE SOLIX.
*--------------------------------------------------------------------------
* Structure Declaration
*--------------------------------------------------------------------------
DATA : s_job_info TYPE ssfcrescl,
s_control_param TYPE ssfctrlop,
s_composer_param TYPE ssfcompop,
s_doc_data TYPE sodocchgi1.
*------------------------------------------------------------------------
* Internal Table Declaration
*------------------------------------------------------------------------
DATA : i_otfdata TYPE TABLE OF itcoo,
i_pdf TYPE TABLE OF solisti1,
i_pdfdata TYPE TABLE OF tline,
i_receivers TYPE TABLE OF somlreci1,
i_packing_list TYPE TABLE OF sopcklsti1,
i_message TYPE TABLE OF solisti1.
*&----------------------------------------------------------------------*
*& Work area declaration.
*&----------------------------------------------------------------------*
DATA : w_receivers LIKE LINE OF i_receivers,
w_packing_list LIKE LINE OF i_packing_list,
w_message LIKE LINE OF i_message.
CALL FUNCTION 'Z_HRFM_GET_OFFERED_DATA'
EXPORTING
IV_APPLID = IV_APPLID
IV_REPMGR = IV_REPMGR
IV_CONTROLMGR = IV_CONTROLMGR
IV_REPFMGR = IV_REPFMGR
IV_ACTION = IV_ACTION
IMPORTING
EV_APPLNAME = EV_APPLNAME
EV_REPMGR_NAME = EV_REPMGR_NAME
EV_CONTROLMGR_NAME = EV_CONTROLMGR_NAME
EV_CONTROLMGR_GEN = EV_CONTROLMGR_GEN
EV_REPMGR_GEN = EV_REPMGR_GEN
EV_APPL_GEN = EV_APPL_GEN
EV_REPFORM_GEN = EV_REPFORM_GEN
EV_REPFORM_NAME = EV_REPFORM_NAME
EV_STRAS = EV_STRAS
EV_ORT01 = EV_ORT01
EV_ORT02 = EV_ORT02
EXCEPTIONS
APPLICANT_NOT_FOUND = 1
REPFORM_MGR_NOT_FOUND = 2
REPMGR_NOT_FOUND = 3
CONTROLMGR_NOT_FOUND = 4
OTHERS = 5.
IF sy-subrc = 1.
RAISE applicant_not_found.
ELSEIF sy-subrc = 2.
RAISE repform_mgr_not_found.
ELSEIF sy-subrc = 3.
raise REPMGR_NOT_FOUND.
ELSEIF sy-subrc = 4.
raise CONTROLMGR_NOT_FOUND .
ENDIF.
*******************************************
*finding email id of applicant
*******************************************
SELECT SINGLE usrid_long INTO l_emailid FROM pb0105
WHERE pernr = IV_APPLID AND subty = '0010' AND endda = '99991231'."#EC *
IF sy-subrc <> 0.
RAISE no_emailid_found.
ENDIF.
* s_control_param-no_dialog = 'X'.
* s_control_param-getotf = 'X'.
* s_composer_param-tddest = 'LP01'.
* s_composer_param-tdnoprev = 'X'.
*---------------------------------------------------------------------------------
* Sending PDF by mail
*---------------------------------------------------------------------------------
CALL FUNCTION '/1BCDWB/SM00000046' "'ZHR_OFFER_FORM'
*"'/1BCDWB/SM00000046'
EXPORTING
/1BCDWB/DOCPARAMS = /1BCDWB/DOCPARAMS
APPLICANT_NAME = EV_APPLNAME
POSITION = POSITION_1000
JOINING_DATE = join_1000
REPFORM = EV_REPFORM_NAME
REPMGR = EV_REPMGR_NAME
CONTROLMGR = EV_CONTROLMGR_NAME
PLACE = PLACE_1000
APPLICANT_GENDER = EV_APPL_GEN
BASE_PLACE = loc_1000
REPMGR_GENDER = EV_REPMGR_GEN
REPFORM_GENDER = EV_REPFORM_GEN
CONTROLMGR_GENDER = EV_CONTROLMGR_GEN
GROSSS = gross_1000
BASIC = basic_1000
CONVEYANCE = conv_1000
FOOD = food_1000
VARIABLE = var_1000
CITY = ev_ORT01
DISTRICT = ev_ORT02
ADDRESS = ev_stras
C_DATE = sy-datum
APPLICANTID = pernr1_1000
comp_address = comp_add
IMPORTING
/1BCDWB/FORMOUTPUT = /1BCDWB/FORMOUTPUT
EXCEPTIONS
USAGE_ERROR = 1
SYSTEM_ERROR = 2
INTERNAL_ERROR = 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.
*data : binary_tab.
call function 'SCMS_XSTRING_TO_BINARY'
exporting
buffer = /1BCDWB/FORMOUTPUT-PDF
tables
binary_tab = I_PDFDATA.
REFRESH i_pdf[].
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
line_width_dst = '255'
TABLES
content_in = i_pdfdata
content_out = i_pdf.
DESCRIBE TABLE i_pdf LINES tab_lines.
****for mailing********
w_receivers-receiver = l_emailid.
w_receivers-rec_type = 'U'.
w_receivers-com_type = 'INT'.
APPEND w_receivers TO i_receivers .
s_doc_data-obj_name = text-001.
s_doc_data-obj_descr = text-001.
CLEAR w_packing_list-transf_bin.
w_packing_list-head_start = 1.
w_packing_list-head_num = 0.
w_packing_list-body_start = 1.
w_packing_list-doc_type = 'RAW'.
w_packing_list-body_num = tab_lines.
APPEND w_packing_list TO i_packing_list.
CLEAR w_packing_list.
w_packing_list-transf_bin = 'X'.
w_packing_list-head_start = 1.
w_packing_list-head_num = 1.
w_packing_list-body_start = 1.
w_packing_list-doc_type = 'PDF'.
w_packing_list-body_num = tab_lines.
w_packing_list-doc_size = tab_lines * 255.
w_packing_list-obj_descr = text-001.
w_packing_list-obj_name = text-001.
APPEND w_packing_list TO i_packing_list.
*&---------------------------------------------------------------
*& Writing mail message
*---------------------------------------------------------------
concatenate 'Hi' EV_APPLNAME into l_APPname separated by space.
w_message = L_APPNAME.
APPEND w_message TO i_message.
w_message = text-009.
APPEND w_message TO i_message.
w_message = text-002.
APPEND w_message TO i_message.
w_message = text-990.
APPEND w_message TO i_message.
w_message = text-003.
APPEND w_message TO i_message.
w_message = text-990.
APPEND w_message TO i_message.
w_message = text-004.
APPEND w_message TO i_message.
w_message = text-005.
APPEND w_message TO i_message.
"Call the FM to post the message to SAPMAIL
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = s_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = i_packing_list
contents_txt = i_message
* contents_bin = i_pdf
CONTENTS_HEX = I_PDF
receivers = i_receivers
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.
if sy-subrc = 0.
raise sent.
else.
raise not_sent.
endif.
*&--------------------------------------------------------------------
* To send mail immediatly
*&--------------------------------------------------------------------
IF sy-subrc = 0.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
AND RETURN.
ENDIF.
ENDFUNCTION.
can u give some suggestions,
Thanks and REgards,
Thirukumaran. R
HI,
Please see the example program BCS_EXAMPLE_6.
Use the class CL_BCS.
Regards,
Ankur Parab
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' and in the 'packing_list' define the type of format as 'PDF'
That error might be due to Adobe problem. So uninstall your current version and reinstall it. Which Acrobat versio are you using? It seems Acrobat 5 or 6 are more prone to this type of error so upgrade to Acrobat 7, hope it solves the problem.
Hi,
I have created a smartform which is conerting the output as PDF and sending viai email. In print preview chinese characters are displaying properly and no data corrupted. But when we see in PDF file the chinese characters are getting corrupted and other data is fine.
Please let me know if any idea on this issues.
Waiting for your valuable response.
Regards,
j.p.
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.