Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

PDF stored on Application Server - Need to retrieve and display

Hi All,

Let me explain to you what I am doing and how I have not succeeded.

I am quiet a senior ABAP guy henceforth I am posting this and have also looked for previous posts to no avail.

Firstly, I use GUI_UPLOAD and OPEN dataset to store a PDF file on the Application Server. I have retrieved it with CG3Y without any problems. My requirement is that I have a list of these PDF files displayed on a report and a user selects ONE line and clicks VIEW PDF (custom ALV). This should then launch the PDF in acrobat from the Application server.

I have tried WS_EXECUTE but that does not work. I do not even mind if this PDF is displayed in HTML or an image. I just need some help??

ANy help will be greatly rewarded.

Thanks!!

Tags:
replied

the working of this code is embedded in the comment:

" First I set some define for the program:

******************************************************************

  • define for the program *****************************************

******************************************************************

DATA exe_4_doc TYPE string VALUE '"C:\Program Files\OpenOffice.org 2.3\program\swriter.exe"'.

DATA exe_4_xls TYPE string VALUE '"C:\Program Files\OpenOffice.org 2.3\program\scalc.exe"'.

DATA exe_4_ods TYPE string VALUE '"C:\Program Files\OpenOffice.org 2.3\program\scalc.exe"'.

DATA exe_4_ppt TYPE string VALUE '"C:\Program Files\OpenOffice.org 2.3\program\simpress.exe"'.

DATA exe_4_pdf TYPE string VALUE '"C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe"'.

*----


" local data

DATA file_path TYPE string.

" name of the executable

DATA program(128) TYPE c VALUE ''.

" I searched the file path for the extension for some type of file

" assigning the name of the program to use:

" pdf file

IF program IS INITIAL.

SEARCH file_path FOR '*pdf'.

IF sy-subrc = 0.

program = exe_4_pdf.

ELSE.

SEARCH file_path FOR '*PDF'.

IF sy-subrc = 0.

program = exe_4_pdf. " defined at the top

ENDIF.

ENDIF.

ENDIF.

....

.... " search for other extension

....

" then I assigned the value to

IF program IS NOT INITIAL.

" '"' are mandatory to avoid problems

" with white space in the path

CONCATENATE '"' file_path '"' INTO file_path.

CALL FUNCTION 'WS_EXECUTE'

EXPORTING

" file_path is the path to the file

commandline = file_path

" program is one of the define above

program = program

EXCEPTIONS

frontend_e

rror = 1

no_batch = 2

prog_not_found = 3

illegal_option = 4

OTHERS = 5.

IF sy-subrc = 0.

"error

ENDIF.

ENDIF.

-


With this code I can open every file I want with every program.

Hope this can help.

Cheers

Gabriele

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question