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

CL_GUI_PDFVIEWER

Former Member
0 Likes
6,717

Hallo,

does anybody know how to use this class...?

I tried to use it, but I always get a short dump...

Thanks,

Mike

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,740

Hi Mike ,

You can use OPEN_DOCUMENT method of the class.

Please go through this program.

REPORT YSHAIL_PDF .

data: container type ref to cl_gui_custom_container,

pdf type ref to cl_gui_pdfviewer.

DATA: ITAB TYPE TABLE OF ZSHAIL_T1 WITH HEADER LINE.

SELECT * FROM ZSHAIL_T1 INTO TABLE ITAB.

call screen 100.

module STATUS_0100 output.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

if container is initial.

CREATE OBJECT container

EXPORTING

  • PARENT =

container_name = 'PDF'

  • STYLE =

  • LIFETIME = lifetime_default

  • REPID =

  • DYNNR =

  • NO_AUTODEF_PROGID_DYNNR =

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

LIFETIME_DYNPRO_DYNPRO_LINK = 5

others = 6

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CREATE OBJECT pdf

EXPORTING

parent = container

  • LIFETIME =

  • SHELLSTYLE =

  • AUTOALIGN =

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

others = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL METHOD pdf->open_document

EXPORTING

<b> url = 'file://D:\SP\shail''s files\my docs\ab4query.pdf'</b>

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

others = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endif.

endmodule. " STATUS_0100 OUTPUT

module USER_COMMAND_0100 input.

case sy-ucomm.

when 'EXIT'.

leave program.

endcase.

endmodule. " USER_COMMAND_0100 INPUT

<b>Is your problem solved..?? </b>

Regards,

SP.

Hallo,

does anybody know how to use this class...?

I tried to use it, but I always get a short dump...

Thanks,

Mike

14 REPLIES 14
Read only

Peter_Inotai
Active Contributor
0 Likes
4,740

Hi Mike,

Check demoprogram SAP_PDF_VIEWER_DEMO.

Peter

Read only

0 Likes
4,740

Hi Peter,

it has the same problem...

dump, dump, dump...

Read only

0 Likes
4,740

Hi,

did you check this ...., Here you have Solution.

Check it.

Regards

vijay

Read only

0 Likes
4,740

check this thread, it has already been discussed.

its because of the wrong version of the PDF activex control object.

Regards

Raja

Read only

0 Likes
4,740

Thanks guys,

very useful answers...

Here's another one, if you please...

Do you know how to open a pdf document using the same class CL_GUI_PDFVIEWER?

Thanks,

Mike

Read only

0 Likes
4,740

use

OPEN_DOCUMENT method of PDF viewer class.

Regards

Raja

Read only

0 Likes
4,740

hi,

use the method <b>OPEN_DOCUMENT</b> in the class <b>CL_GUI_PDFVIEWER</b>

Regards

vijay

Read only

0 Likes
4,740

Ehm...

I tried, but it does not work...

Read only

Former Member
0 Likes
4,741

Hi Mike ,

You can use OPEN_DOCUMENT method of the class.

Please go through this program.

REPORT YSHAIL_PDF .

data: container type ref to cl_gui_custom_container,

pdf type ref to cl_gui_pdfviewer.

DATA: ITAB TYPE TABLE OF ZSHAIL_T1 WITH HEADER LINE.

SELECT * FROM ZSHAIL_T1 INTO TABLE ITAB.

call screen 100.

module STATUS_0100 output.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

if container is initial.

CREATE OBJECT container

EXPORTING

  • PARENT =

container_name = 'PDF'

  • STYLE =

  • LIFETIME = lifetime_default

  • REPID =

  • DYNNR =

  • NO_AUTODEF_PROGID_DYNNR =

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

LIFETIME_DYNPRO_DYNPRO_LINK = 5

others = 6

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CREATE OBJECT pdf

EXPORTING

parent = container

  • LIFETIME =

  • SHELLSTYLE =

  • AUTOALIGN =

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

others = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL METHOD pdf->open_document

EXPORTING

<b> url = 'file://D:\SP\shail''s files\my docs\ab4query.pdf'</b>

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

others = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endif.

endmodule. " STATUS_0100 OUTPUT

module USER_COMMAND_0100 input.

case sy-ucomm.

when 'EXIT'.

leave program.

endcase.

endmodule. " USER_COMMAND_0100 INPUT

<b>Is your problem solved..?? </b>

Regards,

SP.

Read only

0 Likes
4,740

Thanks for your answer;

I tried but... it doesn't work; it just shows a white sqare within the dynpro.

Of course I have modified the program using a pdf file that exists on my PC.

Read only

0 Likes
4,740

before correcting your program.

just to check whether there is anything wrong with the PDf document or with the PDF viewer in your machine.

just run prorgram SAPHTML_DEMO1 from transaction se38.

enter the file path in the inputfield

d:\Documents and Settings\XXX\Desktop\readme.pdf

and hit enter.

do you see the pdf document in the control?

Regards

Raja

Read only

0 Likes
4,740

Hallo,

yes, using program SAPHTML_DEMO1 I can see everything...

Read only

0 Likes
4,740

it will be difficult to identify the error without seeing your code.

however if your requirement is to just have a control on the screen to show PDF documents, you dont need pdf viewer class . you can use just html viewer control (SAPHTML_DEMO1 ). even if you look at the code in pdf viewer class, they use html viewer control.

Regards

Raja

Read only

0 Likes
4,740

hi: SP.

Because my IDES doesn't have a table called ZSHAIL_T1 that the program can't run.

Can you give me some advice?

Or can you tell me what the table is?

Many thanks!