cancel
Showing results for 
Search instead for 
Did you mean: 

how to set a attribute value of a sub node binded to a table.. pls respond.

Former Member
0 Kudos
49

Hi friends,

I have context defined like this.

Head_node ( table 1)

Item_node ( table 2, sub node ). ( now this im saving in global internal table).

so now when i hit save button, im passing my internal table (it has col1- sales order no, col2 item details(table type, which can have more than one record) to a FM, to create sales order.

My sales order is getting saved.

But the function module will return some new values (like sales order number, item number etc).

Now i want these values to be updated in my context.

Meaning whenever after that i do get_attribute, i should get these new (sales order no, item no ) also.

I dont know how to set the context values of sub nodes , so im missing these values.

kindly respond back to me..

thanks in advance,

Niraja

View Entire Topic
Former Member
0 Kudos

Its very simple.

Follow these steps. e.g you want to get the new sales order number. Define a attribute in ur node (or set of attributes in ur case as per reqruirement) say new_so_number.

Check your FM, if its returning new_so_number then it's fine, otherwise you have to change the FM to return the new_so_number or you have to get from db table somehow, which best suites your req.

So once you have new_so_number after calling the FM, say in lv_new_so_number field. Then write this code to set the attribute (change the variables as per your context attributes)

DATA lo_nd_head TYPE REF TO if_wd_context_node.
  DATA lo_el_head TYPE REF TO if_wd_context_element.
  DATA ls_head TYPE wd_this->element_head.
  DATA lv_new_so_number LIKE ls_head-new_so_number.
* navigate from <CONTEXT> to <HEAD> via lead selection
  lo_nd_head = wd_context->get_child_node( name = wd_this->wdctx_head ).

* get element via lead selection
  lo_el_head = lo_nd_head->get_element(  ).

lv_new_so_number = new_so_number. " (You got this as a exporting parameter of FM etc..)

* get single attribute
  lo_el_head->set_attribute(
    EXPORTING
      name =  `NEW_SO_NUMBER`
      value = lv_new_so_number ).

Hope it works.

Former Member
0 Kudos

Is it solved or still you are having some issue?

Former Member
0 Kudos

hi WD,

its not solved. Let me tell you what is going on.

basically i have a node item list (table). its a table.1

I have a another node( traige values). it has all drop down and binding to a table2

Now whenever in item list table i select a new record, the below fields has to be changed. for that i assinged the same supply_function to both the nodes. it was working for me. changing whenever i select new row.

Now, when my FM is returing me new values.. i want that to be updates for table2. meaning ex:

table 1 has 2 rows.

when i select row 1, table 2 has 2 rows ... now i need to update these 2 rows under first row of table 1.

that i cant do because table2 is not child node of table 1.

can you suggest me something.. pls..

im totally in worst situation.

thanks in advance Niraja