Hi Experts,
When I add the below code to attach the pdf in workflow then It is not doing any attachment.
and it stops the triggring the mail also. Please suggest any simple and effective to attach the PDF within the workflow.
try.
DATA: ls_pdf_form TYPE fpcontent.
DATA: lv_data_source TYPE ptrv_web_source.
data LT_RETURN TYPE BAPIRETTAB.
* PDF form will be called/read from database
lv_data_source = 'DB'.
* New function module for printing Adobe-Forms (ERP 2005)
CALLFUNCTION'PTRM_WEB_FORM_PDF_GET'
EXPORTING
i_employeenumber = pernr
i_tripnumber = tripno
i_periodnumber = '000'
i_trip_component = 'R'
i_trip_data_source = lv_data_source
i_display_form = ' '
i_language = sy-langu
IMPORTING
e_pdf_form = ls_pdf_form
TABLES
et_return = lt_return.
READTABLE lt_return WITHKEYtype = 'E'
TRANSPORTINGNOFIELDS.
IF sy-subrc = 0.
* MESSAGE s162(ptra_web_interface).
* RETURN.
ENDIF.
* TRY.
* data : fp_outputparams type sfpoutputparams,
*
data gv_pdf_xstring1 type xstring.
gv_pdf_xstring1 = ls_pdf_form.
data gv_send_request typerefto cl_bcs.
data : i_att_type type soodk-objtp value'PDF'.
data w_document typerefto cl_document_bcs.
data gv_pdf_content type solix_tab.
*
*
CALLMETHOD cl_document_bcs=>create_document
EXPORTING
i_type = packing_list_type-doc_type
i_subject = lv_subj50
i_text = it_contents
RECEIVING
result = lo_document.
w_document = lo_document .
* gv_send_request->set_document( lo_document ).
* .
* if sy-subrc <> 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* endif.
* add document to send request
* CALL METHOD lo_send_request->set_document( lo_document ).
* lo_send_request->set_document( lo_document ).
lo_send_request = cl_bcs=>create_persistent( ).
gv_pdf_content = cl_document_bcs=>xstring_to_solix( gv_pdf_xstring1 ).
try.
*-- Add Attachment to the Document
callmethod w_document->add_attachment
exporting
i_attachment_type = i_att_type
i_attachment_subject = 'Travel Request form.pdf'
i_att_content_hex = gv_pdf_content.
catch cx_document_bcs.
endtry.
regards,
Saquib Khan