cancel
Showing results for 
Search instead for 
Did you mean: 

Setting default value in dropdown UI when navigating between 2 views

Saravanan_SD
Advisor
Advisor
0 Kudos

Hi friends,

I have 2 views. V1 and V2. Each view has one dropdownbyindex UIs having employee id. Both Dropdowns points to same node. i.e I have created a node in component controller and did context mapping with V1 and V2.I am able to populate the data in the dropdowns in wddoinit of component controller.

Another table is available in V1 which hold employee details. On select of a particular employee details (say emp1), I would need to navigate to V2 and set the default value in the dropdown as emp1.

Could you please give me some inputs on how to set the dafault value in this case? i.e dropdown in V2 is already populated, but default value needs to be set. I cant set with the index, since table index is totally different from the dropdowns.

cheers!

Saravanan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I've done it like this.

In the outbound plug I'm passing the value "in your case empl1" then in V2 in the inbound plug I read the table that has all your possibles selections with key "employer_name" = "empl1"

if sy-subrc = 0

lo_nd_your_context->set_lead_selection_index( sy-tabix ) "here your tabix will be the same since you are reading from the table

endif.

hope this help

Jason PV

Saravanan_SD
Advisor
Advisor
0 Kudos

Thank you Jason and Amit.

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

u must have declared ur internal table and work area declarations like this:


*  *internal table declaration
  DATA : itab   TYPE STANDARD TABLE OF ztable .
* work area declaration
  DATA : wa TYPE  ztable .

now simply pass the value emp1 from V1 to V2 and use set_lead_selection_index



  DATA : lv_index type i .

    clear  wa.
  LOOP AT itab INTO wa.
    IF wa-emp_id =  emp1.
      lv_index = sy-tabix.

    ENDIF.
   clear  wa.

  ENDLOOP.
  dyn_node->set_lead_selection_index( lv_index ).

regards,

Amit