cancel
Showing results for 
Search instead for 
Did you mean: 

Reg: Displaying an excel file stored as MIME object

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

gabriel_pill-kahan
Active Participant

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

Former Member
0 Kudos

Thanks Gabriel!

I have debugged and solved on my own using the FM 'SKWV_KWUI_DOC_DISPLAY' .

Your answer is perfect. points given

Answers (1)

Answers (1)

SimoneMilesi
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Simone,

This part gives me a short dump.

WDR=>client_window.....

Regards,

Rajan U

former_member469314
Participant
0 Kudos

The attach_file_to_response method is meant for use in a WebDynpro Environment. As you are developing a normal report, try using class  cl_gui_frontend_services instead.