on 04-11-2012 12:09 PM
Hi
I have a web dynpro application in which I put a button. If you click on that button, I would like to display a specific word document that I also added in the web dynpro as a MIME object. If I click on the MIME object, the word document opens, but if I run my web dynpro in Test and click on the button, it gives me a SAP ACF Trace error. I cannot see to find the problem.
I have an Office control Element where the Datasourse is linked to an attribute XSTRING.
The document type is ms_word.
Could someone please assist urgently?
Regards
Debbie
Create Office Control UI Element,and bind datasource to Xstring attribute(DATAS),Give property of Document type to ms_word.
DATA:
office TYPE REF TO cl_wd_view_element,
mime_repository TYPE REF TO if_mr_api,
content TYPE xstring,
contentapp TYPE xstring,
contentxmlsource TYPE xstring.
DATA lo_nd_lt_files TYPE REF TO if_wd_context_node.
DATA lo_el_lt_files TYPE REF TO if_wd_context_element.
DATA ls_lt_files TYPE wd_this->element_lt_files.
DATA lv_urls TYPE wd_this->element_lt_files-urls.
DATA lo_nd_document TYPE REF TO if_wd_context_node.
DATA lo_el_document TYPE REF TO if_wd_context_element.
DATA ls_document TYPE wd_this->element_document.
DATA lo_window_manager TYPE REF TO if_wd_window_manager.
DATA lo_api_component TYPE REF TO if_wd_component.
DATA lo_window TYPE REF TO if_wd_window.
*- Getting MIME Repository API.
mime_repository = cl_mime_repository_api=>get_api( ).
* navigate from <CONTEXT> to <LT_FILES> via lead selection
lo_nd_lt_files = wd_context->get_child_node( name = wd_this->wdctx_lt_files ).
* navigate from <CONTEXT> to <DOCUMENT> via lead selection
lo_nd_document = wd_context->get_child_node( name = wd_this->wdctx_document ).
* get element via lead selection
lo_el_lt_files = lo_nd_lt_files->get_element( ).
* get element via lead selection
lo_el_document = lo_nd_document->get_element( ).
* get single attribute
lo_el_lt_files->get_attribute(
EXPORTING
name = `URLS`
IMPORTING
value = lv_urls ).
*- Getting URL From MIME Repository.
CALL METHOD mime_repository->get
EXPORTING
i_url = lv_urls
IMPORTING
e_content = content.
* set single attribute
lo_el_document->set_attribute(
name = `DATAS`
value = content ).
Regards,
Ashok.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Debbie,
1. You should get the currently executing application URL
below is the code to get URL
* Interface Declarations
DATA: lo_ctrl_api TYPE REF TO if_wd_controller,
lo_comp_api TYPE REF TO if_wd_component,
lo_appl_api TYPE REF TO if_wd_application,
lo_appl_info TYPE REF TO if_wd_rr_application.
*get the application name
lo_ctrl_api = wd_this->wd_get_api( ).
lo_comp_api = lo_ctrl_api->get_component( ).
lo_appl_api = lo_comp_api->get_application( ).
lo_appl_info = lo_appl_api->get_application_info( ).
lv_appl_name = lo_appl_info->get_name( ).
2. Construct URL:
DATA: lv_app TYPE string,
lv_url TYPE string,
lv_url1 TYPE string,
lv_pack TYPE string.
CALL METHOD cl_wd_utilities=>construct_wd_url
EXPORTING
application_name = '/sap/'
IMPORTING
out_absolute_url = lv_url
out_local_url = lv_url1.
3. Place your MIME imported word Document.
CONCATENATE lv_url1 lv_appl_name INTO lv_app.
CONCATENATE lv_app 'mime_document.doc' INTO lv_pack SEPARATED BY '/'.
DATA lo_window_manager TYPE REF TO if_wd_window_manager.
DATA lo_api_component TYPE REF TO if_wd_component.
DATA lo_window TYPE REF TO if_wd_window.
lo_api_component = wd_comp_controller->wd_get_api( ).
IF lo_api_component IS BOUND .
lo_window_manager = lo_api_component->get_window_manager( ).
IF lo_window_manager IS BOUND.
4. Open document in New Window.
CALL METHOD lo_window_manager->create_external_window
EXPORTING
url = lv_pack
modal = abap_true
has_menubar = abap_true
is_resizable = abap_true
has_scrollbars = abap_true
has_statusbar = abap_true
has_toolbar = abap_true
has_location = abap_false
RECEIVING
window = lo_window.
lo_window->open( ).
ENDIF.
ENDIF.
Hope this would resolve your issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.