cancel
Showing results for 
Search instead for 
Did you mean: 

Display on WDA a SapScript in PDF format

Former Member
0 Kudos

Hi all!!

I have to convert a SapScript to PDF, and then, display it on a Web Dynpro ABAP.

Somebody could guide me on this process?

Helpful answers will be rewarded.

Thanks and regards,

Manuel.

Accepted Solutions (0)

Answers (1)

Answers (1)

Yashpal
Active Contributor
0 Kudos
anand_nidamanuru
Active Participant
0 Kudos

Hi,

Once you got the Script output in OTF, use the FM 'CONVERT_OTF' by exporting the format as 'PDF' and importing the PDF data in XSTRING.

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

IMPORTING

bin_filesize = lv_bin_file_size

bin_file = ev_pdf_xstr

TABLES

otf = it_otf

lines = et_otf_pdf

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

err_bad_otf = 4

OTHERS = 5.

Once you have the PDF data as XSTRING, we need to get the mimetype of PDF, so that the PDF can be downloaded in WebDynpro.

Use the FM 'SDOK_MIMETYPE_GET' to get the mimetype.

CALL FUNCTION 'SDOK_MIMETYPE_GET'

EXPORTING

extension = 'PDF'

IMPORTING

mimetype = lv_mimetype_pdf.

Then use the WDA runtime services to attach file to response.

CALL METHOD cl_wd_runtime_services=>attach_file_to_response

EXPORTING

i_filename = ls_filename

i_content = lv_pdf_xstr

i_mime_type = lv_mimetype_pdf

i_in_new_window = abap_false

i_inplace = abap_false.

This will prompt the user for PDF download.

Let me know if you any other questions.

Thanks,

Anand