Skip to Content
0
Former Member
Oct 06, 2009 at 07:43 AM

How to validate input field in a popup view

517 Views

Hi Experts,

I am having a problem in validating the input fields on a popup.

I have two windows W_MAIN ( views V_MAIN and V_POPUP ) W_POPUP

in View V_MAIN - i have abutton to show the popup screen V_POPUP in window W_popup.

V_POPUP has two input fields PO and PO item - of which PO is a mandatory field.

code in action of button

  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 L_API             type ref to IF_WD_VIEW_CONTROLLER.

  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            = 'W_POPUP'
                     MESSAGE_DISPLAY_MODE   = IF_WD_WINDOW=>CO_MSG_DISPLAY_MODE_SELECTED
                     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
                     ).

  L_API = WD_THIS->WD_GET_API( ).

  LO_WINDOW->SUBSCRIBE_TO_BUTTON_EVENT(
             BUTTON            = IF_WD_WINDOW=>CO_BUTTON_OK
             ACTION_NAME       = 'OK_INSERT'
             ACTION_VIEW       = L_API
             IS_DEFAULT_BUTTON = ABAP_TRUE ).

  LO_WINDOW->OPEN( ).

i have subscribed to button even on the popup view button OK.

in my action onactionok_insert - i am able to get the input field details, but on this action, i want to validate the mandatory input field PO.

How to do that?

I don't want popup view to close on OK if mandatory input is not filled.

Any clue or inputs is highly appreciated. Thanks

Regards,

Ajay