on 06-29-2012 11:17 AM
Hi All,
I am developing a SAP ABAP Webdynpro component for Invite to interview for selected candidates, schedule details and we need to send invitation to selected candidates with a PDF attachement if they have email is there any process to turn the current smart form into PDF and email them to the candidates. Also for those who doesnt have email , we need to print the the pdf file to a printer as a background job for all candidates, not on a manual one by one process , is this functionality possbile in abap webdynpro ?
Many Thanks,
Vind.
Hi vind ,
Yes its possible in WDA ,
you can download your smart from to PDF using below code snippet and the use the FM -'SO_NEW_DOCUMENT_ATT_SEND_API1' to send the PDF via email .
method ONACTIONSHOW_PDF.
DATA: smartform_fm TYPE rs38l_fnam,
bin_pdf TYPE TABLE OF docs,
bin_tline TYPE TABLE OF tline,
bin_filesize TYPE i,
bin_pdfx TYPE xstring,
v_device_type TYPE rspoptype,
v_output_options TYPE ssfcompop,
v_control_parameters TYPE ssfctrlop.
**CONVERT SMARTFORM TO BINARY XSTRING PDF
CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
i_language = 'I'
i_application = 'SAPDEFAULT'
IMPORTING
e_devtype = v_device_type
EXCEPTIONS
no_language = 1
language_not_installed = 2
no_devtype_found = 3
system_error = 4
OTHERS = 5.
v_output_options-tdprinter = v_device_type.
v_control_parameters-no_dialog = 'X'.
v_control_parameters-getotf = 'X'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZSMARTFORM'
IMPORTING
fm_name = smartform_fm
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
CALL FUNCTION smartform_fm
EXPORTING
control_parameters = v_control_parameters
output_options = v_output_options
id_document = doc_id
IMPORTING
job_output_info = v_output_stampa
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
***CONVERT OTF TO PDF
CLEAR: bin_pdf,bin_tline,bin_filesize,bin_pdfx.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = bin_filesize
bin_file = bin_pdfx
TABLES
otf = v_output_stampa-otfdata
lines = bin_tline.
**ATTACH PDF TO RESPONSE
CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE(
i_filename = 'PDFSMARTFORM.PDF'
i_content = bin_pdfx
i_mime_type = 'application/pdf' ).
endmethod.
Regards
Chinnaiya Pandian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chinnaiya,
Thanks for the quick response, in the above process can we set the print job to run as background job ?
also the call function smartform_fm what need to be passed for export parameter ' doc_id ' ? . For attach PDF to response 'application/pdf' is it refer to the actual webdynpro application name ?
Many Thanks,
Vind
Hi vind ,
Thanks for the quick response, in the above process can we set the print job to run as background job ?
yes you can .
the call function smartform_fm what need to be passed for export parameter ' doc_id ' ? .
doc_id is field i am passing to my Smartform , you can just ignore that .
attach PDF to response 'application/pdf' is it refer to the actual webdynpro application name ?
No . that is value you are passing for the mime type give as it is .'application/pdf'
in below link you
http://help.sap.com/saphelp_nw73/helpdata/en/46/bb1832ab4811d4968100a0c94260a5/content.htm
Hi Chinnaiya,
"Also for those who doesnt have email , we need to print the the pdf file to a printer as a background job for all candidates, not on a manual one by one process , is this functionality possbile in abap webdynpro ?"
Imho:
You don't need to realize that in WDA.
Just write a report with periodically runs as a job within SAP.
You need a DB-Table of "to be invited candidates without email". This table also has a flag "invitation printed/invited".
This report prints for each candidate within this table with flag = false an invitation.
If invitation has been succecfully printed set this flag to true.
You also can use this table to display already "invited candidates" in WDA.
BR,
ismail
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.