cancel
Showing results for 
Search instead for 
Did you mean: 

Validation in before_change method of crm_order_status badi issue

0 Kudos

Hi Experts,

I am doing some validations in Before change method crm_order_status Badi

If validation fails status should not be changed. For that iam raising exception RAISE not_allowed.

But it doesnt work.

Could anybody help in this issue?

Thanks,

Anil

Accepted Solutions (0)

Answers (3)

Answers (3)

frankoverip
Explorer
0 Kudos

Hi,

To my understanding, BEFORE_CHANGE is not intended to validate a status change after the status has been selected by the user. I use BEFORE_CHANGE to filter the list of available status so the user cannot select the status from the list.

If you set a breakpoint in your implementation you will see it is called once per customized status. If you raise exception not_allowed the status is deleted from the list.

Best regards,

Frank

0 Kudos

Hi Frank,

Thanks for your response.

not_allowed exception is not working.

Is there nay way to avoid changing status.

Thanks

Anil

frankoverip
Explorer
0 Kudos

Hi Anil,

The exception works fine, but I guess the Badi doesn't fit to your requirement.

As I said, the system calls BEFORE_CHANGE several times (once per Status) when the list of selectable status is created in the UI - flt_val contains the status checked in the current call. If you raise exception NOT_ALLOWED the status contained in flt_val will be omitted and the next status will be checked.

This allows removing a status from the list under some conditions although it is allowed by the status procedure.

Best regards,

Frank

0 Kudos

Hi,

Is there  any alternative way to avoid status change if certain condition fulfills.

Thanks,
Anil

former_member191572
Contributor
0 Kudos

Hi,

Please elaborate your requirement are business scenario that will be great...

faisal_pc
Active Contributor
0 Kudos

Hi Anil,

Could you please check the following standard implementation CHECK_SOL_PROVIDED(this is inactive). There they are raising the same exception 'NOT_ALLOWED'. Once again, check whether your implementation is active or not.

Thanks,

Faisal

0 Kudos

Thanks Krishnan and  Faisal for responses.

if quote has system error status and user chnages the user status it should not be allowed

Ya.I checked that implementation.

Exception is fine But even after calling that exception quote status is changing to new status.

My question is this exception not restricting the status change.

Thanks,

Anil

former_member191572
Contributor
0 Kudos

Hi,

Check the implemented badi is active are not. If you raise the exception in that method definitely an error message will be thrown and the status will not set.. other wise  check the logic you have written and check the exception is getting raised are not

0 Kudos

Hi,

Anybody faced this kind of issue?

Thanks,

Anil