Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Error message in BADI

Former Member
0 Kudos

Hi all,

Please tell me how to give error message inside badi.

Or please tell me how to give message in badi and then immediately come out of transaction.

Thank you.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Check this link

[]

You can do something like it.

Regards,

Surinder

9 REPLIES 9

I355602
Advisor
Advisor
0 Kudos

Hi,

Give error message as:-


MESSAGE '<message_text>' TYPE 'E'.
"E - error message
"I - info message
"S - success message
"W - warning message

Regards,

Tarun

keerthy_k
Active Participant
0 Kudos

Hi,

If u have any exception parameters in the BAdi Interface methods, then u can raise those exceptions using the statement:

RAISE EXCEPTION_NAME.

Keerthi.

Former Member
0 Kudos

Hi,

Check this link

[]

You can do something like it.

Regards,

Surinder

Former Member
0 Kudos

MESSAGE e001(sy) WITH 'Error Message' RAISING <badi_exception>.

Regards,

Joan

0 Kudos

Hi all,

The W/I/E Messages not allowed in badi.Please provide alternative solution.

0 Kudos

Hi,

Which BADI u r using?

Some of the BADIs wont allow message statement(Mentioned in documentation)

eg: ME_PROCESS_PO_CUST.

In this case they explains the error handling.

Try with below macro


DEFINE mmpur_message_enaco.
  l_tabix = sy-tabix.
  l_subrc = sy-subrc.

  MESSAGE id &2 type lc_i number &3 with &4 &5 &6 &7 into l_dummy.
  call method cl_message_mm=>create exporting im_msgid = &2
                                              im_msgty = &1
                                              im_msgno = &3
                                              im_msgv1 = sy-msgv1
                                              im_msgv2 = sy-msgv2
                                              im_msgv3 = sy-msgv3
                                              im_msgv4 = sy-msgv4
                                              im_custom = 1
                                    exceptions failure = 01
                                               dialog  = 02.
  IF sy-subrc EQ 1 OR sy-subrc EQ 2.
    MESSAGE id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
  sy-subrc = l_subrc.
  sy-tabix = l_tabix.
END-OF-DEFINITION.

 mmpur_message_enaco space lc_00 lc_001  "Issue the message
                                          text-001 text-002 text-003 space.

Thanks,

Vinod.

0 Kudos

I am using BADI ZBADI_MATN1.Please tell me how to give error message for this or pop-up.

Thank you.

0 Kudos

try this

message s000(class) with 'message' display like 'E'.

leave to screen 1000.

Good luck!

0 Kudos

try this

message s000(class) with 'message' display like 'E'.

leave to screen 1000.

Good luck!