Application Development 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: 

Display raw string data in pdf format on ABAP screen

Former Member
0 Kudos

Hi,

I've data in the form of raw string. Now the requirement is to display this data as a pdf file on the ABAP screen.I am getting the error 'Could not find adobe application to open the pdf document'.But the same code works fine if i give url as the path of a file on local drive.

"""gs_file_data-fdata is the raw string""

Following is the code :

DATA: ltb_data TYPE table of LXE_XTAB.

DATA: lst_data LIKE LINE OF lt_data.

  • Local data definition

DATA: ls_fdata TYPE LINE OF hressin_file_data,

ls_atchm TYPE LINE OF hressin_attachments,

ls_atcdt TYPE LINE OF hressin_attachments_data,

lt_atcdt TYPE hressin_attachments_data,

lv_index TYPE pin_lindx.

  • Local calculation

DATA: lv_offset TYPE i,

lv_string_length TYPE i,

lv_rows TYPE i,

lv_last_row_length TYPE i.

DATA: lv_url_pdf TYPE char255,

pdf_file TYPE REF TO cl_gui_pdfviewer,

container_pdf TYPE REF TO cl_gui_custom_container.

CREATE OBJECT container_pdf

EXPORTING

container_name = 'PDF_CNTNR'

repid = 'ZHINUACRP01'

dynnr = '103'.

CREATE OBJECT pdf_file

EXPORTING

parent = container_pdf.

  • Clear and Refresh the data in loop

CLEAR: ls_atchm, lt_atcdt, lv_offset.

REFRESH: lt_atcdt.

data lv_xstring type xstring.

lv_xstring = gs_file_data-fdata.

CALL FUNCTION 'LXE_COMMON_XSTRING_TO_TABLE'

EXPORTING

in_xstring = lv_xstring

  • IMPORTING

  • PSTATUS =

tables

ex_tab = ltb_data .

CALL FUNCTION 'DP_CREATE_URL'

EXPORTING

type = 'application'

subtype = 'pdf'

TABLES

data = ltb_data

CHANGING

url = lv_url_pdf.

CALL METHOD pdf_file->open_document

EXPORTING

url = lv_url_pdf

Thanks and regards,

Meenakshi Garg

1 ACCEPTED SOLUTION

Ramneek
Advisor
Advisor
0 Kudos

Hello Meenakshi,

You could use the i_oi_document_viewer to view the pdf. Use the method view_document_from_table. You will have to format the data in a table and pass it as a parameter to this method.

Thank you,

Ramneek

1 REPLY 1

Ramneek
Advisor
Advisor
0 Kudos

Hello Meenakshi,

You could use the i_oi_document_viewer to view the pdf. Use the method view_document_from_table. You will have to format the data in a table and pass it as a parameter to this method.

Thank you,

Ramneek