cancel
Showing results for 
Search instead for 
Did you mean: 

Validation on user input in method WDDOBEFOREACTION

Former Member
0 Kudos

Hi,

I have a row repeater with a checkbox & a text for that checkbox in WD layout. On screen I get 15 checkboxes.

I want to check if user has selected at least one check box when he saves an incident. If not, the system should throw an error message & incident should not be saved. I have added my logic in method WDDOBEFOREACTION of my view.

My logic works fine. If no checkbox is selected, I get an error message but incident gets saved. The processing does not stop after throwing an error message.

Am I writing my logic at the correct place? How can I stop the processing after throwing an error?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Set a flag(ex : wd_comp_controller->mv_error = abap_true) and exit in WDDOBEFOREACTION incase of error.

Check if this flag is set in other methods before processing with the rest of the logic.

This would help not to proceed further with  any of the processing logic if there is an error.

Regards

Manjula

former_member184578
Active Contributor
0 Kudos

Hi,

Write your code to save the incident case in an else condition.

If lv_check = abap_false.

Display error.

else.

save incident.

endif.

Or you can use STOP command to stop if there is an error.

The actual way is Do validations in WDDOBEFOREACTION method and Write the code to save in on Action Save

Hope this helps u.,

Regards,

Kiran

Former Member
0 Kudos

Hi,

Thanks for the reply.

My issue got resolved using method report_fatal_error_message of message manager. I passed abap_true in cancel_navigation parameter.

Now I get the error & processing stops.

Reference: https://scn.sap.com/thread/2066006

Br

Mrunal