cancel
Showing results for 
Search instead for 
Did you mean: 

Save the rendered PDF

Former Member
0 Kudos

Hi all,

I have gone thru most of the related threads in the forum on the above but could not crack the problem.

My problem is :

I have made an application which renders a PDF form with the required data. Now, the user wants this form to be downloaded in the local machine. I'm able to get the XString only after rendering of the form. also, I'm not able to download anyfile to the local, the FileDownload UI just displays the file instead of downloading the file as per path.

I've been strugling with this over the weekend to no effect.

Any help in this regard will be highly appreciated.

Regds,

Aryan

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Aryan

I have a program that extracts the PDF code from a Adobe print form and downloads it to the local machine using the subsequent code:

*&----


*

*& Form download_pdf

*&----


*

  • PDF-Datei erstellen

*----


*

FORM download_pdf USING value(pv_matgrp)

value(pv_filename)

CHANGING pt_return TYPE bapiret2_t.

DATA: lit_pdf_bin LIKE TABLE OF sdokcntbin.

DATA: lv_binlen TYPE i.

DATA: lv_filename TYPE string.

  • Init

IF pv_filename IS INITIAL.

CONCATENATE gc_filename pv_matgrp '.pdf' INTO lv_filename.

ELSE.

MOVE pv_filename TO lv_filename.

ENDIF.

CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

EXPORTING

buffer = gs_formoutput-pdf

IMPORTING

output_length = lv_binlen

TABLES

binary_tab = lit_pdf_bin.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = lv_binlen

filename = lv_filename

filetype = 'BIN'

TABLES

data_tab = lit_pdf_bin

EXCEPTIONS

OTHERS = 1.

IF NOT sy-subrc IS INITIAL.

PERFORM get_sy_message

CHANGING pt_return[].

ENDIF.

ENDFORM. " download_pdf

Hope it helps.

Regards

René