Skip to Content
0
Former Member
Apr 20, 2009 at 10:01 AM

Display raw string data in pdf format on ABAP screen

1028 Views

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