Prevent PR deletion after been converted to PO

     SAP Note No. 521174                          12.03.2003           Page 1
 
     Symptom
     You create a purchase requisition and a purchase order is generated from
     it. Afterwards, you change the purchase requisition by setting
     thedeletion indicator. The system generates a warning message that a
     purchase order already exists for this purchase requisition. However,
     the deletion of such a purchase requisition should be prevented.
     Therefore, the system should generate the error message 06152.
     Additional key words
     ME52, 06152.
     Cause and preconditions
     The warning message does not suffice.
     Solution
     After you implemented the correction, you can set set the message via
     Customizing. If you customize the message as an error message, a
     deletion is no longer possible.
     ________________________________________________________________________

     Valid releases
     Software Component                        Release
                                               from            to
 

     SAP_APPL   SAP Application                470          - 470
                                                                    46C          - 46C
                                                                    46B          - 46B
                                                                   45B          - 45B
    ________________________________________________________________________

     Note attributes

     Transaction codes   ME52
     ________________________________________________________________________
 
     Reference to Support Packages

     Software Component                   Release      Package name
     ________________________________________________________________________
     SAP Application           45B          SAPKH45B58
                                          46B          SAPKH46B42
                                          46C          SAPKH46C33
                                          470          SAPKH47001
     ________________________________________________________________________
 
     Assigned Correction Instructions
     ________________________________________________________________________

     *$--------------------------------------------------------------------$*
     *$ Valid for       :                                                  $*
     *$ Software Component   SAP_APPL   SAP Application                    $*
     *$  Release 46C          To SAPKH46C32                                $*
     *$  Release 470          w/o Support Packages                         $*
     *$*$----------------------------------------------------------------$*$*
     *&---------------------------------------------------------------------*
     *& Object          REPS LMEREQF59
     *& Object Header   FUGR MEREQ
     *&---------------------------------------------------------------------*
     ...
           mmpur_message_forced 'I' '06' '435' '' '' '' ''.
           RAISE failed.
         ELSEIF <item>->item-bsmng GT 0 AND
                im_context->item_old->item-loekz IS INITIAL  AND
                NOT im_context->item_new->item-loekz IS INITIAL.
     *>>>> START OF DELETION <<<<<
           MESSAGE w152(06) INTO l_dummy.
           mmpur_metafield mmmfd_delete_ind.
           mmpur_message_forced 'W' '06' '152' '' '' '' ''.
     *>>>> END OF DELETION <<<<<<<
     *>>>> START OF INSERTION <<<<
     * Start of correction note 521174
           mmpur_metafield mmmfd_delete_ind.
           PERFORM enaco_2 IN PROGRAM sapfmmex USING '06' '152'.
           IF sy-subrc EQ 1.                "message is warning
             MESSAGE w152(06) INTO l_dummy.
             mmpur_message_forced 'W' '06' '152' '' '' '' ''.
           ELSEIF sy-subrc EQ 2.             "message is error
             MESSAGE e152(06) INTO l_dummy.
             mmpur_message_forced 'I' '06' '152' '' '' '' ''.
             RAISE failed.
           ELSE.                           "message not maintained
             MESSAGE w152(06) INTO l_dummy.
             mmpur_message_forced 'W' '06' '152' '' '' '' ''.
           ENDIF.
     * End of correction note 521174
     *>>>> END OF INSERTION <<<<<<
     ...
     *&---------------------------------------------------------------------*
     *&---------------------------------------------------------------------*
     *& Object          REPS MM06BF0O_OKCODE_DELE
     *& Object Header   PROG MM06BF0O_OKCODE_DELE
     *&---------------------------------------------------------------------*
     *& FORM OKCODE_DELE
     *&---------------------------------------------------------------------*
     ...
                 MESSAGE E111.
               WHEN 2.
                 MESSAGE_FLAG = 'X'.
                 MESSAGE E112.
               WHEN 3.

     *>>>> START OF DELETION <<<<<
                 MESSAGE W152.
     *>>>> END OF DELETION <<<<<<<
     *>>>> START OF INSERTION <<<<
     * Start of correction note 521174
                 PERFORM enaco_2 IN PROGRAM sapfmmex USING '06' '152'.
                 IF sy-subrc EQ 1.                "message is warning
                   MESSAGE w152(06).
                 ELSEIF sy-subrc EQ 2.            "message is error
                   MESSAGE e152(06).
                 ELSE.                            "message not maintained
                   MESSAGE w152(06).
                 ENDIF.
     * End of correction note 521174
     *>>>> END OF INSERTION <<<<<<
     ...
     *$--------------------------------------------------------------------$*
     *$ Valid for       :                                                  $*
     *$ Software Component   SAP_APPL   SAP Application                    $*
     *$  Release 45B          To SAPKH45B57                                $*
     *$  Release 46B          To SAPKH46B41                                $*
     *$*$----------------------------------------------------------------$*$*
     *&---------------------------------------------------------------------*
     *& Object          REPS MM06BF0O_OKCODE_DELE
     *& Object Header   PROG MM06BF0O_OKCODE_DELE
     *&---------------------------------------------------------------------*
     *& FORM OKCODE_DELE
     *&---------------------------------------------------------------------*
     ...
                 MESSAGE E111.
               WHEN 2.
                 MESSAGE_FLAG = 'X'.
                 MESSAGE E112.
               WHEN 3.
     *>>>> START OF DELETION <<<<<
                 MESSAGE W152.
     *>>>> END OF DELETION <<<<<<<
     *>>>> START OF INSERTION <<<<
     * Start of correction note 521174
                 PERFORM enaco_2 IN PROGRAM sapfmmex USING '06' '152'.
                 IF sy-subrc EQ 1.                "message is warning
                   MESSAGE w152(06).
                 ELSEIF sy-subrc EQ 2.            "message is error
                   MESSAGE e152(06).
                 ELSE.                            "message not maintained
                   MESSAGE w152(06).
                 ENDIF.
     * End of correction note 521174
     *>>>> END OF INSERTION <<<<<<
     ...
     *&---------------------------------------------------------------------*
 
Beam Back -> SAP Cafe for Materials Management