cancel
Showing results for 
Search instead for 
Did you mean: 

Read action from a different view in the same window

Former Member
0 Kudos

Hi all,

I have a view which contains a ViewContainerUIElement and a ButtonRow. A second view with form fields is embedded in the container of the first view. Validation of the form fields in the second view depends on the button pressed in the first view. How can I determine in the second view, the name of the action that is executed in the initial view?

Thanks and regards,

Patrick

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Thanks for the replies. In the first view i write the appropriate action to an attribute in the context which is mapped in the second view.

Former Member
0 Kudos

hi ,

create context for ur 1st view's ButtonRow and second view's form fields in ur component controller

drag and drop the nodes created, so the similar context nodes wud be created in both the views

a context created in this way would be accessible in both the views

so now u can easily validate ur action in 2nd view , by simply reading the context attributes of ur

button Row

u cn do it by using the code wizard by pressing CNTRL + F7 and selecting the button Read Context NOdes/Attributes

rgds,

amit

Former Member
0 Kudos

Patrick - I answer this question in a previous forum [;

If you used the wizard in order to create the popup the wizard create a button "OK" that I'm guessing you change to "SAVE", you will need to create an EVENT HANDLER under your method list tab in my example my EVENT HANDLER is "SEARCH_RESULT" once the user click the "OK" button it will call SEARH_RESULT event and it will do your code inside the event.


  DATA LO_WINDOW_MANAGER TYPE REF TO IF_WD_WINDOW_MANAGER.
  DATA LO_API_COMPONENT  TYPE REF TO IF_WD_COMPONENT.
  DATA LO_WINDOW         TYPE REF TO IF_WD_WINDOW.
  data LO_VIEW_C         type REF TO if_wd_view_controller.
 
  lo_view_c = WD_this->wd_get_api( ).
 
  LO_API_COMPONENT  = WD_COMP_CONTROLLER->WD_GET_API( ).
  LO_WINDOW_MANAGER = LO_API_COMPONENT->GET_WINDOW_MANAGER( ).
  LO_WINDOW         = LO_WINDOW_MANAGER->CREATE_WINDOW(
                     WINDOW_NAME            = 'SEARCH_POPUP_WIN'
  *                  title                  =
  *                  close_in_any_case      = abap_true
                     MESSAGE_DISPLAY_MODE   = IF_WD_WINDOW=>CO_MSG_DISPLAY_MODE_SELECTED
  *                  close_button           = abap_true
                     BUTTON_KIND            = IF_WD_WINDOW=>CO_BUTTONS_OK
                     MESSAGE_TYPE           = IF_WD_WINDOW=>CO_MSG_TYPE_NONE
                     DEFAULT_BUTTON         = IF_WD_WINDOW=>CO_BUTTON_OK
                     ).
lo_window->subscribe_to_button_event( button = IF_WD_WINDOW=>CO_BUTTON_OK
  action_name = 'SEARCH_RESULT'
  action_view = lo_view_c
  is_default_button = ABAP_true ).
*  lr_popup->open( ).
  LO_WINDOW->OPEN( ).

the subscribe_to_button_event will call the event handler and it will trigger your code inside the event.

Thanks

Jason P-V

Former Member
0 Kudos

Hi

Bind the context to both the view and validate the values in the button click.

Kind Regards,

Mukesh