Skip to Content

dropdown list

Hi All,

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


Venkatabharath Voona

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Jun 08, 2011 at 12:50 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member venkata bharath


      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.

      Hope this helps.



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

  • Posted on Jun 09, 2011 at 07:46 AM

    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
            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   .
            ls_selection-low = lv_low .
            CALL METHOD lr_param->set_properties
                is_attributes = ls_selection.
            lv_value_set = abap_true .
          lr_param = lr_iterator->get_next( ).
        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
              iv_attr_name = lv_attr_name
              iv_sign      = 'I'
              iv_option    = 'EQ'
              iv_low       = lv_low.
    * for a proper display of the added / changed attribute.
        lr_search_node = get_dquery_cnode( ).
        lr_search_node->build_parameter_tab( ).
        CALL METHOD super->do_prepare_output
            iv_first_time = abap_false.

    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.



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 24, 2011 at 06:12 AM


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.