Kishore Thutaram
SAP Solution Architect | 16+ Years' Experience in SAP | Sharing Practical SAP Knowledge | Engineering Graduate with Expertise in SAP Architecture
https://fiowelt.comIn real-time SAP integrations, standard IDOCs often do not fulfill all business requirements. Especially in Purchase Order scenarios, businesses need to send additional custom fields to external systems for better tracking and processing.
This article explains how to extend a Purchase Order IDOC and send custom fields using enhancements in SAP.
A business needs to send Purchase Order data to an external system, but the standard IDOC does not include:
Because of this:
To solve this, we enhance the IDOC with custom segments and fields.
We use the following approach:
Key Benefits:
Maintain outbound parameters for Purchase Order IDOC.
Ensures IDOC is triggered correctly during output processing.
ZZE1EDP01)Understanding IDOC structure is important here — if you’re new, you can refer to your article on receiving IDOCs to understand segment hierarchy and flow.
Use:
IDOC_OUTPUT_ORDERSEXIT_SAPLEINM_011ZXM06U33This is where custom logic is written.
If you want to trace how data flows through exits, it’s helpful to understand how to debug ABAP programs to analyse runtime behaviour effectively.
CONSTANTS: lc_zze1edp01 TYPE edidd-segnam VALUE 'ZE1EDP01',
lc_e1edp01 TYPE char7 VALUE 'E1EDP01'.
DATA: ls_e1edp01 TYPE e1edp01.
SELECT ebeln, ebelp, vbeln, vbelp
FROM ekkn
INTO TABLE @DATA(lt_ekkn)
WHERE ebeln = @dekko-ebeln.
LOOP AT dint_edidd ASSIGNING FIELD-SYMBOL(<lf_dint_edid_l>)
WHERE segnam = lc_e1edp01.
DATA(lv_index) = sy-tabix.
ls_e1edp01 = CONV e1edp01(<lf_dint_edid_l>-sdata).
DATA(ls_ekkn) = VALUE #( lt_ekkn[ ebelp = ls_e1edp01-posex ] OPTIONAL ).
IF ls_ekkn IS NOT INITIAL.
DATA(ls_zze1edp01) = VALUE zze1edp01(
zkdauf = ls_ekkn-vbeln
zkdpos = ls_ekkn-vbelp
).
DATA(ls_new_edidd) = VALUE edidd(
segnam = lc_zze1edp01
sdata = ls_zze1edp01
).
INSERT ls_new_edidd INTO dint_edidd INDEX lv_index + 1.
ENDIF.
ENDLOOP.
While processing large volumes, always follow ABAP performance tuning techniques to avoid slow execution.
ZXM06U331. Can we extend standard Purchase Order IDOC?
Yes, using WE30/WE31 you can create custom segments and extend IDOCs.
2. Where do we write custom logic?
Inside user exits like EXIT_SAPLEINM_011.
3. How to debug IDOC processing?
Use WE02 and set breakpoints in the exit include.
4. Can we add multiple custom segments?
Yes, based on business requirements.
5. Is this approach suitable for S/4HANA?
Yes, this works in both ECC and S/4HANA systems.
Extending Purchase Order IDOCs is a common requirement in SAP integrations. By using:
You can build a robust and scalable outbound integration solution.

SAP Solution Architect | 16+ Years’ Experience in SAP | Sharing Practical SAP Knowledge | Engineering Graduate with Expertise in SAP Architecture
SAP Solution Architect | 16+ Years' Experience in SAP | Sharing Practical SAP Knowledge | Engineering Graduate with Expertise in SAP Architecture
https://fiowelt.com