on 02-02-2011 11:38 AM
Hi
Is it possible to open poup window on selection of dropdown key in table.
I have a table with ddbykey. It contains values Ex: A,B,C,D.
If i select 'D', i want to open one popup window? can we do this?
Thanks,
kris.
OnSelect event you can check the key
if the key = 'D'.
Call pop up window.
There are lots of code example available in SCN regarding popup window.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Now giving dump...
Code :
DATA : value TYPE wdy_key_value,
set TYPE wdy_key_value_table,
node_info TYPE REF TO if_wd_context_node_info.
DATA lo_nd_node TYPE REF TO if_wd_context_node.
DATA lo_el_node TYPE REF TO if_wd_context_element.
DATA ls_node TYPE wd_this->Element_node.
DATA lv_node TYPE wd_this->Element_node-segment.
lo_nd_node = wd_context->get_child_node( 'NODE' ).
node_info = wd_context->get_node_info( ).
get element via lead selection
lo_el_node = lo_nd_node->get_element( ).
get single attribute
lo_el_segment1->get_attribute(
EXPORTING
name = `NAME`
IMPORTING
value = lv_segment ).
if value-key = lv_segment.
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(
window_name = 'POPUP_WINDOW'
title =
close_in_any_case = abap_true
message_display_mode = if_wd_window=>co_msg_display_mode_selected
close_button = abap_true
button_kind = if_wd_window=>co_buttons_ok
message_type = if_wd_window=>co_msg_type_none
default_button = if_wd_window=>co_button_ok
).
lo_window->open( ).
endif.
What basically you are doing here in the code is but unclear.
LIke what are you comparing in the IF condition.
if you want to open the popup on a particular selected value.
Just compare the value of the attribute which is bound to the selected key with the value.
say seg is the attribute which is bound to the selcted key of dropdown then
just read this attribute in a variable and compare its value to some fixed value say 'D'.
then open the popup.
where are you getting the dump.
thanks
sarbjeet
Hi,
I guess u have a problem in the following part of your posted code.
lo_el_segment1->get_attribute(
EXPORTING
name = `NAME`
IMPORTING
value = lv_segment ).
I guess , lo_el_segment1 should be replaced by lo_el_node .
lo_el_node->get_attribute(
EXPORTING
name = `NAME`
IMPORTING
value = lv_segment ).
Please make the following change abd try once.
Thanks,
Aditya.
Hi kissnas ,
If you are getting dump in that get_attribute
Access via 'NULL' object reference not possible
Then it is sure lo_el_segment1 is not instantiated.
You have instantiate the element lo_el_node not lo_el_segment1 .
Is lo_el_segment1 is related to another node ( not your 'NODE' node) , then where you have instantiated this check out.
Again I think if you do that code in WDDOINIT . then its will run for once.
What seems to me that you have done that coding with the intension like when
lv_segment = value-key that is your fourth attribute selected then window pops up .
Do this in some other action like if yuo are using table ui element the ON_SELECT action of your dropdown.
Thaks & Regards,
Monishankar C
Hi All
Dump is coming because of iam not select lead selection.
In this both cases..
get all declared attributes
lo_el_segment1->get_static_attributes(
IMPORTING
static_attributes = ls_segment1 ).
lo_nd_segment1->get_attribute(
exporting
name = 'SEGMENT'
importing
value = lv_segment ) .
When i select lad_selection then only value is coming, without lead_selection it is giving dump. and in another case, lead selection is at first row, i am selecting drop down value in second row, but the value is taking at lead selection value only.. Drop down is working only on lad selection?
Thanks,
Kris.
Edited by: kissnas on Feb 3, 2011 6:21 AM
Edited by: kissnas on Feb 3, 2011 6:22 AM
Hi Sarbjeet
Now it is not giving leadselection dump. But lv_Segment contains always index1 value na. I want to compare with this value and open a popuup. If lv_segment value is 4 i want to open a popup.
And one more thing what i observed here is..
If i use ..
get all declared attributes
lo_el_segment1->get_static_attributes(
IMPORTING
static_attributes = ls_segment1 ). and without lead selection.
It is giving Object null value dump.
If first i select lead selection and select any value from dropdown it is working fine. But if i want to select another value in next row, it is taking lead selection value only.
If i use...
lo_nd_segment1->get_attribute(
exporting
name = 'SEGMENT'
importing
value = lv_segment ) .
It is giving LEad_selection dump. and if i select lead any row, it is working, but next time selection taking lead selection value only.
I want to open popup.
if lv_segment = 4.
open_window( ).
endif.
Thanks
Kris.
Edited by: kissnas on Feb 3, 2011 7:05 AM
Edited by: kissnas on Feb 3, 2011 7:10 AM
Hi ,
If you see my first post, i have told you to code the whole thing on onSelect action handler method.
If you do not select any line on the Dropdown then the selection would not happen and you would not get this errors.
In which method are you having this code ?.
It sounds simple and it is simple. You have DDBK, you select a key, check it, based on some value , you display a popup.
There are so many experts helping and posting...somehow there is some misunderstanding going on here.
Hi Sarbjeet,
Sorry if iam confusing u all...
Requirement is : Table with dropdown bye key. I table toolbar Created ADD button, IT creates one row every time.
Drop down contains values like Segment,Nomc,Sumnomc,Part.
If i select Part from dropdown i want to open popup window.
I am filling dropdown in WDDOINIT method.
Method WDDOINIT
DATA : node_info TYPE REF TO if_wd_context_node_info,
value TYPE wdy_key_value,
set TYPE wdy_key_value_table,
k2 type string value '1',
v2 type string value 'Segment',
k3 type string value '2',
v3 type string value 'Nomc',
k4 type string value '3',
v4 type string value 'Sub Nomc',
k5 type string value '4',
v5 type string value 'Part' .
value-key = k2.
value-value = v2.
APPEND value to set.
value-key = k3.
value-value = v3.
APPEND value to set.
value-key = k4.
value-value = v4.
APPEND value to set.
value-key = k5.
value-value = v5.
APPEND value to set.
node_info = wd_context->get_node_info( ).
node_info = node_info->get_child_node( 'SEGMENT1' ).
node_info->set_attribute_value_set( name = 'SEGMENT' value_set = set ).
ADD button code :
DATA lo_nd_segment1 TYPE REF TO if_wd_context_segment1.
DATA lo_el_segment1 TYPE REF TO if_wd_context_element.
DATA ls_segment1 TYPE wd_this->Element_segment1.
data lt_segment1 type wd_this->Elements_segment1.
navigate from <CONTEXT> to <SEGMENT1> via lead selection
lo_nd_segment1 = wd_context->get_child_node( name = wd_this->wdctx_segment1 ).
lo_el_segment1 = lo_nd_segment1->bind_structure( new_item = ls_segment1
set_initial_elements = abap_false ).
Drop down ON_SELECT code :
DATA lo_nd_segment1 TYPE REF TO if_wd_context_node.
DATA lo_el_segment1 TYPE REF TO if_wd_context_element.
DATA ls_segment1 TYPE wd_this->Element_segment1.
DATA lv_segment TYPE wd_this->Element_segment1-segment.
navigate from <CONTEXT> to <SEGMENT1> via lead selection
lo_nd_segment1 = wd_context->get_child_node( name = wd_this->wdctx_segment1 ).
get element via lead selection
lo_el_segment1 = lo_nd_segment1->get_element( ).
get all declared attributes
lo_el_segment1->get_static_attributes(
IMPORTING
static_attributes = ls_segment1 ).
DATA : lv_dropdown type string .
lv_dropdown = ls_segment1-segment.
if lv_dropdown = 4.
popup code here....
endif.
Thanks,
Kris.
Edited by: kissnas on Feb 3, 2011 9:45 AM
Edited by: kissnas on Feb 3, 2011 9:50 AM
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
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.