Skip to Content
Applies to:

SAP ECC 6.0. For more information, visit the ABAP homepage.

Summary

This article describes the procedure to change a specific condition type value in Purchase Orders.

Author:
Shravan Kumar Narendruni

Company:
YASH Technologies
Author
Shravan20001.jpg

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.
CALL FUNCTION ‘BAPI_PO_CHANGE’
EXPORTING
    purchaseorder = w_fdata-ebeln
TABLES
    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)
Capture1.PNG
VI. Now call function module BAPI_PO_CHANGE to update the new condition value.
Capture2.PNGCapture3.PNG

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

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

    1. Former Member Post author

      Hi Prabhu,

      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

      (0) 

Leave a Reply