Tag Archive for ME_UPDATE_REQUISITION

Rejection in Purchase Requisition

Purchase requisition can be rejected using transaction ME54N which updates processing state of requisition (EBAN-BANPR) to value 08. There is no BAPI available which can be used to update processing state of purchase requisition.

To handle the rejection programmatically, function module ME_UPDATE_REQUISITION can be used to update the same.

Usage for the same is given below.

DATA: wl_xeban  TYPE ueban,
      wl_yeban  TYPE ueban,
      wl_eban   TYPE eban,
      li_xeban  TYPE STANDARD TABLE OF ueban,
      li_xebkn  TYPE STANDARD TABLE OF uebkn,
      li_yeban  TYPE STANDARD TABLE OF ueban,
      li_yebkn  TYPE STANDARD TABLE OF uebkn,
      li_eban   TYPE STANDARD TABLE OF eban.

SELECT * FROM eban INTO TABLE li_eban
     WHERE banfn EQ im_requisition.
   IF sy-subrc IS INITIAL.
     CLEAR wl_eban.
     LOOP AT li_eban INTO wl_eban
         WHERE loekz IS INITIAL.
       wl_yeban          = wl_eban.
       APPEND wl_yeban TO li_yeban.

       wl_xeban          = wl_eban.
       wl_xeban-banpr = c_state_rej.
       wl_xeban-kz      = c_ind_upd.
       APPEND wl_xeban TO li_xeban.
       CLEAR: wl_eban, wl_xeban, wl_yeban.
     ENDLOOP.
     IF li_xeban[] IS NOT INITIAL AND
        li_yeban[] IS NOT INITIAL.
       CALL FUNCTION 'ME_UPDATE_REQUISITION'
         TABLES
           xeban = li_xeban
           xebkn = li_xebkn
           yeban = li_yeban
           yebkn = li_yebkn.
    ENDIF.
 ENDIF.
DZoneDeliciousLinkedInRedditTechnorati FavoritesStumbleUponShare