cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdown list is blank for ALV dropdown column?

Former Member
0 Kudos

Hi All,

I am trying to populate the dropdown values for 4 ALV columns.

The code is below for COLUMN1,COLUMN2,COLUMN3 and COLUMN4


n_row_cnt = lo_nd_src_icx_rpt->get_element_count( ).

CLEAR: x_valueset_reason,x_valueset_typ_of_dt,x_valueset_tar,x_valueset_tara.

  DO n_row_cnt  TIMES.                  "IF there are rows in ALV

"Populate Dropdown valuset for each ALV row
    lo_el_src_icx_rpt = lo_nd_src_icx_rpt->get_element( v_index ).

    x_valueset_TAR-value = co_yes.
    x_valueset_TAR-text = co_yes.
    APPEND x_valueset_TAR to i_valueset_TAR.

    x_valueset_TAR-value = co_no.
    x_valueset_TAR-text = co_no.
    APPEND x_valueset_TAR to i_valueset_TAR.

    lo_el_src_icx_rpt->set_attribute(  EXPORTING
    name = 'COLUMN1_LIST'
    value = i_valueset_TAR ).

    x_valueset_TARA-value = co_yes.
    x_valueset_TARA-text = co_yes.
    APPEND x_valueset_TARA to i_valueset_TARA.

    x_valueset_TARA-value = co_no.
    x_valueset_TARA-text = co_no.
    APPEND x_valueset_TARA to i_valueset_TARA.


    lo_el_src_icx_rpt->set_attribute( EXPORTING
      name = 'COLUMN2_LIST'
      value = i_valueset_TARA
    ).

    x_valueset_Reason-value = co_bonus.
    x_valueset_Reason-text = co_bonus.
    APPEND x_valueset_Reason to i_valueset_Reason.

    x_valueset_Reason-value = co_loss.
    x_valueset_Reason-text = co_loss.
    APPEND x_valueset_Reason to i_valueset_Reason.

    x_valueset_Reason-value = co_scrap.
    x_valueset_Reason-text = co_scrap.
    APPEND x_valueset_Reason to i_valueset_Reason.

    x_valueset_Reason-value = co_src_data_err.
    x_valueset_Reason-text = co_src_data_err.
    APPEND x_valueset_Reason to i_valueset_Reason.

    x_valueset_Reason-value = co_othr.
    x_valueset_Reason-text = co_othr.
    APPEND x_valueset_Reason to i_valueset_Reason.

    lo_el_src_icx_rpt->set_attribute( EXPORTING
     name = 'COLUMN3_LIST'
     value = i_valueset_Reason ).

    x_valueset_typ_of_dt-value = co_eoh.
    x_valueset_typ_of_dt-text  = co_eoh.
    APPEND x_valueset_typ_of_dt TO i_valueset_typ_of_dt.

    x_valueset_typ_of_dt-value = co_subcon.
    x_valueset_typ_of_dt-text  = co_subcon.
    APPEND x_valueset_typ_of_dt TO i_valueset_typ_of_dt.

    x_valueset_typ_of_dt-value = co_intransit.
    x_valueset_typ_of_dt-text  = co_intransit.
    APPEND x_valueset_typ_of_dt TO i_valueset_typ_of_dt.

    lo_el_src_icx_rpt->set_attribute( EXPORTING
     name = 'COLUMN4_LIST'
     value = i_valueset_typ_of_dt ).

    CLEAR i_valueset_tar.
    CLEAR i_valueset_tara.
    CLEAR i_valueset_reason.
    CLEAR i_valueset_typ_of_dt.
    CLEAR: x_valueset_reason,x_valueset_typ_of_dt,x_valueset_tar,x_valueset_tara.

    v_index = v_index + 1.

  ENDDO.

Here COLUMN1_LIST, COLUMN2_LIST, COLUMN3_LIST and COLUMN4_LIST are also attributes.

In ALV settins i have done sm thing like this

CREATE OBJECT lr_edit_reason_for_adj

EXPORTING

selected_key_fieldname = 'COLUMN4'.

lr_edit_reason_for_adj->set_valueset_fieldname( 'COLUMN4_LIST' ).

lr_column_reason_for_adj->set_cell_editor( lr_edit_reason_for_adj ).

I am not getting the values in dropdown for COLUMN4.

Please guide.

Regards,

Sumit Oberoi

Accepted Solutions (1)

Accepted Solutions (1)

former_member402443
Contributor
0 Kudos

Hi Sumit,

Please go thru the code below.

