cancel
Showing results for 
Search instead for 
Did you mean: 

Default selection of dropdown value help in bp search for custom field

Former Member
0 Kudos

Hi guys,

i've problem setting a default selection of the value help. I appended a structure containing a field of type CRMT_BOOLEAN to the crmt_bupa_il_header_search and show it at the bp search page.

The default order of the value help is

[ ] false

[x] true

which means that the first entry (false) is selected by default. I want the second entry to become the default entry. I tried to sort the ddlb_table of this field in the get_v_xxx but this didn't had any effect to the value help.

DATAlt_ddlb TYPE  bsp_wd_dropdown_table,
lr_ddlb TYPE REF TO cl_crm_uiu_ddlb.

lt_ddlb = cl_crm_uiu_bt_tools=>get_strcmp_ddlb(
iv_structure = [structure]
iv_component = [my_zfield])
.
IF NOT lr_ddlb IS BOUND.
CREATE OBJECT lr_ddlb
TYPE
cl_crm_uiu_ddlb
EXPORTING
iv_source_type = 'T'.
ENDIF.

SORT lt_ddlb DESCENDING BY key.

lr_ddlb->set_selection_table( it_selection_table = lt_ddlb ).

rv_valuehelp_descriptor = lr_ddlb.

Is this approach not working at all? After sorting lt_bblb contains the values in correct sequence, the webui is showing the value help as before.

Is it possible to set a selected value in any way?


Thanks and BR,

Sven

Accepted Solutions (1)

Accepted Solutions (1)

former_member210661
Active Contributor
0 Kudos

Hi Sven Wagener,

what i understand is you want to set the default entry is second value right?

if this is your requirement then go for this procedure.

In redefine do_init_context method and fetch the collection in that collection get your field name and value.

make a condition like this if the value = 'first value of your drop down' then set to second value.

this method will execute only in the initial stage means when ever you login into your business role this method will execute.

example:

lr_col ?= me->typed_context->yournode->collection_wrapper->get_current( ).


check lr_col is bound.

lr_col->get_property_as_string( EXPORTING iv_attr_name = 'DROPDONWFIELD' RECEIVING rv_result = lv_dropdownfield ).


if lv_dropdownfield EQ 'FIRSTFIELDKEY'.

lv_dropdownfield = 'SECONDFIELDKEY'.


lr_col->set_property( EXPORTING iv_attr_name = 'DROPDONWFIELD' iv_value = lv_dropdownfield ).


IF this is not your requirement then give me some screen shorts.


Thanks & Regards,

Srinivas.

Former Member
0 Kudos

Hi Srinivas,

thank' a lot for your answer.

unfortunately this does not work since the node type is BuilHeaderAdvancedSearch. I don't have the possibility to set or get the property as described above.

former_member210661
Active Contributor
0 Kudos

Hi Sven Wagener,

check this code in DO_INIT_CONTEXT method.

DATA : lr_current TYPE REF TO cl_crm_bol_dquery_service.

lr_current ?= me->typed_context->urnode->collection_wrapper->get_current( ).

   lr_current->add_selection_param( iv_attr_name = 'urfieldname'

                                 iv_sign      = 'I'

                                 iv_option    = 'EQ'

                                 IV_LOW       = 'X' ).

Thanks & Regards,

Srinivas.

Former Member
0 Kudos

Hi Srinivas,

adding a selection parameter does not add an column at search page.

Also the idea redefining

GET_DQUERY_DEFINITIONS does not work. I already tried this before. I sorted the table as well as removed the entries and added them in the correct sequence, but it doesn't work at all. The value help is shown in same order, first the value with key '' and second with key 'X'. The first entry is selected by default.

Any other ideas?

former_member210661
Active Contributor
0 Kudos

Hi Sven Wagener,

Have you gone through this link check this once..

i haven't get any idea about your requirement. go through the above link this might be help full to you.

in my scenario i had used do_init_context method that works fine but in your case why this is not working i don't know.

any way i need to explore about this and let you know if i got any info.

try to manipulate get_x and set_x method. that might be give expected result.

Thanks & Regards,

Srinivas.

Former Member
0 Kudos

Hi Srinivas,

this link was very helpful and the described solution works fine.

Thanks a lot!

BR

Answers (0)