cancel
Showing results for 
Search instead for 
Did you mean: 

Error Message - stop there

Former Member
0 Kudos

Hi All.

I am a newbie. Just started WD4A last week.

I have to give an error message just like in ABAP wherein the flow just stops there and no further statement is executed unless that error is corrected.

I am using the code wizard in WD4A to generate the message handler and then the message. The message does come up, but the flow does not stop there, i.e., further statements are still executed.

I have to manually check everywhere that if error had come, do not proceed.

Is there no automatic way to stop the flow when there is an error?

Thanks in adv.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Aishi,

AS mentioned

cl_wd_dynamic_tool=>check_mandatory_attr_on_view (needs a recent sp)

is useful.

BUT also recall the difference between

MESSAGE_ERROR and MESSAGE_ERROR_WITH_ATTRIBUTE

Straight error continues and error on specific attribute does not navigate away.

This was a deliberate design decision in the framework.

If you consider all the navigation issues, it makes some sense

to have them behave differently. So old MESSAGE Exxx programmers

need to learn new approach. But it is not hard to follow.

Also as pointed out, if you dont wish to execute another line of code..

return statements are useful.

also the rather dramatic RAISE_FATAL... approach has been discontinued.

regards

Phil.

Answers (4)

Answers (4)

former_member209703
Active Contributor
0 Kudos

I've already checked it and i only found the following attributes:

MESSAGE_TEXT

ELEMENT

ATTRIBUTE_NAME

PARAMS

MSG_USER_DATA

IS_PERMANENT

SCOPE_PERMANENT_MSG

MSG_INDEX

int the REPORT_ATTRIBUTE_ERROR_MESSAGE method.

Any idea?

rainer_liebisch
Contributor
0 Kudos

Hi Jose,

hmm, somehow I thought it was ever there, but you're right, it is a problem with the version. After a closer look (I always should do this) I found out that it comes with SP10.

Regards,

Rainer

former_member209703
Active Contributor
0 Kudos

Hi, Rainer. I was looking for the cancel_navigation attribute in the IF_WD_MESSAGE_MANAGER but i couldn't find it.

It could be a problem with the web dynpro version. couldn't it?

Thanks in advance.

rainer_liebisch
Contributor
0 Kudos

Hello Jose,

no, it is not a problem of the version. Have a look at the parameters of the methods there (for example REPORT_ATTRIBUTE_ERROR_MESSAGE). There you will find it.

Regards,

Rainer

rainer_liebisch
Contributor
0 Kudos

Hi Aishi,

the methods of the message manager to report errors have a parameter CANCEL_NAVIGATION, which is by default abap_false (and commented in case you use the wizard). Just set it to abap_true and there will be no navigation.

Regards,

Rainer

Former Member
0 Kudos

Hi,

you can write a statement around the rest of the flow

data lv_error type abap_bool.

lv_error = lo_message_manager->is_empty( ).

if lv_error eq abap_true.

continue, no messages found

endif.

grtz

Koen

Former Member
0 Kudos

Thanks Koen. But that's what I am doing now. But this is not automatic.

I mean, I have to check every place that the message manager is empty or not.

No other way like something for mandatory fields in ABAP i.e. user cannot continue without filling the mandatory field? No other coding is reqd in ABAP in that case?

Thanks again.

Former Member
0 Kudos

Hi,

you can use the return. statement to jump over the rest of the method

grtz

Koen

Former Member
0 Kudos

Hi Aishi,

As I have already asked you to use this code

 data l_view_controller            type ref to if_wd_view_controller.
  l_view_controller = wd_this->wd_get_api( ).
  cl_wd_dynamic_tool=>check_mandatory_attr_on_view( view_controller = l_view_controller ).

It will automatically check and stops the user and it also mark the mandatry field with Red and focuses the same.... just try and let us know.

~Bhawanidutt.