cancel
Showing results for 
Search instead for 
Did you mean: 

FileDownload PDF

Former Member
0 Kudos

Hi All!

We have an issue with the filedownload UI control.

we get data from R3 in a RFC modul, which makes use of the CONVERT_ABAPSPOOLJOB_2_PDF

We get the data in a TLINE.

We have tried to bind the TLINE directly to the FileDownload data, and then setting the mime to application/pdf.

This however does not work.

Can anyone please help?

Best regards,

Ronni Hostrup

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Thanks for helping!

The problem was on the RFC side, which was missing some details regarding how ot parse the PDF data to the right format.

But thanks all anyway

Former Member
0 Kudos

Hello Ronni,

Does this help:

DATA:

lh_spoolno TYPE rspoid VALUE '26501', => just an example of a spoolid

lh_pdf_bytecount TYPE i,

lh_pdf_xstring TYPE xstring.

FIELD-SYMBOLS:

<lh_hex> TYPE x.

DATA:

lwa_pdf TYPE tline.

DATA:

li_pdf TYPE tlinetab.

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

EXPORTING

src_spoolid = lh_spoolno

no_dialog = 'X'

pdf_destination = 'T'

IMPORTING

pdf_bytecount = lh_pdf_bytecount

TABLES

pdf = li_pdf

EXCEPTIONS

err_no_abap_spooljob = 1

err_no_spooljob = 2

err_no_permission = 3

err_conv_not_possible = 4

err_bad_destdevice = 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

OTHERS = 12.

IF sy-subrc = 0.

LOOP AT li_pdf INTO lwa_pdf.

ASSIGN lwa_pdf TO <lh_hex> CASTING.

CONCATENATE lh_pdf_xstring <lh_hex>

INTO lh_pdf_xstring IN BYTE MODE.

ENDLOOP.

cl_wd_runtime_services=>attach_file_to_response(

i_filename = 'spool.pdf'

i_content = lh_pdf_xstring

i_mime_type = 'application/pdf'

i_in_new_window = 'X'

i_inplace = 'X' ).

ENDIF.

Kind regards,

Minda Bouland

Edited by: Minda Bouland on Feb 29, 2008 1:18 PM

Edited by: Minda Bouland on Feb 29, 2008 1:19 PM