cancel
Showing results for 
Search instead for 
Did you mean: 

How to open PDF doc on LinkToAction event

Srisap
Participant
0 Kudos

Hello,

I have a linktoaction UI element. I want to open a PDF file which is in my mime folder when I click it.

Please help...

Regards,

Sridhar Karra.

Accepted Solutions (0)

Answers (2)

Answers (2)

Srisap
Participant
0 Kudos

Solved by self and with help from raja..

Regards

Sridhar Karra.

raja_thangamani
Active Contributor
0 Kudos

Look at the below thread, it will answer your question:

Raja T

Srisap
Participant
0 Kudos

Hello Raja,

I am usng the FM SAP_OI_LOAD_MIME_DATA but I do not know what value should I pass to the importing parameter. I have uploaded the mime object in the WDA.

I am confused how to use this FM. Please guide.

Regards,

Sridhar Karra.

Srisap
Participant
0 Kudos

hey guys,

help me out with this...

I have uploaded the pdf file in the WDA. now how call it from linktoaction event.

Regards,

Sri.

raja_thangamani
Active Contributor
0 Kudos

Right click on MIME object, choose Properties,goto Technical info. where you can find the Document ID, Get this & pass it to the function module.

Hope this will help you.

Raja T

Srisap
Participant
0 Kudos

Hello raja,

Like you said I passed the document number 'DC98D103DC8468F18AAA005056AA0110' to the FM, but it failed.

Is there any other way...

Please help...

Regards,

Sridhar Karra.

raja_thangamani
Active Contributor
0 Kudos

what error you are getting?

Dont test this FM thro SE37, it will give you a dump. Call thro your WDA. Make sure that you pass the Logical Document ID.

<i>*Reward each useful answer</i>

Raja T

Srisap
Participant
0 Kudos

Thxs for your help.... Raja

But here the code that will help you open PDF files....

DATA : lv_object_id(40) TYPE c VALUE 'DCA24C262A1F82F18331005056AA0110'.

" This is the logical ID for the PDF uploaded in the Mime folder of your WDA

DATA : lv_io TYPE skwf_io.

DATA : lit_data TYPE sdokcntbins.

DATA : lv_lang TYPE sy-langu VALUE 'E'.

DATA lv_filesize TYPE i.

DATA lv_buffer TYPE mime_data.

lv_io-objtype = 'L'.

lv_io-class = 'M_APP_L'.

lv_io-objid = lv_object_id.

CALL METHOD cl_wb_mime_repository=>load_mime

EXPORTING

io = lv_io

  • check_authority = ' '

IMPORTING

  • docname =

  • description =

  • filename =

filesize = lv_filesize

bin_data = lit_data

  • mimetype =

CHANGING

language = lv_lang

EXCEPTIONS

no_io = 1

illegal_io_type = 2

not_found = 3

error_occured = 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 FUNCTION 'SCMS_BINARY_TO_XSTRING'

EXPORTING

input_length = lv_filesize

  • FIRST_LINE = 0

  • LAST_LINE = 0

IMPORTING

buffer = lv_buffer

TABLES

binary_tab = lit_data

  • EXCEPTIONS

  • FAILED = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

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

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

ENDIF.

cl_wd_runtime_services=>attach_file_to_response(

EXPORTING

i_filename = 'WebHelp.pdf'

i_content = lv_buffer

i_mime_type = 'application/pdf'

i_in_new_window = abap_true

).