cancel
Showing results for 
Search instead for 
Did you mean: 

problem when getting attribute value.. pls respnd

Former Member
0 Kudos

Hi friends,

I have a table with one field drop down. I created a node and subnode(for dropdown, and assinged a supplyfunction), and binded the table.

When WDA loads, the data is populating correctly.

When i click ADD new ROW, i am reading the current(row of table) values and storing in a table.

to read dropdown, im using the below code:

node_serv_prod = wd_context->get_child_node( name = wd_this->wdctx_serv_prod ).(main node)

node_prod = node_serv_prod->get_child_node( name = wd_this->wdctx_prod ).(subnode).

node_prod->get_static_attributes(

EXPORTING

index = prev_line

IMPORTING

static_attributes = stru_prod )

WHen the control goes to get_static_attribute, and when i hit F5 in debuggin, it is going to supplyfunction of subnode dropdown. which i dont want. because it is not giving the current row's value of drop down.

Basically i want to read the current row's drop down value, when i click add new row button.

Kindly pls tell me how can i do this.

pls respnd.

thanks in advance.. friends

Niraja.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Niraja

My suggestion is to create separate context node for the material codes. Fill the node using supply function in the component controller. In sales order item table UI create a table column with cell editor as drop down . Bind the data property of Cell editor with the context node created above.

This way you can avoid the call to supply function and read the value selected by the user. More in supply function you can set a flag to check to avoid re-execution on server round trip.

The other way would be to write the code on select event where you can get the value selected and append the same to an internal table along with the item no to which it belongs. During update read the value inside the loop on the main table with reference to the line item.

Regards

Rohit Chowdhary

Former Member
0 Kudos

Hi rohit,

thkx, but how to read the current value???

and even in on select event, can u tell me how to read that dropdown value, wth an ex. plsssssssss

