cancel
Showing results for 
Search instead for 
Did you mean: 

Open popup On Dropdown selection

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Basakaran,

I tried like that but it is not working.

Actually, i am filling dropdown in WDDOINIT method. and i am checking and opening popup on_select event of dropdown. Nothing happen?

I tied with value-key = ' ', and with value_set also. Not working in both cases.

Thanks,

kris.

Former Member
0 Kudos

Can you please post your code onselect event concerning popup

Former Member
0 Kudos

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.

gill367
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Please post where do you get dump ?

Former Member
0 Kudos

Hi

Ya, i checked with drop down value also, it is giving dump at get_attribute( ).

Access via 'NULL' object reference not possible.

Thanks,

Kris.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

gill367
Active Contributor
0 Kudos

Hello

where are you declaring and initialising the element lo_el_segment1 ?

to which node it belongs to?

dump is coming because there is no element here in this variable having the attribute 'NAME'.

describe your overall context strucutre and requirement completely.

thanks

sarbjeet singh

Former Member
0 Kudos

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

gill367
Active Contributor
0 Kudos

lo_nd_segment1->get_attribute(
exporting
name = 'SEGMENT'
index = 1
importing
value = lv_segment ) .

have you tried it like that.

Thanks

sarbjeet singh

Former Member
0 Kudos

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

sahai
Contributor
0 Kudos

hi kisna,

i guess the cardinality of the node has problem....can you tell what is the cardinality of your node?

regards,

sahai.s

Edited by: sahai.s on Feb 3, 2011 7:26 AM

gill367
Active Contributor
0 Kudos

Wow!

Sorry, very confusing i must say.

Could you please elaborate your overall requirement once.

like what you haev in table and what is there in dropdown.

what are context nodes created.

Thanks

sarbjeet singh

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

For getting the particular row element add this code before get static attribute method,

lo_el_segment1 = WDEVENT->GET_CONTEXT_ELEMENT( 'CONTEXT_ELEMENT' ).

Thanks

Ranjith

Former Member
0 Kudos

Thanks Ranjith,

This statement solved problem.

Thanks,

Kris.

Answers (0)