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: 

Displaying error message inside Badi.

0 Kudos

Hi all,

My requirement is to display error message while creating a purchase order with an asset, already in some other existing PO. User should be able to edit the values after displaying error message.

I tried following inside badi 'ME_PURCHDOC_POSTED'

1) message 'error' type 'E'.

          but after displaying the error, user is not able to edit the screen.

2) message 'error' type 'I' display like 'E'.

          but this time values are getting saved. 

3) used a popup fm C14Z_MESSAGES_SHOW_AS_POPUP

          here also values are getting saved after displaying the popup

4) used 'Leave to list-processing' after displaying popup / message of type 'I'.

          again values are saved.

In Badi "After displaying an error message,  keep fields in edit mode, so that user can modify the values and save it again."

I searched in related posts but couldnt find a solution for this .

Please help.

Regards,

Srijith Ravindran

1 ACCEPTED SOLUTION

0 Kudos

Hi all,

Thanks for Help. I got solution for my issue.

Instead of using Badis, i used user exits.

I used the enhancement MM06E005 for displaying the error message,in Function exit EXIT_SAPMM06E_012.

If we display error message here, it will display along with standard system errors. So able to do modifications in screen.

I had similar requirement in PR. (display error if asset already exits in other PR or PO)

I used the enhancement MEREQ001 and

Function exit EXIT_SAPLMEREQ_010.

This function exit has one export parameter named EX_MESSAGES. I just appended the code to this internal table and was able to display error messages in standard popup.

data: messages TYPE bapiret2.

        

"DATA:  messages TYPE LINE OF ptarq_uia_messages_tab.

            messages-id = 'xxx'.
            messages-type = 'E'.
            messages-number = 021.
            messages-message_v1 =  xxx.
            messages-message_v2 =  ' xxx'.
            messages-message_v3 = xxx.
            messages-message_v4 = xxx.
            APPEND messages TO ex_messages.

I hope it will be useful for you.

regards,

Srijith R

3 REPLIES 3

Former Member
0 Kudos

Hello Srijith,

Not sure if you can use your validation in ME_PROCESS_PO_CUST, If this BADI can be useful..

then raise the error message in CHECK method.

ch_failed = abap_true.

MESSAGE e001(Message Type ) with 'validation failed'

Thanks.

Ravi

former_member188827
Active Contributor
0 Kudos

Try using BADI "ME_PROCESS_PO_CUST" method "CHECK". Also see if exit MM06E005 helps.

Regards

0 Kudos

Hi all,

Thanks for Help. I got solution for my issue.

Instead of using Badis, i used user exits.

I used the enhancement MM06E005 for displaying the error message,in Function exit EXIT_SAPMM06E_012.

If we display error message here, it will display along with standard system errors. So able to do modifications in screen.

I had similar requirement in PR. (display error if asset already exits in other PR or PO)

I used the enhancement MEREQ001 and

Function exit EXIT_SAPLMEREQ_010.

This function exit has one export parameter named EX_MESSAGES. I just appended the code to this internal table and was able to display error messages in standard popup.

data: messages TYPE bapiret2.

        

"DATA:  messages TYPE LINE OF ptarq_uia_messages_tab.

            messages-id = 'xxx'.
            messages-type = 'E'.
            messages-number = 021.
            messages-message_v1 =  xxx.
            messages-message_v2 =  ' xxx'.
            messages-message_v3 = xxx.
            messages-message_v4 = xxx.
            APPEND messages TO ex_messages.

I hope it will be useful for you.

regards,

Srijith R