Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

will this code work (bapi)

Former Member
0 Likes
654

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
625

Hello,

You need a BAPI_TRANSACTION_COMMIT after the BAPI's successful return.

Thanks,

Venu

4 REPLIES 4
Read only

Former Member
0 Likes
626

Hello,

You need a BAPI_TRANSACTION_COMMIT after the BAPI's successful return.

Thanks,

Venu

Read only

0 Likes
625

hi venu,

even if we delete something then also we should call bapi_transaction_commit.

Read only

0 Likes
625

yes! the unit of work.. need to be commited..

Read only

0 Likes
625

will the code work