‎2008 Apr 28 4:23 PM
Hello All,
I need some help here in this BAdi to validate a field and issue an error message. Documentation clearly says that you can check header and item fields and issue error messages. But I couldn't get this done as I wanted...
I tried all these...
MESSAGE w006(ZFI_MESSAGES) WITH 'ERROR' DISPLAY LIKE 'E' RAISING error.
**********************************************************************
MESSAGE s006(ZFI_MESSAGES) WITH 'ERROR' DISPLAY LIKE 'E' RAISING error.
**********************************************************************
MESSAGE e006(ZFI_MESSAGES) WITH 'ERROR' RAISING error.
MESSAGE e006(ZFI_MESSAGES).
**********************************************************************
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'test pop up'
text_question = 'test miro: pls enter material group'
text_button_1 = 'YES'
text_button_2 = 'NO'
IMPORTING
answer = lv_answer.
IF lv_answer EQ 2.
EXIT.
ENDIF.
Message Type 'E' is locking the screen, that makes sense, but is there any other way to make this work?
What is the use of EXCEPTION 'ERROR'?. How do I make use of it? Do I need to create another exception class and use it here? Please somebody help me.
Thanks,
Shekar
‎2008 Apr 28 4:31 PM
You can raise the unsuccesful check in the BADI implmentation like:
IF SY-SUBRC EQ 0.
RAISE ERROR.
ENDIF.
Regards,
Naimesh Patel
‎2008 Apr 28 4:45 PM
Thaks Naimesh, but I guess I tried that and that is creating a short dump. any other ideas???
Shekar
‎2008 Apr 28 4:51 PM
Ok.. Try setting the SY-SUBRC = 1 when your check fails.
Regards,
Naimesh Patel
‎2008 Jun 24 10:40 AM
Hi, I have the same problem.
When my validation is incorrect enter the values of my message in the system variables, and execute "raise error". That shows the message I want. But the implementation of the error fires again header_check and there is an infinite loop.
How returning control to MIRO for the user to correct the error?
Thanks and greetings
‎2013 Jul 09 8:58 AM
Hi
In my situation I use only MRM_PROT_FILL FM to add messages.
METHOD if_ex_mrm_header_check~headerdata_check.
DATA: lt_errprot type mrm_tab_errprot,
ls_errprot like line of lt_errprot.
......
if i_rbkpv-sgtxt eq space.
clear ls_errprot.
ls_errprot-msgty = 'E'.
ls_errprot-msgid = 'ZSTM'.
ls_errprot-msgno = '008'.
ls_errprot-source = ' '. -- This line is important
append ls_errprot to lt_errprot.
endif.
if lines( lt_errprot ) gt 0.
call function 'MRM_PROT_FILL'
tables
t_errprot = lt_errprot.
endif.
endif.
ENDMETHOD.
After user corrected values, error messages are deleted from list.
‎2013 Jul 10 9:29 AM
Hi
Previous variant is not fully correct.
If field "source" is filled with space, standart removes this message before post.
Correct variant is:
clear lt_errprot[].
call function 'MRM_PROT_INIT'
EXPORTING
i_xall = space
i_source = 'Z' -- Clear messages with own type
EXCEPTIONS
OTHERS = 0.
if i_rbkpv-sgtxt eq space.
clear ls_errprot.
ls_errprot-msgty = 'E'.
ls_errprot-msgid = 'ZSTM'.
ls_errprot-msgno = '008'.
ls_errprot-source = 'Z'. -- Use own type of the message
append ls_errprot to lt_errprot.
endif.
if lines( lt_errprot ) gt 0.
call function 'MRM_PROT_FILL'
tables
t_errprot = lt_errprot.
endif.