Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3184

How to Reset a Rejected Purchase Order ?

$
0
0

Hi All,

 

 

I want to reset a rejected purchase order ( undo rejection action ). I can reject a purchase order, but i can't reset the rejected purchase order.

 

I'm using that code, it's not working. How can i reset to a rejected purchase order ? Need help about that.

 

 

Thanks.

 

SELECT SINGLE * FROM ekko WHERE ebeln    EQ gt_itab-ebeln
                                     AND procstat EQ '08'.
         IF sy-subrc EQ 0.

*  prepare creation of PO instance
           ls_document-doc_type    = 'F'.
           ls_document-process     = mmpur_po_process.
           ls_document-trtyp       = 'V'.
           ls_document-doc_key(10) = gt_itab-ebeln.
           ls_document-initiator-initiator = mmpur_initiator_rel.

*  object creation and initialization
           lv_ebeln = gt_itab-ebeln.
           CREATE OBJECT lc_po.
           lc_po->for_bapi = mmpur_yes.
           CALL METHOD lc_po->po_initialize( im_document = ls_document ).
           CALL METHOD lc_po->set_po_number( im_po_number = lv_ebeln ).
           CALL METHOD lc_po->set_state( cl_po_header_handle_mm=>c_available ).

*  read purchase order from database
           CALL METHOD lc_po->po_read
             EXPORTING
               im_tcode     = 'ME29N'
               im_trtyp     = ls_document-trtyp
               im_aktyp     = ls_document-trtyp
               im_po_number = lv_ebeln
               im_document  = ls_document.

           IF lc_po->if_releasable_mm~is_rejection_allowed( ) = 'X'.
             CALL METHOD lc_po->if_releasable_mm~reject
               EXPORTING
                 im_reset = space
               EXCEPTIONS
                 failed   = 1
                 OTHERS   = 2.
           ENDIF.

           CALL METHOD lc_po->po_post
             EXCEPTIONS
               failure = 1
               OTHERS  = 2.

           WAIT UP TO 1 SECONDS.

         ENDIF.

         SELECT SINGLE * FROM ekko WHERE ebeln    EQ gt_itab-ebeln
                                     AND procstat <> '08'.
         IF sy-subrc EQ 0.

           it_message-ebeln = gt_itab-ebeln.
           it_message-msgtype = 'S'.
           it_message-message = text-017.

           APPEND it_message.


Viewing all articles
Browse latest Browse all 3184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>