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 ME21N and ME22N

Former Member
0 Kudos
3,042

Dear Friends,

I am facing one problem... my requirement is at the time of saving purchase order i need to check some thing and if that check fails i need to display the error message and needs to stop the creation of purchase order. That error message at the status bar also ok and pop up also ok. But when i try to display that error message in one exit 'EXIT_SAPMM06E_012' then the eror message is not coming properly.. i mean it is displaying one box under that one red symbol and in the message comming my message class name. I could not able to display the proper error message in proper way.

I have tried one BADI also post save method that is displaying error message properly but immediately after that i am getting one more pop up saying system error with POST_METHOD some thing like that. I haVe checked in debugging that second error message is displaying from the standard program (message class : ME and number 816) but i dont want that second pop up. How to skip that and how to provide proper error message.

Any help will be highly appreciated.

Thanks a lot in advance,

9 REPLIES 9

ramesh_mahankali
Active Participant
0 Kudos
789

Hi,

You can issue error messages from this user exit properly.

Have you tried like below example:

MESSAGE ID 'ZM' TYPE 'E' NUMBER '042' WITH

tekpo-ebelp "line item

tekpo-werks. "receiving plant

And in the message class ZM 042 you should have the text as below:

Item &: Storage Location required for Receiving Plant &.

Let me know if this works.

-Ramesh

0 Kudos
789

Hi,

Thanks ... i have tried the same way but it is not working.

I have implemented one BADI 'ME_PURCHDOC_POSTED' also, i am getting custom message properly but if i press enter on that i am getting one more message 'system error in method POSTED'.... but i dont want this second message.

Please help me.

0 Kudos
789

Hello, can you test with the ME_PROCESS_PO BADI and method: CHECK

Former Member
0 Kudos
789

Hi,

my colleague had the same issue that the PO was ending up with message u2018'system error in method POSTED' when he tried giving an error message in the BADI 'ME_PURCHDOC_POSTED' and when we wrote to SAP they had said not to give any error message in this BADI and the exit EXIT_SAPMM06E_013. So donu2019t give error message there you can give an information message. I understand that by changing the message to information you cannot stop the PO creation.

I would suggest you to try with some other exits or BADI but not the above two mentioned. Meanwhile I will also see if I can help you out.

0 Kudos
789

ok.. thanks a lot ... i will check for other exits..

0 Kudos
789

HI,

Please let me know the exit which i can use. I have tried a lot but i could not able to find the proper user exit to display the error message.

Thanks,

Former Member
0 Kudos
789

Hi,

The user exit that you are using 'EXIT_SAPMM06E_012' is teh one used to raise error message. If you are getting the message name in the pop up i think you should check the message that you are giving and if it is given correctly becuase we have done similar checks in our system and they work fine.

Regards,

Himanshu V

0 Kudos
789

Hi,

Thanks for your reply... but the problem is even if i put error message in that exit one box is coming there i am able to see error messages but even if i press enter i am getting some other different error messages. I dont know but i think the problem is because of that error message which i have provided in the exit. For the same purchase order if i remove the error message in the exit then it is saving properly but if i put the error message then first one box is coming with that error message that is ok but after pressing enter it is giving another error messages.

MESSAGE ID 'ZTEST' TYPE 'E' NUMBER '001' WITH 'PO QUANTITY IS MORE THAN EXPECTED '.

the above message i have provided in the user exit...

Send me the sample code which you have used in the same exit.

thanks.

0 Kudos
789

Hi,

here is the sample of the code we have used in our system.

  • restrict logic based on Document Type and Company Code

IF i_ekko-bsart EQ c_ub AND i_ekko-bukrs EQ 'XXXX'.

  • loop at Line Items of PO

LOOP AT tekpo WHERE loekz EQ space.

  • if Receiving Plant is YYYY and Storage Location is NULL

IF tekpo-werks = 'YYYY' AND

tekpo-lgort = space.

  • issue error message

MESSAGE ID 'ZM' TYPE 'E' NUMBER '042' WITH

tekpo-ebelp "line item

tekpo-werks. "receiving plant

ENDIF. "receiving plant/storage location

ENDLOOP.

ENDIF. "document type

Hope this helps.

-Ramesh