310154 - ME21N/ME51N: Customer-specific check, generating error log
310154 - ME21N/ME51N: Customer-specific check, generating error log
Header
Version / Date 14 / 2003-06-25
Priority Recommendations/additional info
Category Consulting
Primary Component MM-PUR-PO-GUI Userinterface - Purchase Orders
Secondary Components
•
Summary
• Symptom
• In Transaction ME21N (EnjoySAP: Purchase Order), you want to issue a customer-specific error message. The error message should appear in the error log of the application. In addition, you would like to navigate to the incorrect field.
The same applies to ME51N.
• Other terms
• ME21N, ME22N, ME23N, MEPO, ME51N, ME52N, ME53N, MEREQ, user exit, message output, message, mmpur_message_forced
• Solution
• Purchase order:
Use enhancement MM06E005 to check the purchase order. In function exit EXIT_SAPMM06E_012, generate messages that are linked to a certain business object and field. Via this link, the application can later position on the item or field in question.
To create the link, you can use the following macros:
o mmpur_business_obj_id
Using this macro, you report the business object to which the following messages are assigned to the message handler. The ID of the respective business object is transferred to the macro. You can use fields tekpo-id, teket-id and tekkn-id here. Only use this macro if you have issued the error messages for the purchase order header since the message handler is already positioned on the purchase order header upon the access into the user exit.
Only carry out this macro if the ID has been set (see example implementation). The ID is not filled in Transaction ME21!
o mmpur_metafield
This macro links the following messages with a special field of the business object set before. The fields are represented by constants of type mmpur_metafield, which are contained in type group mmmfd. Using this field, the message handler can localize the relevant screen area and position the cursor on the corresponding field later. The meta field must be transferred to the macro.
To find out the correct meta field display function group memfs. In this function group, mapping between the structures of the application and the meta fields of the business objects is carried out (subroutines: EKKO, EKPO, EKET, EKKN).
o mmpur_message_forced
Using this macro you generate the actual message. The message is linked with the announced business object and meta field. The macro re
ceives 7 parameters: Message type (I, W, E), message class, message number and message parameters 1 to 4.
When you use these macros, make sure that the function exit is also active in Transactions ME21ff, ME31ff and ME41ff. Since no error log exists here, error messages (message type E) are issued directly. This in particular means that the function module terminates after execution of macro mmpur_message_forced 'E' and the subsequent source code is no longer run through. When executing the function exit in Transaction ME21N, however, the subsequent source code is run through and additional messages can be issued.
Also ensure that the last type 'E' error message is generated with the mmpur_message macro and not the mmpur_message_forced macro. The parameter list is identical to the parameter list of the mmpur_message_forced macro. Using this macro, the type 'E' error message is issued immediately. This means that the transaction identifies the 'E' error status of the user exit and prevents the message from being saved (however, it will still be held).
To be able to use the macros, implement the advance correction in Inlcude LXM06TAP, provided that it does not yet exist.
Furthermore, you find an example implementation of function exit EXIT_SAPMM06E_012 (Include ZXM06U43) in the 'Corrections' section.
In this example, the system checks in all items with account assignment to account assignment category 'X' whether the cost center was entered. If the cost center is missing, a (fictitious) error message is issued per account assignment line of the item. Then the error message is issued when you post or check the purchase order.
------------------------------------------------------------------------
Purchase requisition:
To check the purchase requisition, use enhancement MEREQ001.
There, user exits EXIT_SAPLMEREQ_005 and EXIT_SAPLMEREQ_010 are available to create your own messages.
Do not output the messages yourself but use the corresponding export parameter of the function exit to store all your messages there.
This parameter is transferred back to the standard program which carries out the message output.
No comments:
Post a Comment