on 02-16-2009 11:37 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.