Skip to Content
0
Former Member
Feb 19, 2009 at 02:06 AM

will this code work (bapi)

29 Views

hi to all experts,

my requirement is to delete the purchase requisitions line items if they are not converted to PO

i have used bapi_requisition_delete to delete the pr

here is my code will this work any inputs will be appreciated ......

this inside an implicit enhancement in the FM FM_CO_ASS_INPUT_GET_PM im matching the order number (AUFNR) and getting the pr and item no and (statu not equal to B it is not converted to PO)

im deleting using BAPI

SELECT banfn bnfpo FROM ebkn INTO TABLE it_ebkn
            WHERE aufnr EQ i_aufnr.
IF it_ebkn IS NOT INITIAL.
SELECT banfn bnfpo from eban INTO TABLE it_eban
    FOR ALL ENTRIES IN it_ebkn
  WHERE banfn eq it_ebkn-banfn
    AND statu NE 'B'.
ENDIF.

LOOP AT it_eban INTO wa_eban.
  MOVE: wa_eban-bnfpo TO it_del-PREQ_ITEM,
        'X'           TO it_del-DELETE_IND,
        'X'           TO it_del-CLOSED.
  APPEND it_del.
  CLEAR  it_del.


CALL FUNCTION 'BAPI_REQUISITION_DELETE'
  EXPORTING
    number                            = wa_eban-banfn
 tables
    requisition_items_to_delete       = it_del
   RETURN                            =  it_return
          .


CLEAR : wa_eban.