Application Development and Automation 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: 
Read only

Ole Adobe Reader integration

hendrh
Explorer
0 Likes
475

Hi,

I would like to start Adobe Reader from Abap with OLE automation. I want to know is that possible and how?

Kind regards,

H. Hendriks

1 REPLY 1
Read only

Former Member
0 Likes
338

Hi H. Hendriks,

i use PDF-Integration not by OLE but with WE_EXECUTE.

I fill an itab, put the itab in an simple FORM

convert the FORM to PDF and download it.

Then I Read the PC-Pfad in my report

and execute it.

Here a short example to show an abap-code as PDF.

*

REPORT ZGRO_ITAB_PDF_FORMULAR.

*

DATA: BEGIN OF ITAB OCCURS 0,

TEXT(72),

END OF ITAB.

*

  • Druckparameter

DATA: BEGIN OF DR_PARAM.

INCLUDE STRUCTURE ITCPO.

DATA: END OF DR_PARAM.

*

  • Tabellenausgabe

DATA: OTFDATA LIKE SOLI OCCURS 0 WITH HEADER LINE.

DATA: PDFDATA LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.

DATA: PDF_FILESIZE LIKE SOOD-OBJLEN.

DATA: BIN_FILESIZE TYPE I.

*

DATA: PROGRAM(128) TYPE C.

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

*

READ REPORT 'ZGRO_ITAB_PDF_FORMULAR' INTO ITAB.

*

DR_PARAM-TDDEST = 'LOCAL'. "Ausgabegerät

DR_PARAM-TDIMMED = ' '. "Sofort ausgeben

DR_PARAM-TDPREVIEW = 'X'. "Druckvoschau

DR_PARAM-TDGETOTF = 'X'. "Ausgabe in Tabelle

*

CALL FUNCTION 'OPEN_FORM'

EXPORTING

DEVICE = 'PRINTER'

DIALOG = ' '

OPTIONS = DR_PARAM

FORM = 'ZS_ITAB'

LANGUAGE = SY-LANGU.

*

LOOP AT ITAB.

*

CALL FUNCTION 'WRITE_FORM'

EXPORTING

WINDOW = 'MAIN'

ELEMENT = 'AUSGABE'.

*

ENDLOOP.

*

CALL FUNCTION 'CLOSE_FORM'

TABLES

OTFDATA = OTFDATA.

*

CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'

EXPORTING

FORMAT_SRC = 'OTF'

FORMAT_DST = 'PDF'

DEVTYPE = ''

LEN_IN = ''

IMPORTING

LEN_OUT = PDF_FILESIZE

TABLES

CONTENT_IN = OTFDATA

CONTENT_OUT = PDFDATA.

*

BIN_FILESIZE = PDF_FILESIZE.

*

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

BIN_FILESIZE = BIN_FILESIZE

FILENAME = 'D:TEST.PDF'

FILETYPE = 'BIN'

TABLES

DATA_TAB = PDFDATA

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6.

*

  • Programmpfad auf PC für PDF ermitteln

CALL FUNCTION 'SO_PROGNAME_GET_WITH_PATH'

EXPORTING

DOCTYPE = 'PDF'

IMPORTING

PATHNAME = PROGRAM

EXCEPTIONS

PATH_NOT_FOUND = 1

PROGRAM_NOT_FOUND = 2

NO_BATCH = 3

X_ERROR = 4

OTHERS = 5.

*

IF SY-SUBRC <> 0.

write: / 'PDF-Programm kann nicht ermittelt werden!'.

EXIT.

ENDIF.

*

CALL FUNCTION 'WS_EXECUTE'

EXPORTING

COMMANDLINE = 'D:TEST.PDF'

PROGRAM = PROGRAM

EXCEPTIONS

FRONTEND_ERROR = 1

NO_BATCH = 2

PROG_NOT_FOUND = 3

ILLEGAL_OPTION = 4

GUI_REFUSE_EXECUTE = 5

OTHERS = 6.

*

IF SY-SUBRC <> 0.

write: / 'PDF-Programm kann nicht ausgeführt werden!'.

ENDIF.

*

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

  • Programmende *

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

Hope i can help you.

Regards, Dieter