on 02-12-2016 11:06 AM
Hi all,
I have stored an excel file as MIME object and now I want to open this excel file from selection screen of my report.
How to achieve this?
Please help!
Regards,
Rajan U
Hi,
here's a quick & dirty report (no authorization checks, no real error checks) but you should get the idea. We want to call function module SKWV_KWUI_DOC_DISPLAY but first get the PHIO of the MIME object.
REPORT ztest_mime_display.
parameter p_url type string lower case
default '/sap/public/bc/nwdemo_model/sales_orders.xml'.
DATA lo_mr_api TYPE REF TO if_mr_api.
DATA l_is_folder TYPE boole_d.
DATA ls_loio TYPE skwf_io.
DATA ls_phio TYPE skwf_io.
DATA ls_loio_object TYPE sdokobject.
DATA ls_phio_object TYPE sdokobject.
DATA lt_context TYPE TABLE OF sdokpropty.
*Get MIME Repository API
lo_mr_api = cl_mime_repository_api=>if_mr_api~get_api(
* i_prefix = SPACE
).
* Get Logical object information
lo_mr_api->get_io_for_url(
EXPORTING
i_url = p_url
IMPORTING
e_is_folder = l_is_folder
e_loio = ls_loio
EXCEPTIONS
parameter_missing = 1
error_occured = 2
not_found = 3
OTHERS = 4
).
IF sy-subrc <> 0.
RETURN.
ENDIF.
MOVE-CORRESPONDING ls_loio TO ls_loio_object.
*Get Physical object from the Logical one
CALL FUNCTION 'SO_LOIO_PHIO_GET'
EXPORTING
loio_object = ls_loio_object
IMPORTING
phio_object = ls_phio_object
TABLES
context = lt_context
EXCEPTIONS
kpro_inconsistency = 1
x_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
RETURN.
ENDIF.
MOVE-CORRESPONDING ls_phio_object TO ls_phio.
ls_phio-objtype = 'P'.
* Display Physical object
CALL FUNCTION 'SKWV_KWUI_DOC_DISPLAY'
EXPORTING
phio = ls_phio
* TERMINOLOGY =
.
Regards, Gabriel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i found a couple of methods/functions that could help you (Saint Google on SCN )
* instantiate MIME API class
CALL METHOD cl_mime_repository_api=>if_mr_api~get_api
RECEIVING
r_mr_api = lo_mr_api.
* Get file from MIME repository
CALL METHOD lo_mr_api->get
EXPORTING
i_url = '/sap/test/template.xml'
* I_CHECK_AUTHORITY = 'X'
IMPORTING
e_is_folder = l_folder
e_content = l_xstring
e_mime_type = l_mimetype
* E_LOIO =
* CHANGING
* C_LANGUAGE =
EXCEPTIONS
parameter_missing = 1
error_occured = 2
not_found = 3
permission_failure = 4
OTHERS = 5
plus
wdr_task=>client_window->client->attach_file_to_response(
**path to the xls file
i_filename = 'file.xls'
* String Variable
i_content = the XSTRING
* File Type
i_mime_type = 'EXCEL' ).
Give a try and let me know if it works
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.