on 04-21-2009 4:17 PM
Hi,
I need to open a word document on clicking of a button which contains some information.
In the same way,on clicking of another button i need to provide options to the users to select one of the 3 or 4 attached documents can be ppt, word, excel etc..
how to achieve this?
Regards,
Lakshmi.
hi,
->To open a file on the click of button you can place the file in Mime Repository(Right click on your component ->Create ->Import ->Browse the file and it will be plaed in Mime )
Now you can retrieve the file on the click of Button using the following 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.
Now you have that file in the Content.
Finally You can bind the Content with Attribute of File Download UI.
This way you can have different Files kept in Mime and on the click of button you can give user different FileDownload links to choose the file from.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
i have placed a word document with some data in MIME repository.
now i want to open this document on clicking of a button.
for this i followed these steps.
1) i imported a file called Feedback.doc into MIME
2) i placed a button on the view.
3) on action event handler of button i wrote the following code.
CALL METHOD cl_wd_runtime_services=>attach_file_to_response
EXPORTING
i_filename = 'C:\Documents and Settings\s8rxcn\Desktop\Feedback.doc'
i_content = content
i_mime_type = 'MS_WORD'.
here what is content... how to get the document with content?
Regards,
Lakshmi.
hi,
->Here Content is the Attribute of Type XString which is having your File now.
->Now you can use FileDownload UI Element. Bind the Data Property with this Attribute Content.
->Change the Text of FileDownload UI to what ever text you want.
-> Finally a Link will appear to the User and On the Click this link , you will get your File(whether doc or .ppt. )
Thanx.
Hi Lakshmi,
For the requirement yoy have asked please follow the below steps..
1.You need to get the MIME object ref and then get the content of that MIME object.
2.Open the file with this content on click of the button.
DATA : mime_repository TYPE REF TO if_mr_api,
content TYPE xstring,
url TYPE string ,
lv_fnam TYPE string..
DATA: l_component TYPE REF TO if_wd_component,
l_component_info TYPE REF TO if_wd_rr_component,
l_name TYPE string.
lv_fnam = wd_assist->if_wd_component_assistance~get_text( 'MIM' ).
l_component = wd_this->wd_get_api( ).
l_component_info = l_component->get_component_info( ).
l_name = l_component_info->get_name( ).
mime_repository = cl_mime_repository_api=>get_api( ).
CALL METHOD cl_wd_utilities=>construct_wd_url( EXPORTING application_name = l_name
IMPORTING out_local_url = url ).
CONCATENATE url '/' lv_fnam INTO url.
CALL METHOD mime_repository->get
EXPORTING
i_url = url
i_check_authority = ' '
IMPORTING
e_content = content
EXCEPTIONS
parameter_missing = 1
error_occured = 2
not_found = 3
permission_failure = 4
OTHERS = 5
.
cl_wd_runtime_services=>attach_file_to_response(
EXPORTING
i_filename = lv_file_name
i_content = lv_xfile
i_mime_type = 'APPLICATION/MSWORD').
Regards,
Priya
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.