on 02-09-2014 2:56 AM
Hi Experts,
I am new to webdynpro abap and can anyone please tell me how to hardcode values to a node ?
Thanks in advance.
Regards,
Murali Krishnan.
Hi Murali,
Murali Krishnan wrote:
I am new to webdynpro abap and can anyone please tell me how to hardcode values to a node ?
Do you mean, you need to set the data to context node ? If so, use code wizard as suggested by Mr. Chandra
We can set the data to context attribute/element/node as below
data lo_node type ref to if_wd_context_node.
data lo_element type ref to if_wd_context_element.
data ls_data type wd_this->element_YOUR_NODE_NAME.
data lt_data type wd_this->elements_YOUR_NODE_NAME.
lo_node = wd_context->get_child_node( name = 'YOUR_NODE_NAME').
lo_element = lo_node->get_element( ). " Note: it gets you the element reference based on lead selection
"Set data to a context attribute
lo_element->set_attribute(
exporting
name = 'ATTRIBUTE_NAME'
value = 'MY_VALUE' ).
" Set data to all context attributes of a context element
lo_element->set_static_attributes(
value = ls_data ).
" Set data to context node
lo_node->bind_table(
new_items = lt_data ).
Hope this helps you.
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Murali,
Please find my explanation as below
data lo_node type ref to if_wd_context_node." lo_node is object reference to context node
data lo_element type ref to if_wd_context_element. " lo_element is object reference to context element
data ls_data type wd_this->element_YOUR_NODE_NAME. " ls_data is work area, which contains single instance of your node
data lt_data type wd_this->elements_YOUR_NODE_NAME." lt_data is an internal table, which contains up to 'N" instances
Let us say you have created a context node "TEST_NODE"... then declaration part for work area and internal table is as follows
data ls_data type wd_this->element_TEST_NODE."work area
data lt_data type wd_this->elements_TEST_NODE." internal table
Regards,
Rama
Hi Murali,
Here, context element is an instance of context node.
Please go through the below link for more info on cardinality
Context Node: Properties (SAP Library - Web Dynpro for ABAP)
Hope this helps you in understanding the concept.
Regards,
Rama
Hi Murali,
As a beginner i recommend you to use the below link for reference of Web Dynpro ABAP basic applications.
http://scn.sap.com/docs/DOC-8863
Thanks & Regards,
Sankar Gelivi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Create the node and attribute, lets say node name (demo_node) attribute name (name) type 'string'.
Just use the code wizard by "set context" functionality....
Select the attribute and ok.. Following code will come automatically.
DATA lo_nd_demo_node TYPE REF TO if_wd_context_node.
DATA lo_el_demo_node TYPE REF TO if_wd_context_element.
DATA ls_demo_node TYPE wd_this->element_demo_node.
DATA lv_name TYPE wd_this->element_demo_node-name.
lo_nd_demo_node = wd_context->get_child_node( name = wd_this->wdctx_demo_node ).
lo_el_demo_node = lo_nd_demo_node->get_element( ).
lo_el_demo_node->set_attribute(
name = `NAME`
VALUE = lv_name).
" Now you write your own value in the lv_name before calling set_attribute name...
lv_name = 'Murali'. " Provide the compatible value..
lo_el_demo_node->set_attribute(
name = `NAME`
VALUE = lv_name).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.