cancel
Showing results for 
Search instead for 
Did you mean: 

ORDER_SAVE-CHECK_BEFORE_SAVE BADI not stopping the process on DO_NOT_SAVE event

former_member197696
Participant
0 Kudos

Hi,

I am trying to implement the custom validation on CRM Sales Order from Web UI to restrict the limited number of orders per customer in a given day and on exceeding the limit order is not allowed to be saved and an error message should be issued.

To achieve this, I have chosen to implement the BADI ORDER_SAVE and method CHECK_BEFORE_SAVE. In case of validation failure I am raising DO_NOT_SAVE event along with adding message using add_message method & setting the flag CV_OWN_MESSAGE as true.

This code is working fine, if I press "Enter" before save action and stopping the process by issuing the error message. In case, if I directly click on "Save" without "Enter" action, order is getting saved successfully along with issuing error message. Ideally, it should issue error message and stop the save action.

It is very strange to see such behavior in SAP CRM 7.0. If any of you encountered the same situation please provide your inputs or please suggest if there is any alternative way to achieve this validation.

Thanks in advance.

Thanks

Kishore

Accepted Solutions (0)

Answers (1)

Answers (1)

naveenkolathuru
Participant
0 Kudos

HI Kishore,

Try raising message using Message of type E.

        cv_own_message = 'X'.

        MESSAGE 'Your message' TYPE 'E' RAISING do_not_save.

Thanks,

Naveen.

former_member197696
Participant
0 Kudos

Hi Naveen,

Thank you for your reply.

We have already tried the same but the problem remains the same.

We are trying all possible solutions for the issue , if you come across any solution do reply to this thread if not closed.

Regards

Kishore

naveenkolathuru
Participant
0 Kudos

Hi Kishore,

Just try by putting only below two lines of code in the CHECK_BEFORE_SAVE

        cv_own_message = 'X'.

        MESSAGE 'Your message' TYPE 'E' RAISING do_not_save.


In my case, order is not saving in case above two lines of code triggers when saving order.


Still you get issues ,then some where in customization you suppress error message when saving order .you need to investigate in that way.



Thanks,

Naveen.