on 11-13-2014 12:32 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.