In this i am getting the data into a internal table of type wdy_key_value_table and then getting the tables values using the attribute set_attribute_value_set .

  • Data declaration for payment table node info

DATA : lo_nd_payment_table TYPE REF TO if_wd_context_node,

lo_el_payment_table TYPE REF TO if_wd_context_element,

lr_nodeinfo TYPE REF TO if_wd_context_node_info,

ls_payment_table TYPE wd_this->element_payment_table.

  • Data declaration for Internal Table/Workarea

DATA : lt_accountdetail TYPE TABLE OF /dmpui/db_accont_type,

ls_accountdetail TYPE /dmpui/db_accont_type,

ls_value_set TYPE wdy_key_value,

lt_value_set TYPE wdy_key_value_table.

  • Variable declaration

DATA : lv_account TYPE string.

  • Constants declaration

CONSTANTS : c_screen TYPE zdm_screen VALUE 'CONTRACT PAYMENT'.

  • navigate from <CONTEXT> to <PAYMENT_TABLE> via lead selection

lo_nd_payment_table = wd_context->get_child_node( name = wd_this->wdctx_payment_table ).

lr_nodeinfo = lo_nd_payment_table->get_node_info( ).

  • Refreshing the internal table

REFRESH : wd_this->mt_account_info,

lt_accountdetail,

lt_value_set.

  • Calling the BAPI for getting the bank/Country/Account Information

CALL FUNCTION '/DMPUI/DB_BANK_ACCOUNT_INFO'

EXPORTING

iv_proposal = wd_this->lv_proposal

iv_bpnumber = wd_comp_controller->mv_bp_number

iv_medium = im_medium

iv_screen = c_screen

TABLES

et_accountdetail = lt_accountdetail.

LOOP AT lt_accountdetail INTO ls_accountdetail.

  • Concatenating the values into a variable

CONCATENATE ls_accountdetail-bankland

ls_accountdetail-bankkey

ls_accountdetail-acnum_ext

INTO lv_account RESPECTING BLANKS.

ls_value_set-key = lv_account.

ls_value_set-value = lv_account.

    • Inserting the values to a internal table*

INSERT ls_value_set INTO TABLE lt_value_set.

CLEAR ls_value_set.

ENDLOOP.

  • setting the attributes for the value set

lr_nodeinfo->set_attribute_value_set(

EXPORTING

name = `ACCOUNT_NUMBER`

value_set = lt_value_set ).

After this I am configuring the ALV grid

WHEN 'DISBURSEMENT_TYPE'.

  • get header details

lr_col_header = ls_column-r_column->get_header( ).

  • disable DDIC field label

CALL METHOD lr_col_header->set_prop_ddic_binding_field

EXPORTING

property = if_salv_wd_c_ddic_binding=>bind_prop_text

value = if_salv_wd_c_ddic_binding=>ddic_bind_none.

  • set user defined column header

l_header = wd_assist->if_wd_component_assistance~get_text( key = '025' ).

lr_col_header->set_text( l_header ).

CREATE OBJECT lr_drdn_by_key

EXPORTING

selected_key_fieldname = 'DISBURSEMENT_TYPE'.

ls_column-r_column->set_cell_editor( lr_drdn_by_key ).

lr_drdn_by_key->set_key_visible(

EXPORTING

value = abap_true ).

This help u in solving ur problem

Regards

Manoj Kumar

Former Member
0 Kudos

Hi Manoj,

I am using Dropdown by index in ALV.

Can i use your approach in that?

Regards,

Sumit Oberoi

former_member402443
Contributor
0 Kudos

Hi Sumit,

In drop down by idx case there is no need to take that internal of type wdy_key_value_table.

You can directly bind the attributes values.

But My suggestion is better to use drop down by key in place of dropdownbyidx.

It is easy to handle.

Regards

Manoj Kumar

Former Member
0 Kudos

Hi Manoj,

Thanks a lot!

I changed it to Dropdown by Key and my problem is solved.

Regards,

Sumit Oberoi

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sumit,

whats the TYPE for i_valueset_typ_of_dt ??

it shud be of type table of wdr_context_attr_value,

they have KEY & VALUE

so instead of TEXT use VALUE then bind to the attribute at last step within the loop.

Greetings

Prashant

Former Member
0 Kudos

Hi Prashant,

The type of i_valueset_typ_of_dt is wdr_context_attr__value_list

I did not get it what u said below:

they have KEY & VALUE

so instead of TEXT use VALUE then bind to the attribute at last step within the loop.

I am using dropdown by index.

Regards,

Sumit Oberoi