on 04-19-2011 3:41 PM
Hello everyone,
I am working on a web dynpro application, I have field on the screen "customer number"which I am filing as below:
loop at t_temp into w_temp.
DATA lo_nd_cust_num TYPE REF TO if_wd_context_node.
DATA lo_el_cust_num TYPE REF TO if_wd_context_element.
DATA ls_cust_num TYPE wd_this->element_cust_num.
DATA lv_customer_num TYPE wd_this->element_customer_num-customer_num.
lo_nd_alt_payee = wd_context->get_child_node( name = wd_this->wdctx_cus_num ).
lo_el_customer_num = lo_nd_customer_num->get_element( ).
lo_el_alt_payee->set_attribute(
name = `CUSTOMER_NUMBER`
value = w_temp-num ).
endloop.
T_temp has the following records:
1. 101234
2. 203456
3. 304567
but when I run the application the field "customer number" only shows 304567. I have declared field customer number as a "Dropdownbykey" type.
Can you please tell what am I missing here?
Thank you.
Edited by: goel.rahul2238 on Apr 19, 2011 4:47 PM
Yes it's because you're looping through your table and only the last value is being set.
Instead try to insert your customer numbers into a value set and then use the set attribute value set instead of set attribute.
DATA lo_nd_cust_num_info TYPE REF TO if_wd_context_node_info.
DATA: lt_value_set type table of wdr_context_attr_value.
lo_nd_cust_num_info->set_attribute_value_set( name = 'CUSTOMER_NUMBER
value = lt_value_set ).
Edited by: Josh Dunlap on Apr 19, 2011 4:59 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the reply ... I have modified my code like this:
DATA: lt_value_set type wdr_context_attr_value
loop at t_temp into w_temp.
lt_value_set-value = w_temp-num.
lt_value_set-text = 'Cust Num'.'
DATA lo_nd_cust_num TYPE REF TO if_wd_context_node_info.
DATA lo_el_cust_num TYPE REF TO if_wd_context_element.
DATA ls_cust_num TYPE wd_this->element_cust_num.
DATA lv_customer_num TYPE wd_this->element_customer_num-customer_num.
lo_nd_cust_num= wd_context->get_child_node( name = wd_this->wdctx_cus_num ).
lo_el_customer_num = lo_nd_customer_num->get_element( ).
lo_el_alt_payee->set_attribute_value_set(
name = `CUSTOMER_NUMBER`
value = lt_value_set).
endloop.
I am getting the following error now:
"the result type of function method can't be converted into type LO_ND_ CUST_NUM"
Thank you.
Edited by: goel.rahul2238 on Apr 19, 2011 5:55 PM
Try it like this. You need to use a reference to if_wd_context_node_info for the value set.
DATA: lt_value_set type table of wdr_context_attr_value,
ls_value_set like line of lt_value_set.
DATA lo_nd_cust_num_info TYPE REF TO if_wd_context_node_info.
DATA lo nd_cust_num TYPE REF TO if_wd_context_node.
loop at t_temp into w_temp.
ls_value_set-value = w_temp-num.
ls_value_set-text = 'Cust Num'.'
append ls_value_set to lt_value_set
endloop.
lo_nd_cust_num= wd_context->get_child_node( name = wd_this->wdctx_cus_num )
lo_nd_cust_num_info = lo_nd_cust_num->get_node_info( ).
lo_nd_cust_num_info->set_attribute_value_set(
name = `CUSTOMER_NUMBER`
value = lt_value_set).
You can just change the text to equal the customer number as well as the value. If you want the text to say Cust Num and then the number, just concatenate the two and assign the variable to the ls_value_set-text.
loop at t_temp into w_temp.
ls_value_set-value = w_temp-num.
ls_value_set-text = w_temp-num.
append ls_value_set to lt_value_set
endloop.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.