on 02-10-2009 7:24 AM
hi,
I have uploaded a file( jpg ) using FileUpload UI Element.
As far as I know file is uploaded in the Server.
Now is it possible to download that particular file which i have uploaded ?
If so, how to proceed for that ?
Thanx.
What do you mean by: As far as I know? Did you or did you not download it to application server? Meaning, after uploading the file, it is stored in context node which is assigned to your UI element. But did does not mean that is automatically stored on the application server.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Where do you want to store it on the server? In the filesystem, in the database, or in the MIME Repository. These are all valid options and all available to you as a developer. Each would have a different approach. Filesystem would use the ABAP DATASET commands, Database would use normal SQL commands to write into a RAW STRING field, the MIME Repository would use the already mentioned MIME API class.
Hi Thomas,
I want to upload my file to Mime Repository.
I am using the following Code to upload the same.
Content is binded to File Upload UI Element.
data: mime_repository type ref to if_mr_api,
content type xstring.
Reading the Values From Context into variable Content type xstring.**
DATA lo_nd_cn_content TYPE REF TO if_wd_context_node.
DATA lo_el_cn_content TYPE REF TO if_wd_context_element.
DATA ls_cn_content TYPE wd_this->element_cn_content.
DATA lv_content TYPE wd_this->element_cn_content-content.
navigate from <CONTEXT> to <CN_CONTENT> via lead selection
lo_nd_cn_content = wd_context->get_child_node( name = wd_this->wdctx_cn_content ).
@TODO handle non existant child
IF lo_nd_cn_content IS INITIAL.
ENDIF.
get element via lead selection
lo_el_cn_content = lo_nd_cn_content->get_element( ).
@TODO handle not set lead selection
IF lo_el_cn_content IS INITIAL.
ENDIF.
get single attribute
lo_el_cn_content->get_attribute(
EXPORTING
name = `CONTENT`
IMPORTING
value = content ).
mime_repository = cl_mime_repository_api=>get_api( ).
call method mime_repository->put( exporting i_url = 'SAP/BC/BSP/SAP/WEB_UTILITY' i_content = content ).
Now I am not able to see the uploaded file in the Mime Repository.
Is the Code okay ?
Thanx.
Hi,
Yes, there is an UI element with which you can be able to downlaod the same file.You can upload and download any type of file using the class CL_MIME_REPOSITORY_API.
For example, you have your JPG file in the location ''/SAP/BC/BSP/SAP/myBSPapplication/yourfile.jpg''
You can retrieve the information using the below code,
data:
mime_repository type ref to if_mr_api,
content type xstring,
mime_type type string,
url type string value 'SAP/BC/BSP/SAP/myBSPapplication/yourfile.jpg'.
mime_repository = cl_mime_repository_api=>get_api( ).
call method mime_repository->get
exporting
i_url = url
importing
e_content = content.
e_mime_type = mime_type.
and finally bind the content value to the attribute of your file download UI element.
This is for your additional information, you can use the same class for uploading the documents also.
There is a interface called IF_MR_API~PUT which can help you in doing so.
Thanks,
Rajkumar.S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
11 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.