cancel
Showing results for 
Search instead for 
Did you mean: 

OVS help to set attribute for different node

narendar_naidu
Active Participant
0 Kudos

Hi All,

I am using OVS help for a field in view,and it is binded to an attribute in view context NODE1  .

In The OVS method for this field, i have to do a calculation and set attribute for another node attribute.

WHEN if_wd_ovs=>co_phase_3.
*   apply result

       IF ovs_callback_object->selection IS NOT BOUND.
******** TODO exception handling
       ENDIF.

       ASSIGN ovs_callback_object->selection->* TO <ls_selection>.
       IF <ls_selection> IS ASSIGNED.

         ovs_callback_object->context_element->set_attribute(
                     name  = `TERM_END`
                     value = lv_term_end ).


i get the error and dump


regards,


Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Naren,

As the error message saying that the attribute TERM_END is not available in the context element ovs_callback_object->context_element

Make sure that the attribute TERM_END is available in the same node to which OVS is called. I think you are trying to set the value to other node's attribute.

Otherwise, if you want to set the value lv_term_end to an attribute of other node, proceed as below


data lo_node type ref to if_wd_context_node.

data lo_element type ref to if_wd_context_element.

lo_node_type = wd_context->get_child_node( name = "OTHER_NODE" ).

lo_element = lo_node->get_element( ).

lo_element->set_attribute(

          exporting

               name = 'TERM_END'

               value = lv_term_end ).

Hope this helps you.

Regards,

Rama

            

narendar_naidu
Active Participant
0 Kudos

Hi Ram,

I have tried this, i am able to set the attribute ,but unable to display the value on the browser.

based on tenure im able to get values on to term start date, now the calculated value for term end date

im unable to display.

the first four fields belong to one node and term end date belongs to other node.

regards,

ramakrishnappa
Active Contributor
0 Kudos

Hi Naren,

The logic given in previous reply should work.

How are you setting the value of term end date as suggested by using method lo_element->set_attribute( ).

Could you share the piece of code ?

Regards,

Rama

narendar_naidu
Active Participant
0 Kudos

Hi Ram,

WHEN if_wd_ovs=>co_phase_3.
*   apply result

       IF ovs_callback_object->selection IS NOT BOUND.
******** TODO exception handling
       ENDIF.

       ASSIGN ovs_callback_object->selection->* TO <ls_selection>.
       IF <ls_selection> IS ASSIGNED.
         ovs_callback_object->context_element->set_attribute(
                                name  = `TENOR`
                                value = <ls_selection>-tenor_ll ).
         ovs_callback_object->context_element->set_attribute(
                                name  = `IRATE`
                                value = <ls_selection>-irate ).

Above code for other fields

This code is to set term _end date

DATA lo_nd_create_data TYPE REF TO if_wd_context_node.
         DATA lo_el_create_data TYPE REF TO if_wd_context_element.
         DATA ls_create_data TYPE wd_this->element_create_data.
         DATA lv_term_end TYPE wd_this->element_create_data-term_end.

*   navigate from <CONTEXT> to <CREATE_DATA> via lead selection
         lo_nd_create_data = wd_context->get_child_node( name = wd_this->wdctx_create_data ).

*   get element via lead selection
         lo_el_create_data = lo_nd_create_data->get_element( ).

*   @TODO handle not set lead selection
         IF lo_el_create_data IS INITIAL.
         ENDIF.

*   @TODO fill attribute
         lv_term_end = ls_end_term.

*   set single attribute
         lo_el_create_data->set_attribute(
           name `TERM_END`
           value = lv_term_end ).


*        ovs_callback_object->context_element->set_attribute(
*                    name  = `TERM_END`
*                    value = lv_term_end ).

in debug i can see the enddate value also

regards,

ramakrishnappa
Active Contributor
0 Kudos

Hi Naren,

The code looks fine.

I think, your TERM_END input field is bound to some other attribute by mistake.

Please re-bind the property VALUE to the attribute TERM_END of your node CREATE_DATA.

Hope this helps you.

Regards,

Rama

narendar_naidu
Active Participant
0 Kudos

Hi Ram,

Please Find the binding screen shot,

regards,

ramakrishnappa
Active Contributor
0 Kudos

Hi Naren,

Well, then eveything looks fine.

I suspect that somewhere the value of TERM_END getting re-set may be in WDDOMODIFYVIEW( ) or some other method after OVS call

Please check if anywhere else, the data of CREATE_DATA getting changed?

I think that is clearing the value, whatever you set from OVS.

Hope this helps you in fixing issue this time.. all the best

Hint: try to read the value of term_end in WDDOMODIFYVIEW( ), so that you will come to know, if the value is still existing.

Regards,

Rama

narendar_naidu
Active Participant
0 Kudos

Hi Ram,

issue resolved by creating similat attribute in node 1.

regards,

ramakrishnappa
Active Contributor
0 Kudos

Thats good to hear

Answers (0)