cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic context mapping from controller to view

Former Member
0 Kudos

Hi together,

hope anybody has a solution for my problem.

I create a context node during runtime in my WDA controller. I also need this context node in several views of my WDA application.

Is there a method or anything else to map this dynamic created node from my context to the views???

Regards,

Anton

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

i tried several variations of the dynamic context creation and dynamic mapping, but the subnodes of my dynamic context node never mapped with the top node.

Is it required to map every subnode explicit?

Regards,

Anton

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Here is also an eLearning that discusses dynamic context creation and binding:

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/201ddd3b-b4ce-2b10-8883-880ae814...

Former Member
0 Kudos

Hi Guys,

thanks for the answers.

The node from context get mapped to my local context of the view, but the subnodes, a recursive node, is not mapped too.

Here is my coding:


* Build context path
      CONCATENATE 'COMPONENTCONTROLLER.' wa_generated_nodes-node_name INTO lv_path.
      APPEND lv_path TO lt_mapping_path.
      CLEAR: lv_path.

* Build mapping structure
      wa_mapping_info-controller = 'COMPONENTCONTROLLER'.
      wa_mapping_info-path = lt_mapping_path.

      obj_node_info->add_new_mapped_child_node( EXPORTING child_name   = wa_generated_nodes-node_name
                                                          mapping_info = wa_mapping_info ).

Regards,

Anton

former_member230839
Participant
0 Kudos

Hi Anton,

If you want to use the context node in any of the views you need to create the context node at COMPONENT CONTROLLER level, then it will be accessible in any of the views. or in other way as you told you created the context node dynamically in runtime in WDA controller.

Please manitain a componnet controller level attribute DYN_NODE of type ref to IF_WD_CONTEXT_NODE.

So whenever you create any context node in any of the view controlller you can store the reference of that particular context node directly in the component controller level attribute.

then you can access that attribute i mean the context node reference in any of the views by just simply like the following

WD_COMP_CONTROLLER->DYN_NODE.

Regards,

Anil kumar G

uday_gubbala2
Active Contributor
0 Kudos

Hi Anton,

Also check this code snippet which Suman had posted in [here|;.

Regards,

Uday

DATA: lo_nd_purchase_header TYPE REF TO if_wd_context_node,
      lo_el_purchase_header TYPE REF TO if_wd_context_element,
 ls_purchase_header TYPE wd_this->element_purchase_header,
      lo_node_info type ref to if_wd_context_node_info,
      lo_child_node_info type ref to if_wd_context_node_info,
      MAPPING_INFO type WDR_CONTEXT_MAPPING_INFO.
 
* navigate from <CONTEXT> to <PURCHASE_HEADER> via lead selection
  lo_nd_purchase_header = wd_context->get_child_node( name = wd_this->wdctx_purchase_header ).
 
              CALL METHOD LO_ND_PURCHSE_HEADER->GET_NODE_INFO
                RECEIVING
                  NODE_INFO = lo_node_info.
 
       MAPPING_INFO-controller = 'ZWDC_ALV'. "conponent name
       MAPPING_INFO-path = 'PURCHASE_HEADER'. "Controller context node name
       
      CALL METHOD LO_NODE_INFO->ADD_NEW_MAPPED_CHILD_NODE
        EXPORTING
          CHILD_NAME      = 'PURCHASE_HEADER'
          MAPPING_INFO    =  MAPPING_INFO 
*          IS_STATIC       = ABAP_TRUE
        RECEIVING
          CHILD_NODE_INFO = lo_child_node_info.

uday_gubbala2
Active Contributor
0 Kudos

Hi Anton,

Try going through this video:

[Web Dynpro ABAP: Dynamic Context Creation, Mapping, and Data Binding|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/201ddd3b-b4ce-2b10-8883-880ae8147f89]

You can also try go through the standard component DEMODYNAMIC in your SAP system.

Regards

Uday

Former Member
0 Kudos

Hi,

Try using the method ADD_NEW_MAPPED_CHILD_NODE to map context node from controller to view.

After calling this method you have to call method SET_MAPPING_COMPLETE also.

Both are from interface IF_WD_CONTEXT_NODE_INFO.

Hope this helps.

Regards

Manas Dua