:(((((((((((((

niraja

Former Member
0 Kudos

Nirja,

Once you have created separate note and bound the value property of drop down column for material in Table UI, you need to read the context node which is bound to table UI. You already have the code, as specified in your very first message of this thread.

The problem is the way you are trying to fill the values in the drop down using supply function. System will execute the supply function when ever you try to read the subnode. Values in the material dropdown should be read only once. Therefore it is necessary that you have separate node and not a sub node the under the context node which is bound to table UI. Once you have done that you can follow the following steps to make sure material node is filled only once.

Create an attirbute in the component controller like is_read_material type wdy_boolean.

in the wdoinit method of the component write the following code

If is_read_material = abap_false.

lr_node = wd_context->get_child_node( name = wd_this->wdctx_<node_name> ).

lr_elem_select = lr_node->get_element( ).

if not lr_elem_select is initial.

lr_elem_select->get_static_attributes( importing static_attributes = <structure/table Name> ).

endif.

is_read_material = abap_true.

endif.

Node name and structure name / table should be of the new node created to fill the value with material codes.

Then on select you can write the following code to get the selected value.

lr_node = wd_context->get_child_node( name = wd_this->wdctx_<node_name> ).

lr_elem_select = lr_node->get_element( ).

if not lr_elem_select is initial.

lr_elem_select->get_static_attributes( importing static_attributes = <structure/table Name> ).

endif.

This time context node and structure name should be the main context node bound to table UI.

Hope this helps to you solve the issue.

Regards

Rohit Chowdhary

Former Member
0 Kudos

Thanks Rohit,

what i did is,

node for table, sub node for dropdown.

Basically on Add new row, im not reading the subnode's dropdown value. when user finishes all the entreies of product table, and clicks Save.. at this time..

im getting teh elements of parent node.. looping the parent node,.

and for each element, im getting the subnode, and its dropdown product atribute,

this way im able to get all the products at once.

this for now works.. let me see how it works in QA.

thanks for all ur help.. thank you so much.......

Niraja

Answers (2)

Answers (2)

uday_gubbala2
Active Contributor
0 Kudos

Hi Niraja,

Am not clear as to why you have created a subnode just for populating some values for your dropdown. You could have just created a normal attribute under the same node which you are binding to your table. You could have then typed this attribute with a domain having your desired values as its fixed values or else you could have coded within the WDDOINIT method like something shown below:

data: lr_node_info type ref to if_wd_context_node_info,
        wa_value_set type wdr_context_attr_value,
        lt_value_set type table of wdr_context_attr_value.

  lr_node = wd_context->get_child_node( name = 'NODE' ).
  lr_node_info = lr_node->get_node_info( ).
  wa_value_set-value = '1'.
  wa_value_set-text  = 'One'.
  insert wa_value_set into table lt_value_set.

  wa_value_set-value = '2'.
  wa_value_set-text  = 'Two'.
  insert wa_value_set into table lt_value_set.

  wa_value_set-value = '3'.
  wa_value_set-text  = 'Three'.
  insert wa_value_set into table lt_value_set.

  lr_node_info->set_attribute_value_set( name      = 'TEMP'
                                         value_set = lt_value_set ).

Your control does rightly enter into the supply function. When you are trying to add a new row you are basically trying to add a new blank entry to your internal table which is bound to your table. Now for this dropdown you have bound it to a subnode & this node has a supply function attached to it. You should keep it in mind that the supply function does get automatically triggered when:

1) The node collection is initial.

2) The lead selection in the parent node collection is changed.

3) The node collection is invalidated programmatically.

If you had used the approach of binding your dropdowns to an attribute created directly under the same node which you are using to bind to your table then even any newly added rows would automatically get the set of values populated inside them.

Regards,

Uday

Former Member
0 Kudos

Hi Uday nice to see ur reply,

basically the way u told me i tried, but if i use that, every row's dropdown is getting 'one', 'two, 'three'. I just want one value for earch row's dropdown,

first row's drop down shoul only have 'one', second row's dropdown should only have 'two', and third only have 'three'.

when i try ur approach, i m getting these 3 values in each row's drop down.

can u pls give me a example and tell me the steps.. plssssssssssssss

im trying this since 2 days, but couldnt get solved.....

'kindly respnd and help me to solve this, as this is going a bottleneck for me.

pls provide me some steps or ex,, basically final point to tell u is, my intial dropdown (when page loads).. each row's dropdown should contain only one value,

when i click add new row, the new row's dropdown may contain more values(user can select any value, i need to fetch that, and place it in database)....

thanks all and UDAY,

thanks in advance,

niraja

uday_gubbala2
Active Contributor
0 Kudos

Hi Niraja,

Wasn't aware of your desired functionality until now. Unfortunately my sandbox servers down so am not able to give it a try. Would get back to you as soon as I manage to work over that.

Regards,

Uday

Former Member
0 Kudos

here im explain what i want again,......

I have a table in my WDA, which displays the line items of a Sales order.

In that table the Product number field is a dropdown. Basically Its a sales order change WDA.

When a user clicks sales order number link, my new WDA gets opened with that Sales order data line items in this table.

The current Sales order line items product number is displayed as a dropdown(though it is a dropdown, it will display one product number for each line item. No multiple products for each line item).

The user can add a new line item. So once add new row button is clicked, i will be getting some products(which user can select), so these new products for new line item ,i have to display in the new dropdown field of new row. Here user can select any product.

now if i click save, i want to read this new row's product and save the sales order.

this is what i wanted. kindly pls respond me..

Former Member
0 Kudos

Friends,

could u pls reply me......................

when im trying to read the dropdown value of subnode, the get_static_attribute or create_element method is going into my supplyfunction.

supplyfunction - my code is to fill the dropdown. and due to this supply function triggering,

my get_static_att or create_element is not reruting currenct row dropdown value.

what am i doing wrong.. can u pls pls.. its kindy repsnd me.... . i have spent my whole weekend on this, but couldnt solve this.

plsssssssssssssssssss fnds :(((((

Niraja