cancel
Showing results for 
Search instead for 
Did you mean: 

how to handle exceptions in visual composer

Former Member
0 Kudos

Hello SDN's,

can any one help me to handle exceptions in visual composer?

Scenario: I have a BI datasource with some mandatory parameters, when i am executing the VC application, if i don't enter the mandator parameter it gives popup message saying that, <b>BW nested exception, invalid Input.</b>But instead of that i want to display my own message like, <b>please enter all the mandatory parameters</b> or something like that. what we can do in this case? is this possible in Visual composer?

your help will be rewarded.

Thanks in advance,

Regards,

Sireesha.B

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sireesha,

select the input field of your form in vc. Select "configure" and click on tab "validation". There you can write validation rules. E.g. "contains $" to check whether a $-sign is written or similar.

Complex validation rules can be realiozed by chosing "test" and writing a complex formula of type boolean.

You can also click on the transition line from your form to your bapi and write down a "guard condition". This condition has to be true, to enable the BAPI. E.g. LEN(@field)>1

Best Regards, Benni

Former Member
0 Kudos

Hi Benjamin,

thanks for your reply, can you please give me an example how to display message. please list the steps littlebit clear,if possible.

Regards,

Sireesha.

Former Member
0 Kudos

Hi Sireesha,

example for validations:

You have a field where a number with four digits has to be entered. I.e '657' is incorrect, but '9823' will be fine. Double click on the input field, select tab 'validation', add a condition. Chose 'test', enter BOOL(IF(LEN(@yourinputfield)<4,false,true)). The text to be displayed is "The number has to be four digits long".

This text will automatically be displayed, when somebody enters less than 4 digits.

For other tests, add a label (plain text) to your form. The text to be displayed has to be a formula. In this formula, enter all your conditions. For example IF(LEN(@someinputfield)=0,"The field may not be empty", "").

Thus the label will be displayed, as long as the field "someinputfield" is empty.

Best Regards, Benni

Former Member
0 Kudos

Hi Benni,

Thanks for your reply!

I have added a validation to the input field as you specified, but still it is not showing the error message anywhere. When the validation will check? like at what point of time the validation checks? I want to check a condition at the time of form submitting? how can i achieve that?

Thanks,

Sireesha.

Former Member
0 Kudos

Hi Sireesha,

I am sorry, I forgot one thing. The validation only displays an error message. I.e. as soon as the validation check is true (i.e. some wrong input occurs) a red bubble with the text message you defined appears next to the input field. However, it does not block the submit event.

You either have to disable the submit-button as Marcel said (simply copy the validation check in the field "disabled" of the submit button propoerties). Or you have to copy the validation check to the guard condition.

Best Regards, Benni

Former Member
0 Kudos

Hi Benny,

Now i am able to restrict the submit button like, if they do not enter mandatory parameters the submit button will be disabled. Thanks for that.

But i want to display a pop up message or an error type message saying u need to enter all mandatory values. Is it possible to have an error message along with submit button.

Thanks and Regards,

Sireesha.B

Former Member
0 Kudos

Hi all,

Is it possible to edit the standard exception message it is giving when i try to submit the invalid values.

Please suggest me, all the exceptions whatever is displaying should be edited in a meaningful way.

Your help will be rewarded,

Regards,

Sireesha.B

Former Member
0 Kudos

Hi Sireesha,

you can add a plain text field and enter a formula into the label, e.g. if not all mandatory parameters are entered then should be an error message displayed in the label.

I hope this meets your requirements.

Best Regards,

Marcel

Former Member
0 Kudos

If you want a popup, just draw a second transition line from the form, out to a nested iView. In that nested iView, place a popup that contains the error-message. Place a guard condition on every transition. If all input values are correct, execute the bapi.

If an input value is incorrect, execute the popup.

Simply take the guard condition from your bapi-transition line, copy it to the transition line to the nested iView and place a "not" in front of it.

To my knowledge, you cannot place a guard condition on a popup, directly.

Best Regards, Benni

Answers (2)

Answers (2)

Former Member
0 Kudos

See also:

https://wiki.sdn.sap.com/wiki/display/VC/Norecordsreturnedshalldisplayalternatemessage

Former Member
0 Kudos

Do it like Benni told it. I have only one point:

You can also disable the "submit" button via formula if the user hasn't entered all the mandatory parameters.

Best Regards,

Marcel