Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Metafields

Metafields are used in the Enjoy transactions of Purchasing to characterize business content and detach it from concrete data holding. Using metafields in the system, you can thus reference a business variable on a uniform basis. Example The business variable 'purchase order unit' is represented in the user interface by the technical field MEPO1211-MEINS and in data holding by the field EKPO-MEINS. Technically, metafields are integer constants, whose definitions you can find in the type group MMMFD. Note A name range starting from 90000000 is available for customer applications (mmmfd_cust_01).

Metafield and field selection


The field selection is determined on the basis of the metafields. For this purpose, the customer's own subscreen must know the list of the fields represented and their assignment to the metafields. This relationship is created in the BAdI ME_GUI_PO_CUST. There on the one hand a DDIC structure is specified in the method SUBSCRIBE, from the components of which the field catalog is created. In addition, the link to the relevant metafield in each case is established in the method MAP_DYNPRO_FIELDS. In method FIELDSELECTION_ITEM of the BAdI ME_PROCESS_PO_CUST, which is a prerequisite for BAdI ME_GUI_PO_CUST, these metafields are then used to influence the selection of the customer's own fields.

Metafield and error handling


Metafields also have an important function in error handling. They establish the connection between a message and the business content. Example You can control the positioning of the cursor during the processing of messages. If you wish to do this when implementing your own checks, use the following macros:

mmpur_metafield This macro links the metafield with the message generated with the subsequent macro mmpur_message_forced (see below). A list of the known metafields can be found in the type group MMMFD. This also contains some definitions for customer enhancements (MMMFD_CUST_01 to MMMFD_CUST_10). mmpur_message_forced You use this macro to generate the actual message. The message is linked to the known business object (e.g. document header, document item) and the previously specified metafield. The macro requires exactly sevem parameters: message category (I,W,E), message class, message number and the four message parameters. (See also the ABAP message statement).

Further notes

The above-mentioned macros are defined in the program MM_MESSAGES_MAC. Please include this program in your own application. Never issue messages in BAdI ME_GUI_PO_CUST! This is the task of the business logic and must therefore be done via the BAdI ME_PROCESS_PO_CUST. Never use the ABAP statement MESSAGE in the BAdI ME_PROCESS_PO_CUST. Please use the macro mmpur_message_forced only. This macro only writes a message in the message collector. If you wish to mark the business object as invalid in order to prevent posting, you must additionally use the INVALIDATE ( ) method of the relevant interface. In this connection, see also the code example in the PROCESS_ITEM method of the BAdI ME_PROCESS_PO_CUST.

You might also like