on 08-29-2008 6:17 AM
hi ,
i am trying to set the text of a text element through coding.For that i am reading the context attribute ( using wizard ) and then stting the value = 'something'. but i am repetedly getting error like " Access via 'NULL' object reference not possible. "
DATA lo_nd_cn_lstmodify TYPE REF TO if_wd_context_node.
DATA lo_el_cn_lstmodify TYPE REF TO if_wd_context_element.
DATA ls_cn_lstmodify TYPE wd_this->element_cn_lstmodify.
DATA lv_ca_userid LIKE ls_cn_lstmodify-ca_userid.
navigate from <CONTEXT> to <CN_LSTMODIFY> via lead selection
lo_nd_cn_lstmodify = wd_context->get_child_node( name = wd_this->wdctx_cn_lstmodify ).
@TODO handle not set lead selection
IF lo_nd_cn_lstmodify IS INITIAL.
ENDIF.
get element via lead selection
lo_el_cn_lstmodify = lo_nd_cn_lstmodify->get_element( ).
@TODO handle not set lead selection
IF lo_el_cn_lstmodify IS INITIAL.
ENDIF.
alternative access via index
lo_el_cn_lstmodify = lo_nd_cn_lstmodify->get_element( index = 1 ).
@TODO handle non existant child
IF lo_el_cn_lstmodify IS INITIAL.
ENDIF.
get single attribute
lo_el_cn_lstmodify->set_attribute(
EXPORTING
name = `CA_USERID`
value = 'hello' ).
the attribute is inside a node cn_lstmodify. please help me out.
HI..
Can you go to ST22 and check where exactly it is giving dump...
Madhu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
'something'. but i am repetedly getting error like " Access via 'NULL' object reference not possible. "
lo_nd_cn_lstmodify = wd_context->get_child_node( name = wd_this->wdctx_cn_lstmodify ).
Put the break point at above line of code and check whether you are getting value into node or not.
or
check the cardinality.
or
lo_nd_cn_lstmodify = wd_context->get_child_node( name = wd_this->wdctx_cn_lstmodify ).
also write like
lo_nd_cn_lstmodify = wd_context->get_child_node( 'NODE NAME' ).
i hopw this will help you
thanks
Suman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
IF lo_el_cn_lstmodify IS INITIAL.
ENDIF.
alternative access via index
lo_el_cn_lstmodify = lo_nd_cn_lstmodify->get_element( index = 1 ).
@TODO handle non existant child
IF lo_el_cn_lstmodify IS INITIAL.
ELSE.
*get single attribute
lo_el_cn_lstmodify->set_attribute(
EXPORTING
name = `CA_USERID`
value = 'hello' ).
ENDIF.
Yogesh N
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check the cardinality of your context node. If it is 0..1 or 0..n it might well contain no elements. In this case method
lo_el_cn_lstmodify = lo_nd_cn_lstmodify->get_element( ).
will deliver null which is correct.
You might need to add an element to this node first:
DATA lr_data_node TYPE REF TO if_wd_context_node.
lr_data_node->bind_structure( ls_data ).
Kind regards, Silke
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.