cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Catch validation errors in ABAP

Former Member
0 Likes
2,758

Hi,

Description: When we enter data other then what is defined for a UI element, we get an error and are not allowed to proceed ahead till we correct it.

e.g. When we define a context attribute as type Date and suppose enter alphabets we get an error message u201CXYS is not a date format u201C.

In my requirement I have a time field. When time is less than 3 hours 30 mis I display a popup with input field. This popup window has OK and Cancel Button.

Now when I enter a wrong time format say 03:2:00 instead of 03:20:00 .Popup window comes and displays a error message time format invalid.

Problem: The problem is user is not allowed to go back to main screen because of error.

OK and cancel button are not working. I think the reason is these standard error messages had cancel navigation as TRUE.

This is the problem at all places when popup comes and user has enters a wrong data in the screen.

Please guide how to avoid same.

Regards,

Madhvika

Edited by: Madhvika Joshi on May 23, 2011 1:15 AM

View Entire Topic
Former Member
0 Likes

Hi Madhvika,

Popup view is Modal view, so without closing model veiw you can't access main veiw. I Think this is the problem.

Cheers,

Kris.

Former Member
0 Likes

Hi Kris ,

Thanks for your response.

Can youi please guide on solution .

Regards,

Former Member
0 Likes

Hi Madhvika,

As i am right, You are entering time in main view and displaying error message in popup window,

dont display in popup, display error message in main veiw if time goes wrong, if time is correct then only go to popup view.

Cheers,

Kris.

Former Member
0 Likes

Hi Kris,

the check for Time if its a valid format or not is performed by SAP . I have not written that code.

My problem wud be solved if i can catch this error before displaying the popup. Like if time entered in not valid then exit dont proceed with the next code to display popup .

Former Member
0 Likes

HI Madhvika,

You say in one of your posts that you perform the validation in WDDOBEFOREACTION action and raise the pop-up and now you want to skip that part?

Please let us know, what validation you are doing in WDDOBEFOREACTION action?

What validation are you trying to block?..

Thanks,

Aditya.

Former Member
0 Likes

Hi,

Use Message are in your veiw not popup, and check your date format and write your own code,

if condition not satisfy, display error message.

Cheers,

Kris.

Former Member
0 Likes

Hi Kris,

Sorry cudnt understand your message . Can you please help again .

Regards,

Madhvika

Former Member
0 Likes

Hi Aditya,

Popup comes when there is a validation failure that total time is less than 3 hours 30 mins and travel class selected as Business. On any first action code in wdbeforeaction is executed and popup is displayed.

Now problem is user has entered wrong time format and selected business class. Check for entered data if itu2019s valid or not is done by SAP.

Both action display of popup and sap check for invalid data happens at the same tine and thus error message is displayed on popup window.

So no navigation is possible with ok and cancel button that is the problem.

Hope itu2019s clear now

Regards,

Madhvika

Former Member
0 Likes

Hi Madvika,

I am saying that, create your own code to validate your dates, and in condition display your message.

If condition true then only display popup.

Cheers,

Kris.

Former Member
0 Likes

HI Madhvika,

Can you please post the validation code and pop-up raising code?

I tried to replicate a similar sceanrio and it works fine for me..

When the time is in wrong format, SAP error comes in the original view and on top of that pop-up comes,and 'OK' and 'Cancel'

seem to work fine...

Thanks,

Aditya.

gill367
Active Contributor
0 Likes

What kind of pop up you are showing.

wt kind of window is it .

is it a confirmation window or you have created a new window.

and how r you passing the error messg to pop up window.

i tried to generate the same kind of scenario ..

but for me it is not navigating to the pop up window

it is not going anywhere. because as per the webdynpro phase model .

validation of these standard types happens in the second step itself before any other thing.

so it is coming for me.

if you want to suppress that error of standard validation.

you dont want it to come. it can be achieved by making the action validation- independent.

in that case that error itself wont come.

in the action list just select that messg and make it validation independent.

thanks

sarbjeet singh

vineetrrakesh
Explorer
0 Likes

Hi Madhvika,

Your problem is that you can't change SAP code, right? Why don't you write an Overwrite Exit for the standard SAP Method . You can copy the complete code and of SAP and modify the check accordingly.

Regards

Vineet