cancel
Showing results for 
Search instead for 
Did you mean: 

breaking off an action

Former Member
0 Kudos

Hi,

In WDA I use method WDDOBEFOREACTION. It is a general method that does a lot of checks before the action is carried out. In WDDOBEFOREACTION I first check which action is handled before I do the checks.

My question is: if my validations fail, how can I make sure the action is stopped?

I already tried to disable the action but then it stays disabled so that is no solution.

Regards,

Raymond Does

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

my suggestion would be to create an attribute:

e.g. wd_this->stop_action (type wdy_boolean).

In the WDDOBEFOREACTION method you will have to initially set the attribute to abap_false.

wd_this->stop_action = abap_false.

Now if your own validation returns an error set:

wd_this->stop_action = abap_true.

You will now only have to put a one-liner in each action to check if the stop flag is set.

check wd_this->stop_action = abap_false.

This will effectively break off your action.

Best Regards

Holger

Former Member
0 Kudos

Hi Raymond,

If my understanding is correct means consider this example.

You have one Button UI element and its action name is "Next".

The next action task is call the second view of your application.

In this situation, you want to stop the process based on some validation.

So instead of Domodify view, you can use the corresponding event handler for checking your validations.

Create one temp parameter and append some values to it if your validation is ok.

Then write your code(call the second view) under the condition. Like,

check ur conditions :

-


-


(if it is ok).

flag = 'X'.

If flag is not initial.

"write code for call the second view

endif.

So ur condition satisfied only the button action will call the next view. Other wise it wont call second view even if u click the next button also.

This is a simple example. You can make use of it as per your requirement.

Thanks.

Former Member
0 Kudos

Dear Raymond,

I would like to check some data before a action on my view is carried out, for that reason i have to now, wich action has been pressed.

I already have problems to find out wich action is carried out in WDDOBEFOREACTION. Could you please help me by posting your code sample in WDDOBEFOREACTION ?

Thanks a lot.

Tom

Former Member
0 Kudos

Hi Thomas,

For each and every action carried out in view will triggers the domodify view.

Domodify view is mainly used for refreshing the view.

using debugging you can find which action will triggers the domodify view.

Thanks.

Former Member
0 Kudos

Hi Thomas,

did you find a way to determine the action? If so, could you please post it?

Thanks in advance.

Chris

Former Member
0 Kudos

Hi,

Sorry, didn't notice it was WD ABAP.

Regards,

Satyajit.

Message was edited by: Satyajit Chakraborty

Former Member
0 Kudos

Hi Satyajit,

I am not sure. I think WDDOBEFOREACTION is called automatically when you trigger an action. After the WDDOBEFOREACTION method webdynpro calls the onaction method that was triggered in the first place.

I want to stop webdynpro from entering the onaction methodif my validations in WDDOBEFOREACTION fail.

Regards,

Raymond

Former Member
0 Kudos

Hi Raymond,

From SAP help:

<i><b>WDDOBEFOREACTION</b>

Before an action is triggered, you can perform your own validations using this method. The method can only be used for view controllers. It is used for all visible views of the component assigned to the current phase model instance. These include all embedded components.

<b>Handling of Actions and Events</b>

This step is performed independently from the data transport between data container and context. When an input with errors is found during the validation of the user input, a corresponding error message is displayed and the application developer can correct the data.

In general, there are two different types of event handlers (see detailed graphic of the event handling):

1. Standard event handlers are only called if no errors were found in the user input during the validation. If errors were found, an event handler of this type is skipped without processing and the runtime continues with the next step.

2.Validation-independent event handlers are always called even if errors are found during validation. In this case, the corresponding error messages created during validation are nevertheless displayed.</i>

So your issue is inherently taken care of. Isn't it?

Regards,

Satyajit.

Former Member
0 Kudos

Hi Satyajit,

You are right, however in during the WDDOBEFOREACTION step I present the user a custom error popup. Therefor the application does not receive an system error.

Do you know how to send an error to the application without showing it on screen. That way I should be able to keep my popups while not executing the actions if my validitions fail.

Update:

Just tested to send and error message from WDDOBEFOREACTION but afterwards it still enters the action. I expected that because of the error it would not enter the action anymore.

The event is a Standard event handler (not Validation-independent)

Message was edited by: Raymond Does

Former Member
0 Kudos

Hi Raymond,

You are using report_error_message to raise an error?

Regards,

Satyajit.

Message was edited by: Satyajit Chakraborty

Former Member
0 Kudos

Hi Satyajit,

No, I use report_t100_message or a create_window (for a popup) with message type 'E'.

Regards,

Raymond