Requirement: S4 after the receipt voucher is made according to the purchase order, if the user unapproves the purchase order to modify the unit price, the system will prompt "received, unit price cannot be modified".
Judgment process: whether there is receipt voucher
If the purchase order conditions are priced according to the purchase information record, the price cannot be modified originally. Only one PBXX condition can be added. When judging here
Also determine whether there is a PBXX or only a PB00
Find the enhanced location SMOD, and then search the enhanced points contained in package ME. The enhanced location is
CMOD creates a project and fills in the enhancement points for management. Double click ZXM06U43 to create it, and write the code here.
Code attached at the end
Note: the S4 environment is used, and the table of purchase order conditions is different. The S4 environment is prcd? Elements, and the ECC environment is KONV
*&---------------------------------------------------------------------* *& Contain ZXM06U43 *&---------------------------------------------------------------------* data: sum_menge type ekbe-menge. if sy-tcode = 'ME22N' or sy-tcode = 'ME22'. loop at tekpo. "Judge whether there are warehousing records select menge,shkzg into table @data(lt_ekbe) from ekbe where ebeln = @tekpo-ebeln and ebelp = @tekpo-ebelp and bewtp = 'E'. loop at lt_ekbe assigning field-symbol(<ls_ekbe>). if <ls_ekbe>-shkzg = 'S'. sum_menge = sum_menge + <ls_ekbe>-menge. else. sum_menge = sum_menge - <ls_ekbe>-menge. endif. endloop. check sum_menge > 0."There are warehousing records sum_menge = 0. select kposn, "project kschl, "Condition type kbetr "Price into table @data(lt_price) from prcd_elements where knumv = @i_ekko-knumv and kposn = @tekpo-ebelp. read table lt_price assigning field-symbol(<ls_price>) with key kposn = tekpo-ebelp "Whether there are new conditions kschl = 'PBXX'. if sy-subrc = 0. read table tkomv assigning field-symbol(<ls_komv>) with key kschl = 'PBXX'. if sy-subrc = 0. if <ls_price>-kbetr <> <ls_komv>-kbetr. "Revised price message e899(mm) with tekpo-ebeln tekpo-ebelp 'The price cannot be modified because it has been received.'. endif. else. "Price deleted message e899(mm) with tekpo-ebeln tekpo-ebelp 'The price cannot be modified because it has been received.'. endif. else."primary po There is no new conditional price, read table tkomv with key kschl = 'PBXX' transporting no fields. if sy-subrc = 0. "Added price message e899(mm) with tekpo-ebeln tekpo-ebelp 'The price cannot be modified because it has been received.'. endif. endif. endloop. endif.
Activate this enhancement in CMOD.
Author: Bright and bright
source: http://www.cnblogs.com/hezhongxun/
Wechat: heme 922, welcome to share SAP! Video data with friends.
The copyright of this article belongs to the author and the blog park. You are welcome to reprint it. However, without the consent of the author, you must keep this statement and link the original text in an obvious position on the page of the article. Otherwise, you are entitled to pursue legal liability.