cancel
Showing results for 
Search instead for 
Did you mean: 

Question about DropDownByIndex and DropDownByKey

Former Member
0 Kudos

I try to use DropDownByIndex or DropDownByKey to input some Data.But for the reason that the number of selections is more than eight ,So I can not use Fix.Val. to record these selections.And I use Value table to record.But the selections in Value table can not be display in the DropDownBy(Index/Key)....How can I make the selections in Value Table be Display in DropDownBy(Index/Key)?Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Please see component <b>WDR_TEST_EVENTS</b>.

See views <b>DropDownByIdx and DropDownByKey .</b>

in my sample application tried DropDownByIdx and I found it easrier .

This is what I did .

1 ) I took drop down box and I associated element of node to it.

2) I wrote this Supply function to fill node

***********************************************************************************************

method fillDropDown1 .

  • implicit available data objects

  • wd_Context type ref to if_wd_context_node.

  • wd_This type ref to if_DropDownByIdx.

data:

lt_attributes type standard table of if_dropdownbyidx=>element_dropdown1,

wa_attributes like line of lt_attributes,

lt_scarr type cl_wd_flight_model=>tt_scarr.

field-symbols:

<scarr> like line of lt_scarr.

cl_wd_flight_model=>get_scarr( importing et_scarr = lt_scarr ).

loop at lt_scarr assigning <scarr>.

wa_attributes-carrid = <scarr>-carrid.

insert wa_attributes into table lt_attributes.

endloop.

node->bind_elements( lt_attributes ).

endmethod.

***********************************************************************************************

Try It ....Hope you have similar need

Cheers

Parry

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Voldemort Xu,

You can use index to read the value table.

I have the sample code where index is used.

This code is used for radiobutton group by index.

You can use same logic in your requirement.

data:

text type string,

element type ref to if_wd_context_element,

index type string.

DATA:

node_check TYPE REF TO if_wd_context_node,

elem_check TYPE REF TO if_wd_context_element,

stru_check TYPE if_start_ior=>element_check ,

item_check_attribute LIKE stru_check-check_attribute.

element = wd_context->get_lead_selection( ).

index = wdevent->get_string( 'INDEX' ).

  • Case when Overhead option is selected

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

node_check = wd_context->get_child_node( name = if_start_ior=>wdctx_check ).

  • get element via lead selection

elem_check = node_check->get_element( ).

  • get single attribute

elem_check->get_attribute(

EXPORTING

name = `CHECK_ATTRIBUTE`

IMPORTING

value = item_check_attribute ).

if index EQ 2.

elem_check->set_attribute( name = 'CHECK_ATTRIBUTE' value = Abap_true ).

endif.

if index EQ 1.

elem_check->set_attribute( name = 'CHECK_ATTRIBUTE' value = Abap_false ).

endif.

Hope this answer will help you.

Cheers,

Darshna.