Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8689

Re: Problem in instantiating the class CL_WDR_CONTEXT_ELEMENT

$
0
0

It might help for you to go back to the WebDynpro and ABAP-OO documentation, as there are some important concepts here that you might not grasp completely.

 

You cannot use CREATE OBJECT on CL_WDR_CONTEXT_ELEMENT, because SAP has defined it as "Create Private" meaning that it is not allowed to create an instance of this class directly. This is very common in ABAP-OO as a way to keep custom developers (like us) from creating instances incorrectly. Usually, if you need to work on an instance of one of these classes, there will be a "Factory" method (which creates a new instance from within the class) or a "Getter" method (which returns an instance of the class which already exists).

 

In WebDynpro, you would get the context element from a context node. For example, if your context (which is automatically instantiated in field wd_context in a WD controller) has a node "ELEMENTS" , which has a cardinality to "n", you would call getter method

wd_elements_node = wd_context->get_child_node( 'ELEMENTS' ) 

and this would populate wd_elements_node with the instance for the "ELEMENTS" node. If then you wanted to get the first element in node "ELEMENTS", you would call getter method

wd_element_attr = wd_elements_node->get_element( 1 )

and then you would have your instance of IF_WD_CONTEXT_ELEMENT.

 

I strongly suggest you go back and do some tutorials on WebDynpro (or the SAP Press book Web Dynpro ABAP is excellent), as SAP expects you to do things in a very particular way, and if you don't have a solid understainding of how everything works together, you are going to have a very, very tough tim.


Viewing all articles
Browse latest Browse all 8689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>