Skip to Content
0
Former Member
Feb 11, 2009 at 05:45 AM

Upload File in Mime Repository.

1095 Views

hi ,

I want to upload a file in Mime Repository.

Following is the code I have written for that.

I am bit confused with the URL and i think that is creating a problem

The file is not getting uploaded in the given path.

Help me in this regard whether URL given is right or there needs to be some changes.

Steps used are :

1. I am getting the File into the Context binded to File Upload Element.

2. Now i want to transfer the file present in the Context to the Mime.

3. For this I am transfering the context value into the path (URL) using Mime API but no data is getting transfered in the Mime Repository.

data: mime_repository type ref to if_mr_api,

content type xstring,

url type string value 'SAP/BC/WebDynpro/SAP/ZDOWNLOAD'.

DATA lo_el_context TYPE REF TO if_wd_context_element.

DATA ls_context TYPE wd_this->element_context.

DATA lv_content_fc TYPE wd_this->element_context-content_fc.

  • get element via lead selection

lo_el_context = wd_context->get_element( ).

  • @TODO handle not set lead selection

IF lo_el_context IS INITIAL.

ENDIF.

  • get single attribute

lo_el_context->get_attribute(

EXPORTING

name = `CONTENT_FC`

IMPORTING

value = content ).

mime_repository = cl_mime_repository_api=>get_api( ).

call method mime_repository->put

exporting i_url = url i_content = content .