on 03-19-2007 3:13 PM
Hi
I have a situaton in which the context of view have Node in which many subnode is there and the main node also have attribute. For sub node i can directly use bind element and bind value thru field symbol but for Attribute of main node I can get the refernece of attribute but i am not able to set attribute value using field symbols.Is ther any way where i can pass or bind the attribute with value from field symbol.
Regards
Dhiraj
Hi Sasha,
CALL METHOD ELEM_Z_BAPI_PO_SEARCH->SET_ATTRIBUTE
EXPORTING
VALUE = <fs>
NAME = `I_CREATED_BY`.
The Type of VALUE is 'DATA'
and type of Name is 'String'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The Datatype is ERNAM in Context Element.
The procedure through Selection option screen the value will be populated in Range table
In one of the method i will get range table which will be in Type ref data form.
This range table i will assign to Field symbol which is of type Table. Then i am trying to Set attribute of element through this Field Symbol as follow
CALL METHOD ELEM_Z_BAPI_PO_SEARCH->SET_ATTRIBUTE
EXPORTING
VALUE = <fs_rangetab>
NAME = `I_CREATED_BY`.
Regards
Dhiraj
Hi Dhiraj.
Then you have to get the value from the range table first.
You cannot assign a range table to the field ernam. Thats why the system throws
the error.
data: lr_selfield type ref to data.
data: ls_range TYPE rsparams.
field-symbols:
<fs_range> TYPE ANY.
ASSIGN lr_selfield->* TO <fs_rangetable>.
CREATE DATA lr_headerline LIKE LINE OF <fs_rangetable>.
ASSIGN lr_headerline->* TO <fs_range>.
READ TABLE <fs_rangetable> INTO <fs_range> INDEX 1.
MOVE-CORRESPONDING <fs_range> TO ls_range.
CALL METHOD ELEM_Z_BAPI_PO_SEARCH->SET_ATTRIBUTE
EXPORTING
VALUE = ls_range-low
NAME = `I_CREATED_BY`.
But if you need to bind the complete range table you should change to attributes type to the range table type.
Hope thsi helps a bit. Could be that there is a better solution for this.
Cheers,
Sascha
Hi Dhiraj,
Could you please add a piece of coding to demonstrate what you want to do?
Ciao, Regina
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dhiraj,
for every node you select the framework passes a string to your method which contains a path of node (internal use), if you try PATH_GET_ELEMENT method afterwards to get reference of node then you can do whatever you have asked for..
in your action handler add one parameter lc_path and then try using this...
element = wd_context->path_get_element( lc_path ).
navigate from <ENTRIES> to <SUB_ENTRIES> via lead selection
node_sub_entries = element->get_child_node( name = 'SUB_ENTRIES' ).
or even attributes.
thanks
Anuj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dhiraj.
You can use field symbols. Just use the method setAttribue of context element.
This works fine for me.
node_labels = wd_context->get_child_node( name = if_v_orderlist=>wdctx_labels ).
elem_labels = node_labels->get_element( ).
elem_labels->set_attribute(
EXPORTING
name = `ITEM_TABLE_TITLE`
value = <fs> ).
Cheers,
Sascha
field symbols work.
The original field sybol is type any and typed from attribute.
The type info on attribute can be read from if_wd_context_node_info if requried.
regards
Phil.
Sample that works below
method WDDOINIT .
FIELD-SYMBOLS <f1> type any.
DATA:
node_n1 TYPE REF TO if_wd_context_node,
elem_n1 TYPE REF TO if_wd_context_element,
stru_n1 TYPE wd_this->element_n1 ,
item_a1 LIKE stru_n1-a1.
* navigate from <CONTEXT> to <N1> via lead selection
node_n1 = wd_context->get_child_node( name = wd_this->wdctx_n1 ).
* get element via lead selection
elem_n1 = node_n1->get_element( ).
* get single attribute
elem_n1->get_attribute(
EXPORTING
name = `A1`
IMPORTING
value = item_a1 ).
ASSIGN item_a1 to <f1>.
<f1> = 'in she goes'.
elem_n1->set_attribute(
EXPORTING
name = `A1`
value = <F1> ).
endmethod.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.