2007 Nov 28 12:36 PM
I converted the spool to pdf mailed the pdf form. i got the mail and when i tried to open the pdf form it is showing a popup ''the file is damaged and could not be repaired".
I converted the spool to pdf mailed the pdf form. i got the mail and when i tried to open the pdf form it is showing a popup ''the file is damaged and could not be repaired".
2007 Nov 28 12:41 PM
That was a script printpreview spool .Can anybody help me out
2007 Nov 28 12:42 PM
How do you convert the PDF?
I believe that the error is in the conversion. Perhaps you have to check if the report is converted to pdf correctly, and in other case, check if the error are being at the e-mail sent.
2007 Nov 28 12:44 PM
i converted the spool to pdf using CONVERT_ABAPSPOOLJOB_2_PDF and mailed using 'SO_DOCUMENT_SEND_API1'
2007 Nov 28 12:49 PM
2007 Nov 28 1:22 PM
Hi,
Use the FM 'CONVERT_OTFSPOOLJOB_2_PDF' to get the PDF data from Spoll by passing the spol number if its a script or smartform related output.Or if its a list by ABAP program then use 'CONVERT_ABAPSPOOLJOB_2_PDF'. It will work.
Regs
Manas
2007 Nov 28 1:34 PM
2007 Nov 28 2:04 PM
Use CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
Hope this helps,
Erwan
2007 Nov 28 2:10 PM
Hi
i did the same thing in ABAP web dynpro. below is the code.
data LX_pdf type xstring.
CALL FUNCTION 'ZBAPIGETPDF_CONVERSION_DATA'
IMPORTING
EX_PDF = LX_pdf
.
cl_wd_runtime_services=>attach_file_to_response(
i_filename = 'Hello.PDF'
i_content = lx_pdf
i_mime_type = 'application/pdf'
i_in_new_window = 'X'
i_inplace = 'X' ).
<b>Code for FM zbapigetpdf_conversion_data</b>
FUNCTION zbapigetpdf_conversion_data.
*"----
""Local Interface:
*" EXPORTING
*" VALUE(EX_PDF) TYPE XSTRING
*"----
DATA: pdfdata TYPE STANDARD TABLE OF tline INITIAL SIZE 0,
tline TYPE tline.
CALL FUNCTION 'ZBAPIGETPDF_OUTPUT_TABLE_DATA'
EXPORTING
spoolno = '28216'
IMPORTING
RETURN =
TABLES
pdfdata = pdfdata
.
field-symbols <X>.
data: st(268) type c.
data l1 type i.
data len type i.
data maxline type i value 134.
l1 = 0.
loop AT pdfdata INTO tline.
clear st.
st+l1(maxline) = tline.
len = maxline + l1.
l1 = maxline - strlen( tline ).
ASSIGN st TO <x> TYPE 'X'.
CONCATENATE ex_pdf <x>(len) INTO ex_pdf IN byte MODE .
endloop.
ENDFUNCTION.
<b>Code for zbapigetpdf_output_table_data</b>
FUNCTION zbapigetpdf_output_table_data.
*"----
""Local Interface:
*" IMPORTING
*" VALUE(SPOOLNO) TYPE ZSMARTFORMINPUT2-SPOOL_ID OPTIONAL
*" EXPORTING
*" VALUE(RETURN) TYPE BAPIRETURN
*" TABLES
*" PDFDATA STRUCTURE TLINE OPTIONAL
*"----
DATA: v_spoolid TYPE tsp01-rqident.
vspool(10) VALUE '4904'.
DATA otf LIKE itcoo OCCURS 100 WITH HEADER LINE.
DATA cancel.
DATA pdf LIKE tline OCCURS 100 WITH HEADER LINE.
DATA doctab LIKE docs OCCURS 1 WITH HEADER LINE.
DATA: numbytes TYPE i,
arc_idx LIKE toa_dara,
pdfspoolid LIKE tsp01-rqident,
jobname LIKE tbtcjob-jobname,
jobcount LIKE tbtcjob-jobcount.
spoolno = '28216'.
v_spoolid = spoolno.
*SPOOLNO = 4904.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = v_spoolid
NO_DIALOG = 'X'
DST_DEVICE =
pdf_destination = 'C:\File.pdf'
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
OTF_PAGECOUNT =
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = pdfdata[]
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.
*refresh pdfdata[].
*pdfdata-tdformat = 'hello pawan'.
*append pdfdata.
ENDFUNCTION.
Its working for me.
Regs
Manas.
Pls reward points.
2007 Nov 28 1:29 PM
Hi..
Try by using this program. RSTXPDFT4
Give ur Spool Request number as input..
Hope it will helps..
Regards
Bala..
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |