cancel
Showing results for 
Search instead for 
Did you mean: 

regarding concrete class that implements interface if_wd_context_node

Former Member
0 Kudos

Hello,

I am new to the webdynpro. i have seen code for accessing the context node using interface if _wd_context_node.

but i am totally confused by seeing the code .As we know that for accessing interface method , concrete class must implement interface . after that by using refrence variable of iterface if_wd_context_node  or concrete class variable we can access the method of interface.

but unfortunately i have not seen any class that implement implement  if _wd_context_node.  one class that implement this interface is abstract class ie

CL_WDC_CONTEXT_node. but all of we know that we can not create the object of abstract class.

So please tell me the concrete class name that implement interface if _wd_context_node. so that i can proceed by coding. urgently

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ashish,

    Yes you are right  for accessing interface method , concrete class must implement interface .

The same is happening in web dynpo also.

Here we use all these from WDA controller referrence & context referrence. I hope u are clear about the concept of controller.

For example whenever u create any view, by default three attribute will be created ( Chek attribute tab).

WD_THIS , WD_CONTEXT ,  WD_COMP_CONTROLLER.

We implement all this interfaces from this referrence actually.

Therefor to access any note code will generate like this :-

  DATA lo_nd_node_1 TYPE REF TO if_wd_context_node.
  DATA lt_node_1 TYPE wd_this->Elements_node_1.

* navigate from <CONTEXT> to <NODE_1> via lead selection
  lo_nd_node_1 = wd_context->get_child_node( name = wd_this->wdctx_node_1 ).

( Therefor you can see the node referrence created from wd_context.)

Double click on this & you will get the declaration the context & methods.

Regards,

Monishankar Chatterjee

Former Member
0 Kudos

Hi,

thanks for your response . but some misconception is  their. firstly wd_this refers to local controller interface but my concern is where is the actaual concrete class which implement the interface or class implicitly works in background.

Answers (1)

Answers (1)

former_member182915
Active Contributor
0 Kudos

hello ashish narayan

To access any component in other component in a application you  need that components usage i.e nothing but reference of that controller .by default  SAP provide the reference of component controller to all controller as  wd_comcontroller.  if want to verify go to attribute tab in view controller & window controller.

scenario-1

for example in component controller (i.e cc) define  a context node with mara node and matnr, ersda, ernam,pstat, mtart  attribute  and create a custom method Fill in method tab

method FILL .

  DATA LO_ND_MARA TYPE REF TO IF_WD_CONTEXT_NODE.

  DATA LT_MARA TYPE WD_THIS->ELEMENTS_MARA.

* navigate from <CONTEXT> to <MARA> via lead selection

  LO_ND_MARA = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_MARA ).

* @TODO handle non existant child

* IF lo_nd_mara IS INITIAL.

* ENDIF.

** @TODO compute values

** e.g. call a model function

select matnr ersda ernam pstat mtart from mara into table it_mara up to 5 rows.

  LO_ND_MARA->BIND_TABLE( NEW_ITEMS = LT_MARA SET_INITIAL_ELEMENTS = ABAP_TRUE ).

endmethod.

after  mapping of context node  between view & component controller by drag & drop

create a table in main view by taking mara node of view controller .

and in the wddoinit () method of view controller call the component controller custom method fill with component controller reference.

as bellow


DATA LO_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER .

  LO_COMPONENTCONTROLLER =   WD_THIS->GET_COMPONENTCONTROLLER_CTR( ).

    LO_COMPONENTCONTROLLER->FILL(

    ).

the above code is system generated.

or simply

  wd_comcontroller->FILL( ).

so after executing the application you get Ur table is filled. i.e is only possible of taking reference of component controller.

hope this note help you.