Skip to Content
0
Mar 05, 2007 at 08:41 AM

User Exit EXIT_SAPLMEREQ_010

709 Views

Hi,

I have implements the user-exit <b>EXIT_SAPMM06E_012</b> to validate the Purchase order. The following is an extraction of the code:

*========================== VALIDATE PO ITEMS
  LOOP AT tekpo.

*   Validate Material group for all non Material purchases
    IF tekpo-matnr IS INITIAL.
*     I01 Validate Material group active
*----------------------------------------------------------------------*
      CLEAR: t023t.
      SELECT SINGLE * FROM t023t WHERE matkl = tekpo-matkl
                                 AND   spras = sy-langu.
      IF NOT sy-subrc = 0.
        IF NOT tekpo-id IS INITIAL.
          mmpur_business_obj_id tekpo-id.
          mmpur_metafield mmmfd_mat_grp.
        ENDIF.
*E      The material group & does not exist
        mmpur_message_forced 'E' 'MM' '086' tekpo-matkl '' '' ''.
        w_e_error = 'X'.
      ELSEIF t023t-wgbez = 'DO NOT USE'.
        IF NOT tekpo-id IS INITIAL.
          mmpur_business_obj_id tekpo-id.
          mmpur_metafield mmmfd_mat_grp.
        ENDIF.
*E      Material group & is inactive. DO NOT USE
        mmpur_message_forced 'E' 'Z_MM06E005' '001'
          tekpo-matkl '' '' ''.
        w_e_error = 'X'.
      ENDIF.

The statements <b>mmpur_business_obj_id</b> and <b>mmpur_metafield</b> correctly group the error messages per Item number and allow you to edit the field directly from the Messages while the mmpur_message_forced populate the Messages screen.

Now I am implementing the same validation for the Purchase requisition using user exit <b>EXIT_SAPLMEREQ_010</b>. According to OSS Note 310154 the export parameter should be used for all errors.

<i><u>OSS Note 310154</u> - 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.</i>

This does populate the Messages screen, but the messages are all displayed as Header messages and not with regards to the relevant Item.

Since the macros <b>mmpur_business_obj_id</b> and <b>mmpur_metafield</b> does not exist in the user exit, how do I go about to report the error messages correctly in the messages screen. Please refer to the below example coding that I used.

DEFINE m_message.
  wa_message-type       = &1.
  wa_message-id         = &2.
  wa_message-number     = &3.
  wa_message-message_v1 = &4.
  wa_message-message_v2 = &5.
  wa_message-message_v3 = &6.
  wa_message-message_v4 = &7.
  append wa_message to ex_messages.
END-OF-DEFINITION.

* I01 Validate Purchase group active
*----------------------------------------------------------------------*
  CLEAR: t024.
  SELECT SINGLE * FROM t024 WHERE ekgrp = wa_eban-ekgrp.
  IF NOT sy-subrc = 0.
*E  Purchasing group & not defined (please check your input)
    m_message 'E' 'ME' '011' wa_eban-ekgrp '' '' ''.
    w_e_error = 'X'.
  ELSEIF t024-eknam = 'DO NOT USE'.
*E  Purchasing group & is inactive. DO NOT USE
    m_message 'E' 'Z_MM06E005' '000' wa_eban-ekgrp '' '' ''.
    w_e_error = 'X'.
  ENDIF.

Thanks and best regards,

Jacques Botha