Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

spool pdf email

Former Member
0 Likes
1,119

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".

9 REPLIES 9
Read only

Former Member
0 Likes
1,093

That was a script printpreview spool .Can anybody help me out

Read only

0 Likes
1,093

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.

Read only

0 Likes
1,093

i converted the spool to pdf using CONVERT_ABAPSPOOLJOB_2_PDF and mailed using 'SO_DOCUMENT_SEND_API1'

Read only

Former Member
0 Likes
1,093

Any clues

Read only

0 Likes
1,093

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

Read only

0 Likes
1,093

Hi manas,

How to decode the OTF spool

Read only

0 Likes
1,093

Use CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'

Hope this helps,

Erwan

Read only

0 Likes
1,093

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.

Read only

Former Member
0 Likes
1,093

Hi..

Try by using this program. RSTXPDFT4

Give ur Spool Request number as input..

Hope it will helps..

Regards

Bala..