5 1 1 1 1 1 Rating 100% (1 Vote)
As promised today I'll put code for a method to reset the rejection of the Purchase requisition. Most of the code is the same like in the check method, in fact even the code is repeated again so you can use this one without checking if reset of rejection can be done or not.
 
Importing:

I_BANFN TYPE EBAN-BANFN -> Purchase Requistion number

Changing:

C_FACTORY TYPE REF TO IF_PURCHASE_REQ_FACTORY -> Purchase requisition factory

Exporting:

E_RESET TYPE FLAG -> Reset was successful

Exceptions:

HEADER_COULDNT_BE_CREATED
ERROR_DURING_RESET
CANNOT_RESET

Implementation:

method reject_refusal.
  

  datafo_req        type ref to if_purchase_requisition.
  dataf_document    type mepo_document.
  datafo_resetable type ref to if_releasable_mm.
  dataf_success     type mmpur_bool.
  "get requisition factory
  if c_factory is initial.
    call function 'MEREQ_GET_FACTORY'
      importing
        ex_factory c_factory.
  endif.

* Create header object
  clear fo_req.
  f_document-trtyp 'V'"Change mode
  f_document-doc_key+0(10) = i_banfn.
  f_document-doc_type 'B'"Purchase requisition type
  f_document-initiator-initiator space"empty initiator

  "create header
  call method c_factory->create_header
    
exporting
      im_tcode           'ME52N'
      im_document        f_document
      im_protect         
' '
      im_bapi            ' '
    importing
      ex_instance        fo_req
    
exceptions
      failure            1
      already_registered 2.
  if sy-subrc eq or fo_req is initial.
    raise header_couldnt_be_created.
  endif.

* creation of header fails
  if fo_req is initial.
    raise header_couldnt_be_created.
  endif.

* Header status data
  fo_req->get_transaction_stateimporting ex_document f_document   ).

  fo_resetable ?= fo_req.
  if fo_resetable->is_reset_rej_allowed( ) eq mmpur_yes.

    fo_resetable->reject(
    exporting im_reset mmpur_yes
    
exceptions
      failed   ).
    if sy-subrc ne 0.
      raise error_during_reset.
    endif.

  else.
    raise cannot_reset.
  endif.

  "Final checks
  call method fo_req->check
    importing
      ex_success f_success.

  call method fo_req->post
    
exporting
      im_uncomplete mmpur_no
    
importing
      ex_success    f_success.

  "commit changes
  if f_success eq mmpur_yes.
    call method c_factory->commitim_no_commit mmpur_no ).
    commit work and wait.
    e_reset mmpur_yes.
  endif.

endmethod.

EnjoY!