cancel
Showing results for 
Search instead for 
Did you mean: 

Message handling for incorrect data

Former Member
0 Kudos

Hi Guru's,

In my WebDynPro form, I have one input field. When the user enters a value and click submit, the details are populated in a table based on RFC call.

I want to perform an error handling which will return an error message (via message manager) when the user enters a wrong value and click submit. In other words, if the user leave the field empty or enters a wrong value in te field and click submit, teh error message gets triggered.

How can i do this?

Thanks

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Syed,

Assuming that the value entered in the inputfield is passed as a parameter to the RFC call, In the action method associated with the button write following code.

Say,

inputField context attribute = name

action name = Submit

if(wdThis.wdContext.CurrentContextElement.getname == null)

{

wdComponentAPI.getMessageManager.reportException("<error message>",true);

}

else

{

// call your rfc and execute

// assuming that your rfc return a boolean value as the response for input

// true for correct input anf false for wrong input

if(!result)

{

wdComponentAPI.getMessageManager.reportException("<error message>",true);

}

else

{// navigate to the next view}

}

Hope this helps you

abhijeet_mukkawar
Active Contributor
0 Kudos
former_member189631
Active Contributor
0 Kudos

John Syed,

You can write your own code to vailidate your input values,

and you can call message manager incase of any invalid

inputs then execute your RFC Function call method.

Regards,

Ram.

sid_sunny
Contributor
0 Kudos

Hi Johan,

Refer to this document <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/a%20simple%20input%20form%20with%20message%20and%20error%20service%20support.pdf">Tutorial 3</a>. It discusses about the error handling in detail.

Regards

Sid

Former Member
0 Kudos

You should create your simple type in the webdynpro dictionary. Make that simple type as the type for the context attribute for your inputfield. Now when you click the button, you would be shown the redbox i.e, error.

Error depends on the simple type you created and assigned.

for example if your input field is for Age purpose then you can create a simple type by name 'age' and assign the type as 'integer'. Then change the context attribute of your inputfield's type with your newly created 'age' simple type.

Thanks,

Raags

PS: If useful assign points