• May 4, 2026
  • Kishore Thutaram
  • 0

Update PO (Purchase Order) custom fields using EML syntax S/4 HANA

Requirement – Update the custom fields to PO by using EML Syntax

Steps – Add custom fields to the standard behavior definition i_purchaseordertp_2 by using CFL app

Implement the below code – program/FM/Class/user Exit


*--*EML Syntax to update EKPO Custom Fields
      LOOP AT it_ekpo INTO DATA(ls_ekpo).
        ls_update = VALUE #( purchaseorder = ls_ekpo-ebeln
                               purchaseorderitem = ls_ekpo-ebelp
                               zzpostat_pdi    = lc_status
                               zzcesd_pdi = lv_req_date
                               %control-zzpostat_pdi  = if_abap_behv=>mk-on
                              %control-zzcesd_pdi = if_abap_behv=>mk-on ).
        APPEND ls_update TO lt_update.
      ENDLOOP.
      IF lt_update IS NOT INITIAL.
        MODIFY ENTITIES OF i_purchaseordertp_2
        ENTITY purchaseorderitem
        UPDATE FROM lt_update FAILED DATA(lt_failed) REPORTED DATA(lt_reported)               MAPPED DATA(lt_mapped).
        IF sy-subrc EQ 0 AND lt_failed IS INITIAL.
          COMMIT ENTITIES.
          IF sy-subrc EQ 0.
*      Do nothing
          ENDIF.
        ELSE.
          ROLLBACK ENTITIES.
        ENDIF.
      ENDIF.
   
    

Kishore Thutaram

SAP Solution Architect | 16+ Years' Experience in SAP | Sharing Practical SAP Knowledge | Engineering Graduate with Expertise in SAP Architecture

https://fiowelt.com