on 11-27-2007 4:32 PM
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.
Solved by self and with help from raja..
Regards
Sridhar Karra.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
).
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.