cancel
Showing results for 
Search instead for 
Did you mean: 

Passing DATA from one View to another

Former Member
0 Kudos

Hi Gurus,

I am new to web dynpro ABAP, I am trying to pass a data from the text box of one view to the text box of other.

can anyone help me .

Thanks & Regards

Santhosh

Accepted Solutions (1)

Accepted Solutions (1)

amy_king
Active Contributor
0 Kudos

Hi Santhosh,

If you define your context nodes in the component controller and map the nodes to each view as needed, any view may access the context nodes. If instead you define a context node directly in a view, then only that view may access the context node.

Cheers,

Amy

Former Member
0 Kudos

Using plugs also you can pass parameter . In out bound plug you pass parameter value which is your text box variable then in inbound handler method you can read that. Or you can use the method Amy mentioned by declaring in component controller.

Former Member
0 Kudos

Hi Amy & pintu

Thanks for yours reply

I have created a component controller with a NODE -> SAMPLE and an attribute in the node as Query1 and mapped this component controller with the text box present in the 1st view.

Through inbound and outbound plugs , i made a connectivity between two views

In the second view , i mapped the context of the component controller with the context of the second view. And also created a attribute in the second view and through the below method , i assigned the attribute of component controller to the attribute of second view.

   method HANDLENXTPAGE .

  

  DATA lo_el_context TYPE REF TO if_wd_context_element.
  DATA ls_context TYPE wd_this->Element_context.
  DATA lv_query1 TYPE wd_this->Element_context-query1.

* get element via lead selection
  lo_el_context = wd_context->get_element( ).
* @TODO handle not set lead selection
  IF lo_el_context IS INITIAL.
  ENDIF.

* get single attribute
  lo_el_context->get_attribute(
    EXPORTING
      name =  `QUERY1`
    IMPORTING
      value = lv_query1 ).

  wd_context->set_attribute( name = 'TEXT' value = lv_query1 ).

  endmethod.

But still when i enter a data in the first view at run time and go to the second view, the data is not appearing in the text box of second view.

can you people suggest some thing.

Thanks & Regards

Santhosh

amy_king
Active Contributor
0 Kudos

Hi Santhosh,

You can achieve this in different ways, but my approach would be to bind the text boxes of both views to the same context attribute.

  1. In the component controller, create a context node, NODE, and add to it an attribute, TEXT.
  2. In VIEW1, map the component controller's context node NODE to the view's context.
  3. In the layout of VIEW1, bind the text box input field to context attribute VIEW1.NODE.TEXT.
  4. In VIEW2, map the component controller's context node NODE to the view's context.
  5. In the layout of VIEW2, bind the text box input field to context attribute VIEW2.NODE.TEXT.

Now the text box on VIEW1 and the text box on VIEW2 both are bound to the same data source-- the component controller's NODE.TEXT.

Cheers,

Amy

Former Member
0 Kudos

Thanks Amy

its working

Answers (0)