cancel
Showing results for 
Search instead for 
Did you mean: 

dobeforeaction hook method

Former Member
0 Kudos

HI friends,

I have some input validations in dobeforeaction hook method. In my view I have a save and cancel button, when i click on save it is performing input validations

before saving that's fine but when I click on cancel button it should skip this validations and navigate to next view. Could you please tell me how could I perform this?

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi Veera,

You can do this by getting the action name of clicked button. check the below code.

method WDDOBEFOREACTION .

   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 'SAVE'. " here SAVEis the action name for button Save

       

*        Do code for Validation

       

        When 'CANCLE'. " here CANCLE is the action name for Cancle

        

*         Do nothing.. or clear the fields if required

     endcase.

   endif.

endmethod.

Hope this helps u.,

Revert back incase of further clarifications

Thanks & Regards,

Kiran

Answers (1)

Answers (1)

farooq_basha
Active Participant
0 Kudos

Hi Veera,

Just u create one method copy all ur logic which ther in WDDOBEFOREACTION method and comment it and on action of SAVE call that method.

So that it only check for SAVE action but not for cancel action. By this way u can bypass for CANCEL action.

Regards,

Farooq

Former Member
0 Kudos

Hi farooq,

I want to skip this validations from hook method itself when I click on cancel.

farooq_basha
Active Participant
0 Kudos

Hi Veera,

WDDOBEFOREACTION method always call for the action in VIEW.

Regards,

farooq

Former Member
0 Kudos

yes but my requirement is to navigate to other view when I click on cancel. Can I achieve this by anyway?

Regards,

Veera