on 10-25-2010 9:40 PM
Hi Experts,
I have a scenario in which the linktoaction on a table( ALV ) cell should trigger a popup window which is totally a different webdynpro component(let say- compB)
for eg: Output of comA
emp no emp name time
911034 roger 8
890123 kathey 8
So the linktoaction is for the emp no column. So when they click on 911034 a poupup window should open which is a different webdynpro component(compB)
layout of comB looks like below table(not ALV)
emp no: leave
911034 vacation
so here I am trying to pass the parameter from compA to an interface method (get_data) of comB.
lo_INTERFACECONTROLLER = wd_this->wd_cpifc_sample( ).
lo_interfacecontroller->get_data(
l_pernr_parent = <l_value> " data
).
In compB in the interface method (get_data) of the component controller II have the importing parameter 'l_pernr_parent' .
I am getting the value from compA to the parameter 'l_pernr_parent' but the problem is when I try to set that attribute in the context it doesn't accept the value means it doesn't show up in the result .But when i put the same code in wddoinit Its shows the value i tested it by hard coding a value.
But the problem here is:
How to send this 'l_pernr_parent' value to wddoinit.
Is there any way I can bind the value to the context in the interface method itself.
Below is the code I tried to bind the data in to the context node in the interface method (get_data) it didn't work and not updating the view.
data l_pernr type string.
l_pernr = l_pernr_parent.
*DATA: lo_nd_info TYPE REF TO if_wd_context_node,
lo_el_info TYPE REF TO if_wd_context_element.
lo_nd_info = wd_context->path_get_node( path = `HEADER` ).
lo_el_info = lo_nd_info->get_element( ).
*
lo_el_info->set_attribute( name = 'PERNR' value = l_pernr ).
Only if the code is in wddoinit it accepts the value but there i don't have the value which I am getting from comA.
Can you please help.
Hi Amol Ghatuk,
it is not possible to pass/share data between two web dynpro applications using interface method/context/events, because when you open other Application external to the Using component it means it is different Browsing session.
Although your interface method in the Used compoent A is going to set the value in context of component B, (I guess you are using create_external_window method to call other application) when you call the used component using create_external_window all the values are initialized in the component B, so there is no way you can use this kind of data sharing, As it is suggested by Can Tang that is the only way we have besides normal abap sharing methods like shared objects memory.
Thanks,
Kranthi.
Edited by: kranthi kumar on Oct 26, 2010 10:14 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I just tried the same req and it works,
Have a look at this code,
method click .
data : lo_node type ref to if_wd_context_node,
lo_node_ele type ref to if_wd_context_element,
lv_carrid type sflight-carrid.
lo_node = wd_context->get_child_node( name = wd_this->wdctx_flightab ).
lo_node_ele = lo_node->get_lead_selection( ).
lo_node_ele->get_attribute( exporting name = 'CARRID'
importing value = lv_carrid ).
data lo_cmp_usage type ref to if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_popup_comp( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
data lo_interfacecontroller type ref to ziwci_sdn_usedcomponent_zari .
lo_interfacecontroller = wd_this->wd_cpifc_popup_comp( ).
lo_interfacecontroller->get_customerid( iv_carrid = lv_carrid ).
This method is the one in the used component
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( ).
lo_window_manager = lo_api_component->get_window_manager( ).
lo_window = lo_window_manager->create_window_for_cmp_usage(
interface_view_name = 'MAIN_WINDOW'
component_usage_name = 'POPUP_COMP'
title =
close_in_any_case = abap_true
message_display_mode = if_wd_window=>co_msg_display_mode_selected
).
lo_window->open( ).
endmethod.
In the component controller of the used component, here is the method
method GET_CUSTOMERID .
data : lo_node type ref to if_wd_context_node,
lo_node_ele type ref to if_wd_context_element,
ls_bookingstab type wd_this->element_booking_details.
*To get the reference of the context node
lo_node = wd_context->get_child_node( name = wd_this->wdctx_booking_details ).
*get the element reference
lo_node_ele = lo_node->get_element( ).
*Get the data from the DB table
select single * from sbook into ls_bookingstab where carrid = iv_carrid.
and connid = iv_connid.
*set the attributes to the context node
lo_node_ele->set_static_attributes( static_attributes = ls_bookingstab ).
endmethod.
Hope it helps resolving yoru problem.
Regards,
Zarina
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can pass the paramter from CompA to CompB in the following way:
1.ALV provides an event handler ONCLICK.
Create a method in the METHODS tab and and in the event column access this event.
Write the below code in the method.
IF r_param->column EQ 'EMPNO' .
lo_el_cons_list = lo_nd_cons_list->get_element( index = r_param->index ).
IF lo_el_cons_list IS NOT INITIAL.
lo_el_cons_list->get_static_attributes(
IMPORTING
static_attributes = ls_cons_list ).
create an outbound plug for CompA and an inbound plug for the compB.
Now fire the outbound plug when user clicks on empno in the ALV table.
When you are creating an outbound plug add empno as the paramater.
wd_this->fire_op_change_cv_plg(
empno = ls_cons_list-empno ). "passing the empno value to compB through the plugs
endif.
2.In the Comp B ,in the handler method of the inbound plug you can get the empno value.
using the emp no you can retrive other values of an employee and display in the table.
Regards.
Priya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,Amol Ghatuk.
Unfortunately , as far as i know you can not use the "Interface method/Interface Event" between 2 separately WebDynpro applications.
In order to pass the parameter between these 2 applications, you can make use of the "URL".
Take one simple example:
In Comp 1: add parameters to URL
which you can place it in the action handler.
* get the URL of the called application
CALL METHOD CL_WD_UTILITIES=>CONSTRUCT_WD_URL
EXPORTING
APPLICATION_NAME = 'COMP 2'
IMPORTING
OUT_ABSOLUTE_URL = lw_url.
"i want to pass the CARRID as the parameter
* add the parameters
CALL METHOD CL_HTTP_SERVER=>IF_HTTP_SERVER~APPEND_FIELD_URL
EXPORTING
NAME = 'CARRID'
VALUE = ls_context-CARRID
CHANGING
URL = lw_url.
* opent the external pop-up window
lo_api_comp = wd_comp_controller->wd_get_api( ).
lo_window_mg = lo_api_comp->get_window_manager( ).
lo_window = lo_window_mg->create_external_window( url = lw_url ).
lo_window->open( ).
In Comp 2: parse the URL parameters
Which you can place it in WDdoInit of Component controller
* get the value from the calling application
lw_string = wdr_task=>client_window->IF_WDR_CLIENT_INFO_OBJECT~GET_PARAMETER( 'CARRID' ).
lw_carrid = lw_string.
Not sure whether it can fit your requirement or not.
Hope it can help you a little.
Best wishes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.