cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in Handling multiple views

Former Member
0 Kudos

Hi all,

We are working on a web dynpro application where we have created a pop up ALV (list of document numbers) and what we want is that user should be able to select one of the record from that ALV and when he hits a button "SELECT" on our pop up, the pop should close and it should go back to the original window with data pre-populated based on what user selected. So can you please tell us how should we approach to this.

So far we have been able to generate/create the POP Up ALV with the required data but when user selects a record and hit SELECT button we are neither able to read the data for populating the original window and also we are not able to navigate to the original window.

Any suggestion.

Thanks,

Rajat

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Madhu and Thomas thanks for you replies. Your suggestions worked for us and we are now able to get the selected element from the ALV.

Could you also give some inputs to help us pass this selected data from the ALV window to the main window ( window calling this popul ALV).

I tried looking at forum threads but so far have not been able to make any substantial progress in this regards.

Thanks,

Vivek

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Are the dialog window and the main window all in the same component? If so, just use the component controller (which they both have access to) to share or exchange data.

Former Member
0 Kudos

Hi Thomas,

Both the windows/views are part of the same component and i have also mapped the context node of ALV view with component controller context to make data available to all views.( .. thus i am getting the selected entry in all views )

However once the user clicks on the OK button in the popup alv to select the document nr. I need to close the popup window ( this is working) and refresh the main window screen by executing an sql query to select data and update the main window screen.

In case of all views being embedded in the same window i could have used the inbound-outbound plugs to navigate and refresh the main screen. However i am not very sure how this can be achieved the current scenario where two views in two different windows are involved.

Can i use the exit plugs in windows to achhieve this functionality? If yes what inbound plug shold i use for this case.

Thanks,

Vivek

Former Member
0 Kudos

Any Suggestion Please.

Thanks,

Rajat

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>we are neither able to read the data for populating the original window

What exactly aren't you able to do? You should be able to read the selected row in the ALV by requesting the lead selection element from the context node bound to the ALV. Perhaps you could elaborate on what you are having problems with here.

>also we are not able to navigate to the original window.

You can close the dialog window from within the view within the dialog with the following code:

wd_this->wd_get_api( 
         )->get_embedding_window_ctlr(
                  )->get_window( )->close( ).

That syntax is from 7.02 so it uses statement chaining, but the same methods (just with intermediate reference variables) would be used on releases lower than 7.02.

Former Member
0 Kudos

Thanks for the reply Thomas. We have a pop window w_popup and in that we have a view v_view which contains a view container with table view of ALV. The data context of the ALV component is mapped to a context defined in component controller, We have also created mapping between context of component controller and pop view v_view. we have written a select query to retrieve and populate the ALV in wddoinit method of the v_view view.

Here is the code what we have written to retrieve the selected row of ALV:

DATA: lv_node type ref to if_Wd_context_node,
        lv_element type REF TO if_wd_context_element,
        lt_elements like standard table of lv_element,
        lv_node1 type wd_this->elements_doc_numbers,
        lt_node1 like line of lv_node1.

  DATA: view_cont TYPE REF TO if_wd_view_controller,
        window TYPE REF TO if_wd_window_controller.

DATA:  lo_window_manager    Type Ref to if_wd_window_manager,
         lo_api_component     Type Ref to if_wd_component,
         lo_window            Type Ref to if_wd_window.

  view_cont = wd_this->wd_get_api( ).
  window = view_cont->get_embedding_window_ctlr( ).
  lo_window = window->get_window( ).

data: lv_belnr type  VBKPF-BELNR.
* retrieve document nr. selected by user for display in main screen.

lv_node = wd_context->get_child_node('DOC_NUMBERS').
lt_elements = lv_node->get_selected_elements( ).
loop at lt_elements into lv_element.
  lv_element->get_static_attributes(
            importing
             static_attributes = lv_belnr ).

endloop.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

If you have single selection/leadSelection you can't use GET_SELECTED_ELEMENTS. This method is only for when you have multiple selection. Use GET_LEAD_SELECTION instead.

Madhu2004
Active Contributor
0 Kudos

HI,

In the method GET_SELECTED_ELEMENTS use exporting parameter "INCLUDING_LEAD_SELECTION = ABAP_TRUE ".

Default this will be abap_false.

Regards,

Madhu