cancel
Showing results for 
Search instead for 
Did you mean: 

dropdown list

venkata_bharath
Participant
0 Kudos

Hi All,

How to provide the default value for the dropdown list and it is a standard component , standard view and standard field.

Regards,

Venkatabharath Voona

Accepted Solutions (1)

Accepted Solutions (1)

former_member191572
Contributor
0 Kudos

HI Venkat,

For that u need to enhance ur view and then enhance the context node and redefine the particular atrribute get method.

In the get_method pass the default value in to the field VALUE.

To get the atrribute details in the UI select the field and press F2.

venkata_bharath
Participant
0 Kudos

HI,

In the get_method pass the default value into the field VALUE. In the get method what code i shoud i write?

Former Member
0 Kudos

Hi,

In the Get_V method of your attribute fill the values in the ddlb table as shown below

Data:lt_ddlb type bsp_wd_dropdown_table,
        lr_ddlb type REF TO cl_crm_uiu_ddlb.

      ls_ddlb-key = ' 1'.
      ls_ddlb-value = 'X '.
      APPEND ls_ddlb TO lt_ddlb.

      ls_ddlb-key = '2 '.
      ls_ddlb-value = ' Y'.
      APPEND ls_ddlb TO lt_ddlb.

lr_ddlb->set_selection_table( lt_ddlb ).

    rv_valuehelp_descriptor = lr_ddlb.

In the Get_P method of the attribute place the below code for deop down

CASE iv_property.
    WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
      rv_value = cl_bsp_dlc_view_descriptor=>field_type_picklist.
  ENDCASE.

Hope this helps.

Regards,

Lakshmi.Y

Edited by: Lakshmi Soujanya on Jun 9, 2011 7:22 AM

Answers (2)

Answers (2)

venkata_bharath
Participant
0 Kudos

ansrd

former_member193352
Active Contributor
0 Kudos

Hello Venkat,

If its a Search Object, you can do so by redefining the DO_PREPARE_OUTPUT method by checking the condition IV_FIRST_TIME = 'X' and defaulting the value of the search attribute here.

Below is the sample code:



  DATA: lr_entity TYPE REF TO cl_crm_bol_entity.
  DATA: lr_query_service TYPE REF TO cl_crm_bol_query_service.
  DATA: ls_qs TYPE  crms_query_knoart_btil.
  DATA: lr_qs TYPE REF TO cl_crm_bol_dquery_service.
  DATA: lr_col TYPE REF TO if_bol_bo_col,
        lr_ent TYPE REF TO if_bol_bo_property_access,
        lr_search_node TYPE REF TO cl_bsp_wd_context_node_asp,
        lr_iterator  TYPE REF TO if_bol_bo_col_iterator ,
        lr_param     TYPE REF TO if_bol_bo_property_access,
        ls_selection TYPE genilt_selection_parameter,
        lv_attr_name TYPE name_komp ,
        lv_attr TYPE string,
        lv_low       TYPE string,
        lv_value_set TYPE abap_bool .

  IF iv_first_time =  'X'.

    CALL METHOD super->do_prepare_output
      EXPORTING
        iv_first_time = abap_false.

* Set default status 
    lv_attr_name  = 'STATUS'.
    lv_low        = 'Z....'.

* fetch the search node and its content.
    lr_qs = me->get_current_dquery( ).
    lr_col = lr_qs->get_selection_params( ).

* check the currently visible search attributes.
    lr_iterator = lr_col->get_iterator( ).
    lr_param    = lr_iterator->get_first( ).

    WHILE lr_param IS BOUND.
*           get the parameters
      lr_param->get_properties( IMPORTING es_attributes = ls_selection ).
      IF ls_selection-attr_name = lv_attr_name   .
* SET_PROPERTIES
        ls_selection-low = lv_low .
        CALL METHOD lr_param->set_properties
          EXPORTING
            is_attributes = ls_selection.
        lv_value_set = abap_true .
        EXIT.
      ENDIF.
      lr_param = lr_iterator->get_next( ).
    ENDWHILE.

    IF lv_value_set EQ abap_false .
* it was not part of the visible attributes, then add it at the end.
      CALL METHOD lr_qs->add_selection_param
        EXPORTING
          iv_attr_name = lv_attr_name
          iv_sign      = 'I'
          iv_option    = 'EQ'
          iv_low       = lv_low.
    ENDIF.

* for a proper display of the added / changed attribute.
    lr_search_node = get_dquery_cnode( ).
    lr_search_node->build_parameter_tab( ).

  ELSE.

    CALL METHOD super->do_prepare_output
      EXPORTING
        iv_first_time = abap_false.

  ENDIF.

Above is the sample code to default the value of a search attribute in a Search Page of a Knowledge Article.

Even If its another BOL Object such as a BP Header View or Some Business Transaction View , you can still redefine the DO_PREPARE_OUTPUT method by checking the condition IV_FIRST_TIME = 'X'.

Also, make sure that the user is creating this BP/transaction for the first time. You can do so by comparing the GUID at BOL runtime instance with the database.

I hope this helps.

Thanks

Vishal