cancel
Showing results for 
Search instead for 
Did you mean: 

to know the index of multiple elements is selected from the itemlist box

Former Member
0 Kudos

Hi,

I have created a multi select item list box, now based on the multiple index selected i need to set some visibility for the table columns... so, can any one aid me in getting the index of all the elements selected and how to use it... ?

Thanks and Regards

Tenzin

Accepted Solutions (1)

Accepted Solutions (1)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

DATA: LR_RRITM TYPE REF TO IF_WD_CONTEXT_NODE.

DATA: LR_ELEM_RRITM TYPE REF TO IF_WD_CONTEXT_ELEMENT.

DATA: LT_ELEM_RRITM TYPE WDR_CONTEXT_ELEMENT_SET.

DATA: LS_RRITM TYPE IG_COMPONENTCONTROLLER=>ELEMENT_RRITM.

*RRITM is the node name.

LR_RRITM = WD_CONTEXT->GET_CHILD_NODE(

IG_COMPONENTCONTROLLER=>WDCTX_RRITM ).

LT_ELEM_RRITM = LR_RRITM->GET_ELEMENTS( ).

LR_RRITM->GET_STATIC_ATTRIBUTES_TABLE(

IMPORTING TABLE = LT_RRITM ).

LOOP AT LT_ELEM_RRITM INTO LR_ELEM_RRITM.

IF LR_ELEM_RRITM->IS_SELECTED( ) EQ ABAP_TRUE.

LR_ELEM_RRITM->GET_STATIC_ATTRIBUTES(

IMPORTING STATIC_ATTRIBUTES = LS_RRITM ).

        • Selected Element Structure is in LS_RRITM

ENDIF.

Abhi

ENDLOOP.

Former Member
0 Kudos

Hi,

I dont think I need to use ig_componentcontroller as the type.. as I have declared the context in the present view itself and not in the context. I have a node and an attribute which i am populating with some data from database.. now... the issue here is one's i get the selected index in the structure.. how can I use it to set the visibility of the columns of the table.. already I have binded the visibity of each column to different attributes of each wdy_boolean....

If you can give me the code, It will be really useful.

Thanks and Regards

Tenzin

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Yes, you are right instead IG_COmponentcontroller you can use your view's controller interface.

1. get the node reference where the context attribute is there which is binded to visibility property.

2. use set_attribute method to set the context attribute.

for visibility you should not use WDY_BOOLEAN, it is WDUI_VISIBILITY( see the possible values in its Domain Value range )

Abhi

Answers (1)

Answers (1)

former_member402443
Contributor
0 Kudos

Hi Tenzin,

Check this code.

In this I have created a node Airline, within i hv created a attribute - ID.

Second Node SFLIGHT of structure sflight for diaplaying the data in the table.

I am selecting the multiple values of airline Id from the Item List box and based on them I am displaying the data in the table on action ON_DISPLAY

METHOD onactionon_display .

  • Data Declaration

DATA lo_nd_airline TYPE REF TO if_wd_context_node.

DATA lo_el_airline TYPE REF TO if_wd_context_element.

DATA lt_elements TYPE wdr_context_element_set.

DATA ls_airline TYPE wd_this->element_airline.

DATA it_type TYPE wd_this->elements_airline.

DATA lv_id LIKE ls_airline-id.

DATA lo_nd_sflight TYPE REF TO if_wd_context_node.

DATA lo_el_sflight TYPE REF TO if_wd_context_element.

DATA lt_sflight TYPE wd_this->elements_sflight.

DATA lt_sflight2 TYPE wd_this->elements_sflight.

DATA ls_sflight TYPE wd_this->element_sflight.

    • navigate from <CONTEXT> to <AIRLINE> via lead selection*

lo_nd_airline = wd_context->get_child_node( name = wd_this->wdctx_airline ).

lt_elements = lo_nd_airline->get_selected_elements( ).

LOOP AT lt_elements INTO lo_el_airline.

lo_el_airline->get_static_attributes( IMPORTING static_attributes = ls_airline ).

APPEND ls_airline TO it_type.

ENDLOOP. " LOOP AT lt_elements

lo_nd_sflight = wd_context->get_child_node( name = wd_this->wdctx_sflight ).

SELECT carrid

connid

fldate

currency

planetype

FROM sflight

INTO TABLE lt_sflight.

LOOP AT it_type INTO ls_airline.

LOOP AT lt_sflight INTO ls_sflight WHERE carrid = ls_airline-id.

APPEND ls_sflight TO lt_sflight2.

ENDLOOP. " LOOP AT lt_sflight

ENDLOOP. " LOOP AT it_type

  • Bind Internal table with Table Element

lo_nd_sflight->bind_table( lt_sflight2 ).

ENDMETHOD.

Regard

Manoj Kumar