cancel
Showing results for 
Search instead for 
Did you mean: 

Manipululate dropdownbyindex UI element in webdynpro?

former_member210804
Active Participant
0 Kudos

Hi Sir,

I have a scenario . Here, i m using dropdownbyindex UI element.

In first view i am displaying the educational details( infotype 0022 ) shown below

Once we select the perticular record, and click on change button...it takes to another view as below

Here, the field country key is fetching from the table T005T. So i want all values from that table but it should show the selected record value.

pls guide me

Thanks & regards,

Narasimha

Accepted Solutions (1)

Accepted Solutions (1)

chengalarayulu
Active Contributor
0 Kudos

Narasimha,

data: lv_index type i.

1. Select all countries and store in IT_COUNTRY

     sort IT_COUNTRY by country ascending.

2. Loop at IT_COUNTRY into IS_COUNTRY where country = 'India'.

         **  do nothing.

     Endloop.

3. lv_index = sy-tabix. """ This will contain the index of country "India"

4. Remember, you should bind these sorted list(IT_COUNTRY) to your DropDownByIndex node,

5. lo_nd_dropindx->set_lead_selection_index( index = lv_index ).

6. Now earlier selected country "India" will be shown by default after fetching data.

Test your end. hope understand, revert if any clarifications.

former_member210804
Active Participant
0 Kudos

Thanks Chengalarayulu...  I just followed the below steps

1.  Collect all entries in to lt_country internal table.

2.  Sort in ascending order.

3.  once i click on change button,

     CALL METHOD lo_nd_country->GET_STATIC_ATTRIBUTES_TABLE
   IMPORTING
     TABLE  = lt_country
          .
  CALL METHOD lo_nd_country->GET_LEAD_SELECTION_INDEX
   RECEIVING
     INDEX  = idx

         .

READ TABLE lt_country into ls_country INDEX idx.

CALL METHOD lo_nd_country->SET_LEAD_SELECTION_INDEX
   EXPORTING
     INDEX  = lv_index.
     .

Now is working fine.

Thanks & regards,

Narasimha.


Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Narasimha,

  Can you explain your requirement in detail ??

Regards,

Gaur Mayank

former_member210804
Active Participant
0 Kudos

Hi Gaur,

In my second view , displaying the selected record from the table shown as above.

Here ,the field COUNTRY KEY(Dropdownbyindex UI element)  is displaying only selected record entry i.e;INDIA.

But i want all country list ( from T005T ) under the entry INDIA.

Did u understood my requirement.?

Thanks & regards,

Narasimha.

Former Member
0 Kudos

Dear Narasimha,

    

Create a node 'Country'.

Cardinallity 0.n.

create attribute 'Country_key'.

..

Then in your code( Second view init method.).

Copy and paste the following code

Data Ln_country type ref to if_wd_context_node.

Data lt_country type wd_this->elements_country.

ln_country = wd_context->get_child_node( name = 'COUNTRY' ).

select  * from t005t into corresponding fileds of table lt_country.

ln_country->bind_table( lt_country ).

Now check whether all the countries are available in your drop down.

let me know if it is working.

Regards,
Gaur Mayank

former_member210804
Active Participant
0 Kudos

Hi mayank ,

Whatever u said is right. But i want to show the country_key based on selection of the table in

the first view along with all countries.

Thanks & regards,

Narasimha

Former Member
0 Kudos

Ok,

So you can sort your internal table and can keep the country( Selected one from 1st view) on to the top of table and then you can bind it to node.

Regards,

Gaur Mayank

Former Member
0 Kudos

Hi Narasimha,

Is it working now...

let me know.

Regards,

Gaur Mayank

former_member210804
Active Participant
0 Kudos

Hi Sir,

I m not getting the result. Pls give me solution for this

Thanks & regards,

Narasimha

Former Member
0 Kudos

hello narasimha,

you can sort your table  and can search for the index of the country key = india.

then provide the lead selection for the same index..

and then bind your table to the node.

I thin kit will work for sure..

Regards,

Gaur Mayank