on 11-06-2014 8:18 AM
Dear Huang,
And anybody who arrives to this SCN post.
This works very well
I could kiss you buddy, I have been trying to get this working for some time.
Thanks for sharing the correct answer.
Best regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi:
Problem has been resolved
the code:
DATA:
dyn_node TYPE REF TO if_wd_context_node
, node_info TYPE REF TO if_wd_context_node_info
, struct_type TYPE REF TO cl_abap_structdescr
, table_type TYPE REF TO cl_abap_tabledescr
, t_newtable TYPE REF TO data
, t_newline TYPE REF TO data
.
FIELD-SYMBOLS:
<t_data> TYPE STANDARD TABLE,
<fs_data> TYPE any,
<FS_ZCYN> TYPE ANY,
<fs_checkbox> TYPE wdy_boolean.
dyn_node = wd_context->get_child_node( name = 'NEW_NODE' ).
node_info = dyn_node->get_node_info( ).
struct_type = node_info->get_static_attributes_type( ).
table_type = cl_abap_tabledescr=>create( p_line_type = struct_type ).
CREATE DATA t_newtable TYPE HANDLE table_type.
ASSIGN t_newtable->* TO <t_data>.
CREATE DATA t_newline TYPE HANDLE struct_type.
ASSIGN t_newline->* TO <fs_data>.
* ASSIGN COMPONENT 'ATTRIBUTE_NAME' OF STRUCTURE <fs_data> TO <fs_checkbox>.
* dyn_node->get_static_attributes_table( IMPORTING table = <t_data> ).
CALL METHOD dyn_node->get_static_attributes
EXPORTING
INDEX = R_PARAM->INDEX
IMPORTING
STATIC_ATTRIBUTES = <fs_data>.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Huang,
Please follow the below snipped for fetching the static attributes of the clicked row/element.
Data lo_element type ref to if_wd_context_element.
Data lo_node type ref to if_wd_context_node.
Data ls_struc type wd_this->Element_name.
lo_node = wd_context->get_child_node( name = wd_this->wdctx_node_name ).
lo_element = wd_event->get_context_element( name = 'CONTEXT_ELEMENT' ).
lo_node->set_lead_selection( Exporting element = lo_element ).
lo_element->get_static_attributes( importing static_attributes = ls_struc ).
Regards,
Harsha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Huang,
In that scenario you can give ls_struc type as a structure type of the node or a local work area must be declared similar to that of node type.and while accessing node, access it through name instead of path,
Data lo_element type ref to if_wd_context_element.
Data lo_node type ref to if_wd_context_node.
Data ls_struc type local_wa .
lo_node = wd_context->get_child_node( name = 'NODE_NAME'). " Name of the node ,
lo_element = wd_event->get_context_element( name = 'CONTEXT_ELEMENT' ).
lo_node->set_lead_selection( Exporting element = lo_element ).
lo_element->get_static_attributes( importing static_attributes = ls_struc ).
Regards,
Harsha
hi:Harsha
Thank you for your reply!
MY CODE IN the method of on_click:Because node is dynamicl,
ES_RESULT which I do not know how to define?
DATA: LR_NODE TYPE REF TO IF_WD_CONTEXT_NODE.
DATA LO_EL TYPE REF TO IF_WD_CONTEXT_ELEMENT.
LR_NODE = wd_context->get_child_node( name = 'NEW_NODE').
CHECK LR_NODE IS NOT INITIAL.
LO_EL = LO_NODE->GET_ELEMENT( ).
IF LO_EL IS BOUND.
LO_EL->GET_STATIC_ATTRIBUTES(
EXPORTING
index = R_PARAM->index
IMPORTING
STATIC_ATTRIBUTES = ES_RESULT ).
ENDIF.
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.