SAP Knowledge Base Article - Public

3787561 - How to modify Purchase Order fields using BAdIs in SAP S/4HANA Cloud Public Edition

Symptom

The user wants to automatically populate or modify specific fields on a Purchase Order during creation or change — for example, to default values based on business logic, enforce data consistency, or populate fields that are not directly available via external interfaces.

Environment

SAP S/4HANA Cloud Public Edition

Resolution

SAP S/4HANA Cloud Public Edition provides standard BAdIs to modify Purchase Order data at the header, item, and account assignment level.

These BAdIs are implemented via the Custom Logic app in the SAP Fiori Launchpad.

BAdI 1: MM_PUR_S4_PO_MODIFY_HEADER Purpose: Modify Purchase Order Header level data.

Standard fields modifiable:

  • Custom fields (EKKO_INCL_EEW): Via EKKO_INCL_EEW_PS include (Extensibility of PO Header)

  • (CI_EKKODB) / Type: CHAR : Customer include for PO Header

Note: PURCHASEORDER is the identifier — not modifiable. This BAdI is used primarily to populate custom fields at header level.

BAdI 2: MM_PUR_S4_PO_MODIFY_ITEM Purpose: Modify Purchase Order Item level data.

Standard fields modifiable:

  • TAXCODE / Type: MWSKZ (CHAR 2) : Tax Code

  • TAXCOUNTRY / Type: FOT_TAX_COUNTRY : Tax Country/Region

  • INCOTERMSCLASSIFICATION / Type: INCO1 (CHAR 3) : Incoterms Part 1

  • INCOTERMSTRANSFERLOCATION / Type: INCO2 (CHAR 28) : Incoterms Part 2

  • INCOTERMSLOCATION1 / Type: INCO2_L(CHAR 70) : Incoterms Location 1

  • INCOTERMSLOCATION2 / Type: INCO3_L(CHAR 70) : Incoterms Location 2

  • SHIPPINGTYPE / Type: VERSART(CHAR 2) : Shipping Type

  • PURCHASINGINFORECORDUPDATECODE / Type: SPINF(CHAR 1) : Info Record Update

  • Custom fields: Via EKPO_INCL_EEW

  • (CI_EKPODB): Customer include

PURCHASINGINFORECORDUPDATECODE values:

  • (blank) = No update

  • A = Update with or without plant

  • B = Update with plant (if no plant ban)

  • C = Update without plant (if no plant requirement)

Note: PURCHASEORDER and PURCHASEORDERITEM are identifiers — not modifiable.

BAdI 3: MM_PUR_S4_PO_MODIFY_ACCOUNT Structure: MMPUR_S_PO_ACCOUNT_CHANGE Purpose: Modify Purchase Order Account Assignment level data.

Standard fields modifiable:

  • GLACCOUNT / Type: SAKNR (CHAR 10) : G/L Account Number

  • COSTCENTER / Type: KOSTL (CHAR 10) : Cost Center

  • PROFITCENTER / Type: PRCTR (CHAR 10) : Profit Center

  • PROJECTNETWORK / Type: NPLNR (CHAR 12) : Network Number

  • WBSELEMENTINTERNALID / Type: PS_PSP_PNR(NUMC 8) : WBS Element

  • MASTERFIXEDASSET / Type: ANLN1 (CHAR 12) : Main Asset Number

  • SALESORDER / Type: VBELN (CHAR 10) : Sales Order Number

  • SALESORDERITEM / Type: VBELP (NUMC 6) : Sales Order Item

  • UNLOADINGPOINT / Type: ABLAD (CHAR 25) : Unloading Point

  • CONTROLLINGAREA / Type: KOKRS (CHAR 4) : Controlling Area

  • FUNCTIONALAREA / Type: FKBER (CHAR 16) : Functional Area

  • SERVICEDOCUMENTTYPE / Type: FCO_SRVDOC_TYPE : Service Doc Type

  • SERVICEDOCUMENTID / Type: FCO_SRVDOC_ID : Service Doc ID

  • SERVICEDOCUMENTITEMID / Type: FCO_SRVDOC_ITEM_ID : Service Doc Item ID

  • GOODSRECIPIENTNAME / Type: WEMPF (CHAR 12) : Goods Recipient

  • ORDERID / Type: AUFNR (CHAR 12) : Order Number

Note: PURCHASEORDER, PURCHASEORDERITEM, and ACCOUNTASSIGNMENTNUMBER are identifiers only and are NOT modifiable.

Keywords

commodity code, hs code, intrastat, purchase order api, odata v4, missing field, free-text item, po item, badi, MM_PUR_S4_PO_MODIFY_ITEM, MM_PUR_S4_PO_MODIFY_HEADER, international trade, s/4hana cloud public edition, procurement, purchase order interface , KBA , MM-FIO-PUR-PO-2CL , Fiori UI for Purchase Orders (Public Cloud) , How To

Product

SAP S/4HANA Cloud Public Edition all versions