on 11-26-2011 6:23 AM
Hi experts,
I am creating a node dynamically in WDDOINT and creating an input field in WDDOMODIFYVIEW , but am getting an error "attribute not found". Am pasting below my code...
Code in WDDOINT of a view :
data lr_par_node type ref to IF_WD_CONTEXT_NODE_INFO.
data lr_node type ref to IF_WD_CONTEXT_NODE_info.
data lr_node_info1 type ref to IF_WD_CONTEXT_NODE_INFO.
data lr_node1 type ref to IF_WD_CONTEXT_NODE.
data lr_attribute type WDR_CONTEXT_ATTRIBUTE_INFO.
data lt_child_node_map type wdr_context_child_info_map.
*****to get context parent node information
lr_par_node = wd_context->get_node_info( ).
*****to get child node of the parent
lt_child_node_map = lr_par_node->get_child_nodes( ).
*****check for the existence of node
read table lt_child_node_map transporting no fields with table key name = `RESULT`.
if sy-subrc = 0.
" REMOVE_CHILD_NODE
lr_par_node->remove_child_node( `RESULT` ).
endif.
*****inserting new node in context
CALL METHOD lr_par_node->ADD_NEW_CHILD_NODE
EXPORTING
NAME = 'RESULT'
* IS_MANDATORY = ABAP_FALSE
* IS_MANDATORY_SELECTION = ABAP_FALSE
IS_MULTIPLE = ABAP_TRUE
IS_MULTIPLE_SELECTION = ABAP_TRUE
* IS_SINGLETON = ABAP_FALSE
IS_INITIALIZE_LEAD_SELECTION = ABAP_false
* STATIC_ELEMENT_RTTI =
IS_STATIC = ABAP_TRUE
* ATTRIBUTES =
* IS_RANGE_NODE =
RECEIVING
CHILD_NODE_INFO = lr_node.
lr_node1 = wd_context->get_child_node( name = 'RESULT' ).
lr_node_info1 = lr_node1->GET_NODE_INFO( ).
*********Adding attribute
lr_attribute-NAME = 'TEST_GROUP'.
lr_attribute-TYPE_NAME = 'PLNNR'.
lr_attribute-NODE_INFO = lr_node_info1.
CALL METHOD lr_node_info1->ADD_ATTRIBUTE
EXPORTING
ATTRIBUTE_INFO = lr_attribute.
clear lr_attribute.
Code in the WDDOMODIFYVIEW :
method WDDOMODIFYVIEW .
if first_time = abap_true.
data : lt_header_block type zcdp_tt_mfte_header.
lt_header_block = WD_COMP_CONTROLLER->MT_HEADER_BLOCK.
DATA :lr_container TYPE REF TO cl_wd_uielement_container,
lr_input TYPE REF TO cl_wd_input_field,
lr_caption type ref to CL_WD_CAPTION,
lr_column type ref to CL_WD_TABLE_COLUMN,
lr_trans_cont TYPE REF TO CL_WD_TRANSPARENT_CONTAINER.
data lr_lbl type ref to CL_WD_TEXT_VIEW.
******to get root element container
lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lr_trans_cont ?= VIEW->GET_ELEMENT('TRANS_CONT_HEADER_BLOCK').
* Created one transparent container in the view.......
CALL METHOD CL_WD_TEXT_VIEW=>NEW_TEXT_VIEW
EXPORTING
* CONTEXT_MENU_BEHAVIOUR = E_CONTEXT_MENU_BEHAVIOUR-INHERIT
* CONTEXT_MENU_ID =
* DESIGN = E_DESIGN-STANDARD
* ENABLED = 'X'
* H_ALIGN = E_H_ALIGN-AUTO
* ID =
* LAYOUT = E_LAYOUT-NATIVE
* SEMANTIC_COLOR = E_SEMANTIC_COLOR-STANDARD
TEXT = 'TEST'
* TEXT_DIRECTION = E_TEXT_DIRECTION-INHERIT
* TOOLTIP =
* VIEW =
* VISIBLE = E_VISIBLE-VISIBLE
* WIDTH =
* WRAPPING =
RECEIVING
CONTROL = lr_lbl
.
cl_wd_matrix_head_data=>new_matrix_head_data(
element = lr_lbl ).
lr_trans_cont->ADD_CHILD( lr_lbl ).
CALL METHOD CL_WD_INPUT_FIELD=>NEW_INPUT_FIELD
EXPORTING
BIND_VALUE = 'RESULT.TEST_GROUP'
ENABLED = 'X'
* EXPLANATION =
ID = 'ABCD'
RECEIVING
CONTROL = lr_input.
cl_wd_matrix_data=>new_matrix_data(
element = lr_input ).
lr_trans_cont->ADD_CHILD( lr_input ).
endif.
endmethod.
Pls help me in this.....
Thanks
Aisurya.
Issue is resolved by own.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
looking at code it seems that you are adding textview and inputfield. please check in debugging if the correct context node/attribute is being created and you are providing its reference while adding UI elements.
Thanks,
Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.