cancel
Showing results for 
Search instead for 
Did you mean: 

How to get dynamic paramete value in the context node?

Former Member
0 Kudos

Hi, experts,

There are some attributes in the node context(ee_node) that contained the attribute named "ANSSA" in the view(test_view) in the WDA for abap. In the method WDDOMODIFYVIEW of the view(test_view), there is dynamically string , ex."ANSSA". How can I get the value of the "ANSSA" from the node(ee_node)?

I try to use the following code to get the value in the method WDDOMODIFYVIEW of the view(test_view):

Method wddomodifyview.

**********************************

*importing para type string.

************************************

data:

Node_Ee_Address type ref to If_Wd_Context_Node,

Elem_Ee_Address type ref to If_Wd_Context_Element.

  • navigate from <CONTEXT> to <EE_ADDRESS> via lead selection

Node_Ee_Address = wd_Context->get_Child_Node( Name = IF_ADDR_AUTO_DISP_VIEW=>wdctx_Ee_Address ).

  • get element via lead selection

Elem_Ee_Address = Node_Ee_Address->get_Element( ).

  • get single attribute

Elem_Ee_Address->get_Attribute(

exporting

Name = para

importing

Value = ??? ).

  • But I don't know how to replace the "???" .

endmethod

I don't know how to replace the "???" in the method wddomodifyview? Do you give me some hint for it?

You can reply back to me via e-mail if you think we should discuss this internally at tao.wang@besuretech.com or wwangt_92@hotmail.com.

Thanks.

Best regards,

tao

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

hi wang.......

declare an attribute ex: l_ansaa of the same type as 'ANSSA' present in the node. then use this l_ansaa for ?????

**********************************

*importing para type string.

************************************

data:

Node_Ee_Address type ref to If_Wd_Context_Node,

Elem_Ee_Address type ref to If_Wd_Context_Element,

l_ansaa type string.

  • navigate from <CONTEXT> to <EE_ADDRESS> via lead selection

Node_Ee_Address = wd_Context->get_Child_Node( Name = IF_ADDR_AUTO_DISP_VIEW=>wdctx_Ee_Address ).

  • get element via lead selection

Elem_Ee_Address = Node_Ee_Address->get_Element( ).

  • get single attribute

Elem_Ee_Address->get_Attribute(

exporting

Name = para

importing

Value =l_ansaa).

Former Member
0 Kudos

Hi, Justin,

Thank you for your help in advance.

If 'ANSSA' in the node is represented date type or number type, may I use the "l_ansaa type string." ?

The "para" is the parameter that represent the transfered name of the attribute of the node,ex."ANSSA". Actually, I don't know what is transfered from other method, maybe date type or number type.

If 'ANSSA' in the node is represented date type or number type, may I use the "l_ansaa type string." ?

Thanks a million.

Best regards,

tao

Former Member
0 Kudos

Hello Tao,

You need to declare l_ansaa with the same type that you specified while creating the attribute ANSAA in your context structure. A simpler way to achieve this is to declare this as follows -

Suppose ANSAA lies in a node called NODE. Then you can declare a structure and use that to create your local variable.

data ls_node type wd_this->element_node.

data l_ansaa like ls_node-ansaa.

Hope this helps.

Regards,

Neha

Former Member
0 Kudos

Hello Neha,

Thank you for your help in advance.

The "para" is the transfered parameter that it is supposed to represent the name of "ANSSA". Actually, the "para" may represent other attribute in the node context, like date type or number type attribute.

I can't write the code: data l_ansaa like ls_node-ansaa, because I don't know what is represented the "para", and the "para"

may represent the name of "ANSSA", or other attribute, ex.the name of "SUBTY" or "OBJSP" and so on.

Do you give me more hint?

Thanks a million.

Regards,

Neha

Former Member
0 Kudos

Hello Tao,

I am not very sure what confusion you have here. Still I will try to explain. What I understand is that you have a node called EE_NODE and an attribute inside it called ANSSA. You would like to get the value of this attribute in your wddomodifyview. To do so, you need to code as follows -

DATA:

lo_nd_ee_node type ref to if_wd_context_node,

lo_el_ee_node type ref to if_wd_context_element,

ls_ee_node type wd_this->element_ee_node,

lv_anssa like ls_ee_node-anssa.

lo_nd_ee_node = wd_context->get_child_node( name = wd_this->wdctx_ee_node ).

lo_el_ee_node = lo_nd_ee_node->get_element( ).

lo_el_ee_node->get_attribute(

exporting

name = 'ANSSA'

importing

value = lv_anssa ).

And now you have the required value in lv_anssa.

Hope this helps you.

Regards,

Neha

Former Member
0 Kudos

Hello Neha,

Thank you for your help in advance.

I am very sorry that the above method name ought to be "modifyview", not "wddomodifyview"(I write the error word in the question so that I am very sorry.). I am very sorry the error method name occuring your misunderstand.

The "para" is the transfered parameter that it is supposed to represent the name of "ANSSA". Actually, the "para" may represent other attribute in the node context, ex. "ENDDA"(date type) attribute.

I don't write such code in the method modifyview: lv_anssa like ls_ee_node-anssa. Because I am not sure that the "para" represent the name of "ANSSA", and the "para" may represent other attribute in the node context, ex. "ENDDA"(date type) attribute. The "para" is only the transfered parameter from other method for representing the name of attribute.

Method modifyview.

**********************************

*importing para type string.

************************************

DATA:

lo_nd_ee_node type ref to if_wd_context_node,

lo_el_ee_node type ref to if_wd_context_element,

ls_ee_node type wd_this->element_ee_node.

      • I cann't write such code. Because I am not sure that the para represent the name of "ANSSA"******************

data lv_anssa like ls_ee_node-anssa.

****************************************************************************************************************

lo_nd_ee_node = wd_context->get_child_node( name = wd_this->wdctx_ee_node ).

lo_el_ee_node = lo_nd_ee_node->get_element( ).

lo_el_ee_node->get_attribute(

exporting

name = para

importing

value = ??? ).

endmethod.

I don't know how to replace the "???". Do you give me more hints?

Thanks a million.

Regards,

Neha

Former Member
0 Kudos

Hello Tao,

I am not sure how such a thing would work. Maybe you can just declare your l_ANSSA as 'DATA' (a generic type - but you will have to use field symbol in such a case.

You can also take a look at method get_static_attributes_type of interface if_wd_context_node_info if you that can help you.

Regards,

Neha