Skip to Content
avatar image
Former Member

What do these statements mean(Newbie Q)

Hi Expert,

when we use the codee wizard to generate a node it gives us some thing like the below code could some one plz explain what that paticular lines mean.

1>>

  • navigate from <CONTEXT> to <ca_i_vendor> via lead selectionl_if_nd_ca_i_vendor = wd_context->get_child_node( name = wd_this->wdctx_ca_i_vendor ).

2>>

elem_context = wd_context->get_element( ).

Appreciate ur Replies.

Kalpana.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Oct 26, 2008 at 06:59 AM

    Hi Kalpana,

    The WebDynpro context is nothing but a hierarchial organization of the component's global data. So you might be having many context nodes & attributes within your context. When you try to get your data from any 1 particular attribute you should make the system first parse through the hierarchy and arrive upon your desired context node. Only then can you be able to access the data from your desired attribute. When you say like in the code fragmnet below:

    l_if_nd_ca_i_vendor = wd_context->get_child_node( name = wd_this->wdctx_ca_i_vendor ).

    you are directing the system to go through the context and return you back the reference of your desired context node i.e, CA_I_VENDOR. You could have even put the same code as:

    l_if_nd_ca_i_vendor = wd_context->get_child_node( name = 'CA_I_VENDOR' ).

    For every node you create in the context of a controller, a constant with the name WDCTX_<node name> is automatically created ( in your case wdctx_ca_i_vendor ) in the corresponding interface IG_<Controller_Name> and IF_<Controller_Name>. In the program source code for the controller, this constant can then be used instead of a string literal. ( CA_I_VENDOR ) The advantage of using constants is that the compiler knows the constant and, therefore, syntax errors are reported if the name of the context node contains typing errors.

    Both IF_WD_CONTEXT_NODE and IF_WD_CONTEXT_ELEMENT contain the GET_ATTRIBUTE method which can be used for obtaining the value of an attribute. You need to use the IF_WD_CONTEXT_ELEMENT's GET_ATTRIBUTE method when you want to try read an attribute value of the Lead Selection Element. Try go through this [link |https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/60730016-dbba-2a10-8f96-9754a865b814]for gaining more insight into how you can work with context nodes and attributes. It will help you very much to gain the basic understanding.

    Regards,

    Uday

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 25, 2008 at 10:20 AM

    Hi kalpana,

    The lines

    navigate from <CONTEXT> to <ca_i_vendor> via lead selection

    Are comments stating whats happening in the code below

    l_if_nd_ca_i_vendor = wd_context->get_child_node( name = wd_this->wdctx_ca_i_vendor ). 
    

    This is a standard feature.

    It helps the developer understand the code generated by wizard.

    I hope i made it clear.

    Please revert back with doubts (if any).

    Regards,

    Sumit Oberoi

    Add comment
    10|10000 characters needed characters exceeded