Application Development and Automation 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: 
Read only

Error message in BADI

Former Member
0 Likes
8,272

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
Read only

Former Member
0 Likes
3,616

Hi,

Check this link

[]

You can do something like it.

Regards,

Surinder

9 REPLIES 9
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
3,616

Hi,

Give error message as:-


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

Regards,

Tarun

Read only

keerthy_k
Product and Topic Expert
Product and Topic Expert
0 Likes
3,616

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.

Read only

Former Member
0 Likes
3,617

Hi,

Check this link

[]

You can do something like it.

Regards,

Surinder

Read only

Former Member
0 Likes
3,616

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

Regards,

Joan

Read only

0 Likes
3,616

Hi all,

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

Read only

0 Likes
3,616

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.

Read only

0 Likes
3,616

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

Thank you.

Read only

0 Likes
3,616

try this

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

leave to screen 1000.

Good luck!

Read only

0 Likes
3,616

try this

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

leave to screen 1000.

Good luck!