cancel
Showing results for 
Search instead for 
Did you mean: 

Custom text in dropdowns

Former Member
0 Kudos

Hi,

I'm trying to create a simple form, where user first chooses carrier (CARRID), then one of the flights(FLDATE). My context is as follows:


+ CONTEXT
|--- + CARRIER
     |--- + FLIGHTS
     |    |--- FLDAT
     |    |--- SEATSOCC
     |    |--- SEATSMAX
     |--- CARRID
     |--- CARRNAME

I managed to create a dropdownbyindex that lists carriers by CARRID. Once the user has selected a CARRID, I want another dropdown to list the flights for that carrier. Using a supply function, I understand it would be possible to do so. Can I change the texts so that it displays a custom string? Eg: fldat (seatsocc/seatsmax), instead of just fldat.

I tried using dropdownbykey but can't seem to get it to work.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Can I change the texts so that it displays a custom string? Eg: fldat (seatsocc/seatsmax), instead of just fldat.

Can you explain what is your exact requirement. What is the custom string you want to display.

Regards,

Lekha.

pranav_nagpal2
Contributor
0 Kudos

Hi Jonathan,

you can create an action and you can bind the action with onselect action of drop down.

now there you can get the carrid

data key type string.

  DATA lo_nd_cn_ddkindexctr TYPE REF TO if_wd_context_node.
  DATA lo_el_cn_ddkindexctr TYPE REF TO if_wd_context_element.
  DATA ls_cn_ddkindexctr TYPE wd_this->element_cn_ddkindexctr.
  DATA lv_ca_key LIKE ls_cn_ddkindexctr-ca_key.
* navigate from <CONTEXT> to <CN_DDKINDEXCTR> via lead selection
  lo_nd_cn_ddkindexctr = wd_context->get_child_node( name =
wd_this->wdctx_cn_ddkindexctr ).

* @TODO handle not set lead selection
  IF lo_nd_cn_ddkindexctr IS INITIAL.
  ENDIF.

* get element via lead selection
  lo_el_cn_ddkindexctr = lo_nd_cn_ddkindexctr->get_element(  ).

* @TODO handle not set lead selection
  IF lo_el_cn_ddkindexctr IS INITIAL.
  ENDIF.

  lo_el_cn_ddkindexctr->get_attribute(
    EXPORTING
      name =  `CA_KEY`
    IMPORTING
      value = lv_ca_key ).

key = lv_ca_key.

now you have the carrid in a variable..... now depending on the carrid you can fill the next drop down at run time....

you can change the text by just getting the data you want to fill in drop down in an internal table and there you can change the data and thn you can bind it with the drop down....

regards

Pranav

Former Member
0 Kudos

Hi Jonathan,

You do one thing, For the first dropdown fill the values using a supply function.

In the properties of the dropdown, create an eventhandler for onselect event of the dropdown.

In that event handler, read the node and get the value selected in the Dropdown.

Now buld the second dropdown with values, based on the Selected Carrid.

Bind the built dropdown list of values to the desired node and see the difference.

NOTE: Here the Node and attribute which you want to bind with the second dropdown should be seperately defined. The attribute must be string, which incorporates the concatenatio of FLDAT( SEATSOCC/SEATSMAX ). The cardinality should be 1..n

Hope this is helpful.

Good day!

Regards,

Shashikanth, D