Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
Showing results for 
Search instead for 
Did you mean: 
Active Participant
Applies to:

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

YASH Technologies
Shravan Kumar is a SAP ABAP Consultant, working in Yash Technologies, Hyderabad.India.
Table of Contents
  1. Business Requirement
  2. Transactions
  3. Module
  4. Functionality
  5. 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.
2. Transactions
PO Create – ME21N
PO Change – ME22N
PO Display – ME33N

3. Module

Material Management (MM)
4. Functionality

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.
    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

Labels in this area