cancel
Showing results for 
Search instead for 
Did you mean: 

Want one Data as Default in Drop Down by Index.

Former Member
0 Kudos

Hi Gurus,

I create one Drop Down by Index.

Field with Material Description.

For that I hav Created Context Node Material Description with Cardinality 0..n

My Drop Down is Perfectly Ok

Now I want One Material to Be Default.

Suggest me How to do it !!

Thanks & Regards

PK

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi PK,

Can you try like this within WDDOINIT( ) Method,

DATA lo_nd_material TYPE REF TO if_wd_context_node.

DATA lo_el_material TYPE REF TO if_wd_context_element.

DATA ls_material TYPE wd_this->element_material.

DATA lt_material TYPE wd_this->elements_material.

  • navigate from <CONTEXT> to <MATERIAL> via lead selection

lo_nd_material = wd_context->get_child_node( name = wd_this->wdctx_material ).

  • get element via lead selection

lo_el_material = lo_nd_material->get_element( ).

SELECT maktx FROM makt INTO TABLE lt_material UP TO 10 ROWS.

IF sy-subrc EQ 0.

lo_nd_material->bind_table( lt_material ).

ENDIF.

Thanks and Regards,

Vijay

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Can u try this once,

We can use set_lead_selection_index Method and Pass the index value based up on which default value you want display.

DATA lo_nd_material TYPE REF TO if_wd_context_node.

DATA lo_el_material TYPE REF TO if_wd_context_element.

DATA ls_material TYPE wd_this->element_material.

DATA lt_material TYPE wd_this->elements_material.

  • navigate from <CONTEXT> to <MATERIAL> via lead selection

lo_nd_material = wd_context->get_child_node( name = wd_this->wdctx_material ).

  • get element via lead selection

lo_el_material = lo_nd_material->get_element( ).

SELECT maktx FROM makt INTO TABLE lt_material UP TO 10 ROWS.

IF sy-subrc EQ 0.

lo_nd_material->bind_table( lt_material ).

CALL METHOD lo_nd_material->set_lead_selection_index

EXPORTING

index = 4.

ENDIF.

Thanks and Regards,

Vijay

Former Member
0 Kudos

Thanks For Immidiate response.

I hav already done with this and its running successfully !!!

By this I will get first 10 Material in my Drop Down

And By this The Material on FIrst line of Internal Table will be reflected as Default or When i come to that view as first Material in Drop Down.

But now I want a perticular Material say "000000001" to be display as default or when i visit a Screen on drop down this material shuld be displayed.

This is my problem i m not able to set drop down to default one !!