Mass Change of Specific Condition Type Value in Purchase Orders
SAP ECC 6.0. For more information, visit the ABAP homepage.
This article describes the procedure to change a specific condition type value in Purchase Orders.
Shravan Kumar Narendruni
Shravan Kumar is a SAP ABAP Consultant, working in Yash Technologies, Hyderabad.India.
Table of Contents
- Business Requirement
- Step by Step Procedure
1. Business Requirement
To change a specific condition type value in Purchase Orders which are Open or Partial GR is over if a specific condition type is exists.
PO Create – ME21N
PO Change – ME22N
PO Display – ME33N
Material Management (MM)
BAPI_PO_CHANGE – Function module BAPI_PO_CHANGE enables you to change purchase orders. The Change method uses the technology behind the online transaction ME22N.
5. Step by step procedure
I. Get the required data from tables KONV, EKKO and EKPO based on required Condition Type (Eg: ZXYZ) into an internal table.
II. Loop the above internal table and call Bapi BAPI_PO_CHANGE to get the complete pricing condition records values and pass the PO number to Bapi.
Please find the below pseudo code.
Read PO data using the below function module.
CALL FUNCTION ‘BAPI_PO_CHANGE’
purchaseorder = w_fdata-ebeln
return = i_return
pocond = i_pocond .
III. Now we will have all condition records information of a particular PO in internal table i_pocond and internal table i_return contains status messages returned by Bapi.
IV. Delete the condition records which are no need to update the condition value like as follows.
DELETE i_pocond WHERE cond_type NE ‘ZXYZ’.
V. Now modify the internal table with the new condition value and update the condx table with ‘X’.
Please find the below pseudo code for the same. (Eg: i_pocondx internal table)
VI. Now call function module BAPI_PO_CHANGE to update the new condition value.
VII. If there are no error messages in i_return table then call function module BAPI_TRANSACTION_COMMIT
to update the changes to Database tables.
VIII.Now All the POs which are in internal table will be updated with new value for condition type ZXYZ.
Thanks & Regards,
Shravan Kumar N
i thought ,need to pass 'U' to BAPIMEPOCONDX-CHANGE_ID.
Thanks for your comment. We need to pass 'U' in pocond-change_id field to update and 'X' to pocondx-change_id field. Which I already done in my above coding. That will suffice the requirment.
Thanks & Regards
Shravan Kumar N