cancel
Showing results for 
Search instead for 
Did you mean: 

Error thrown in ORDER_SAVE is shown while editing complaint.

Former Member
0 Kudos


Hi,

I am coding in the badi ORDER_SAVE so that the reason field is not left blank. If the reason field is blank I am populating a message and throwing the exception DO_NOT_SAVE.

This process is working fine but the problem is, when I open a complaint and click on change, this same error is again being thrown even when the reason field is not blank and it is allowing user to save.

The badi ORDER_SAVE is not being called on change event of a complaint, so how am I still getting the error on just clicking on change button.

Regards,

Shahrukh

Accepted Solutions (0)

Answers (2)

Answers (2)

atulJaiswal
Participant
0 Kudos

Hi Shahrukh,

In Order_save BAdi, You should use method CHECK_BEFORE_SAVE for your validation.

Also you need to check if you are adding error message properly. Might be error message is not raised properly.

Sample code would be as below:

If " your field is blank

lr_msg_srv = cl_bsp_wd_message_service=>get_instance( ).

  CALL METHOD lr_msg_srv->add_message

    EXPORTING

    iv_msg_type   = 'E'"

    iv_msg_id     = lc_msgid " Your message class

    iv_msg_number = lc_message  " Your error message

   iv_msg_level  = '1'.

RAISE do_not_save .

Let us know if you still face the issue.

Regards,

Atul

Former Member
0 Kudos

Hi Atul,

I have coded in the method CHECK_BEFORE_SAVE itself.

Below is my code for message and exception:



    clear lr_msg_srv.

    lr_msg_srv = cl_bsp_wd_message_service=>get_instance( ).

    lr_msg_srv->ADD_MESSAGE( IV_MSG_TYPE = 'E'

                                       IV_MSG_ID = 'ZMANDATORY'

                                       IV_MSG_NUMBER = '000'

                                       IV_MSG_V1 = 'Error msg' ).

    cv_own_message = sy-abcde+23(1).





    RAISE DO_NOT_SAVE.


Former Member
0 Kudos

Hello Shahrukh,

Maybe you have to delete this error message again at a proper position and raise it again if needed.

Best regards,

Thomas Wagner

Former Member
0 Kudos

Hi Thomas,

I can delete the messages in badi, but the problem is that this badi ORDER_SAVE is not getting called on clicking the change button of a complaint. And that is when it is showing my message.

Regards,

Shahrukh