cancel
Showing results for 
Search instead for 
Did you mean: 

Can i call action_A from action_B of same view by exporting WDEVENT_of_A?

former_member202077
Participant
0 Kudos

Hello

I put a button on my_view of my_wdc, its associated action is my_action_of_button_clicked_hence_open_popup.

In this my_action_of_button_clicked_hence_open_popup am calling a popup (say, my_popup_for_user_input_and_text_view) by using code

wd_this->w_window = lo_window_manager->create_window.

Say, my_popup_for_user_input_and_text_view has 2 input field FIRST NAME and LAST NAME

On my_popup_for_user_input_and_text_view i have assigned an action to standard SAP's OK button, say, its name is my_action_on_popup_on_OK_button_for_z_tbl_update

As we know all these 2 actions are part of my_view

Now, i need to handle the errors, say, for example, user entered FIRST NAME but forgot to enter LAST NAME and clicked the OK button, immediately my_popup_for_user_input_and_text_view will be closed

I want to show the error message on my_popup_for_user_input_and_text_view itself, so, what i did is,

1) i saved the WDEVENT of my_action_of_button_clicked_hence_open_popup. as view's attribute

2) am capturing the user's fault in my_action_on_popup_on_OK_button_for_z_tbl_update

3) if LAST NAME is missing then, am re-opening / re-launching the my_popup_for_user_input_and_text_view by calling the

my_action_of_button_clicked_hence_open_popup action-method by passing saved attribute WDEVENT in the beginning

Pls. let me know is my approach is safe?

Any better approach?

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi MSR,

I think , opening popup again if there is validation erros is not suggested.

You can achieve the same as below

Say button CLICK is on view1 and tow input fields - first name & last name  on view 2.

Solution 1:

  1. You can create buttons on view 2 - OK, CANCEL,
  2. Use WDDOBEFOREACTION( ) method for validation
  3. If no errors on view2, you can close the window GO_WINDOW->CLOSE_WINDOW( ) in action handler

Solution 2

  1. Subscribe the button OK  to the action  on view2
  2. Use WDDOBEFOREACTION( ) method for validation
  3. If no errors on view2, you can close the window GO_WINDOW->CLOSE_WINDOW( ) in action handler

Note:

Set CLOSE_IN_ANY_CASE parameter of method IF_WD_WINDOW_MANAGER~CREATE_WINDOW to ABAP_FALSE as it will not close the window if any errors on view

Hope this helps you.

Regards,

Rama

Answers (1)

Answers (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi MSR,

Please refer to the below document.

http://scn.sap.com/docs/DOC-48869

Regards,

Rama