cancel
Showing results for 
Search instead for 
Did you mean: 

How to know what action user launched?

gilberto_parga
Participant
0 Kudos

Hello guys.

In a view i have method WDDOBEFOREACTION, which I can use to set an error message. But I only wanna display an error message depending on the button user pressed in that view (there are many buttons). How can I know it? Could you bring me an example code? Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi ,

there is a property OnAction of your Button UI ..

u may be having many buttons in your view , so click on that property , and make a action for every button .

Suppose u have 2 buttons , SUBMIT and UPLOAD , so make a action for the two buttons , suppose u make the actions SUBMIT and UPLOAD ..

so now u raise ur error messages in the OnActionSubmit and OnActionUpload methods ..

so now u wud raise messages on click of the Specific Button ..

hope u have got the point , cheers:)

regards,

amit

Answers (3)

Answers (3)

gilberto_parga
Participant
0 Kudos

On the basis of action names, I was able to set my functionality but using the user-exits buttons that allow to implement my desired functionality. Thank you guys

Former Member
0 Kudos

Hi

By default WDDOBEFOREACTION has following code written and commented.

*  data lo_api_controller type ref to if_wd_view_controller.
*  data lo_action         type ref to if_wd_action.

*  lo_api_controller = wd_this->wd_get_api( ).
*  lo_action = lo_api_controller->get_current_action( ).

*  if lo_action is bound.
*    case lo_action->name.
*      when '...'.

*    endcase.
*  endif.

You can just uncomment the code and do your validation based on the parameter lo_action->name.

Hope this helps.

Regards

Manas Dua

Former Member
0 Kudos

Hi Gilberto,

Instead of putting everything in WDDOBEFOREACTION, try making a custom action for the button. Select the button in your Layout and populate the onAction Event from the Properties.

-Scott