How to Create a Purchase Order with IDOCs in SAP

Understanding IDOCs

First things first—what exactly is an IDOC?

An IDOC (Intermediate Document) is SAP’s standard data structure used for electronic data interchange (EDI) between SAP systems or between SAP and external systems. Think of it as a data container that flows from one system to another, ensuring structured communication.

Why use IDOCs over manual processes? Because automation = efficiency. IDOCs let you automatically trigger actions (like creating a PO) without manual clicks.

Prerequisites for PO Creation with IDOCs

Before we start configuring, make sure you’ve got:
  • Authorization for WE20, SPRO, SE38, and ME21N/ME22N transactions
  • Basic understanding of output types and message control in SAP
  • Partner/vendor set up in your SAP system
  • Proper RFC destinations if communicating externally

Setting Up Partner Profiles (Transaction: WE20)

The partner profile is where all the magic begins.

For a vendor (partner type LI), you need to define the outbound parameters as follows:

  • Message Type: PORDCR1
  • Process Code: BAPI
This setup tells SAP, “When this message type is triggered, use BAPI to send the data.”

Alternatively, if you’re working with the ORDERS05 IDOC type:

  • Message Type: ORDERS
  • Process Code: ME10
This is the standard for traditional PO creation and has been widely used for years.

Message Determination Process

Here’s the thing: you don’t want to manually create IDOCs every time you make a PO. That’s where message determination (aka output control) comes in.

SAP can automatically send an IDOC when you create or change a purchase order. This requires proper setup in the message control framework.

Configuration Path in SPRO

You’ll need to head into customizing via SPRO to define how messages get triggered.

Path:
Materials Management > Purchasing > Messages > Output Control

Here you define your applications, output types, and assign condition records.

Defining Application EF

In SAP speak, Application EF relates to purchase orders. It's the key area where output messages (like EDI notifications) are handled for POs.

When setting this up:

  • Output Type: NEU (standard SAP for PO)
  • Medium: 6 for EDI or A for ALE
  • Transmission Timing: Choose “Send immediately” or “Send via job,” based on your process

Defining Output Types

Within Application EF, the NEU output type is the classic setup for triggering IDOCs.

There are two operations you’ll want to focus on:

1. PO Creation (Operation 1): Sends IDOC when PO is initially saved
2. PO Change (Operation 2): Sends IDOC when PO is modified

You can use the same NEU output type for both but ensure you flag the change message for the modification scenario.

Assigning Message Schemas

Now, schemas are the bridge between your documents and output messages.

You’ll need to:

  • Define your message schema (like MRM0001 for invoices, or a custom one for POs)
  • Assign it to your document types (standard is NB for POs)
  • Link it with condition types and partner functions
This ensures SAP knows which outputs to use for which document types.

Configuring Message Control in WE20

Back to WE20—this time, make sure the message control is set up correctly.
  • Application: EF
  • Output Type: NEU
  • Message Type: ORDERS (or PORDCR1 if you're going XML route)
  • Process Code: ME10 for creation
Optional: ME11 for changes (with a separate message type like ORDCHG)

Mark the “Change Message” flag if you want to differentiate change scenarios.

Verifying Output Configuration in the PO

After you’ve created your PO (via ME21N) or edited it (via ME22N), check the message control:

1. Go to Header > Messages tab
2. Click “New Entries” if needed
3. Set Output Type = NEU
4. Medium = 6 (EDI) or A (ALE)
5. Message Status = 0 (Not yet processed)

Then, under “Further Data,” select “Send with periodically scheduled job” or “Send immediately,” depending on your setup.

Save it.

Triggering IDOC Manually with RSNAST00

Need to push the IDOC manually? Use program RSNAST00 in SE38.

Input the following:

  • Output Application: EF
  • Object Key: Your 10-digit PO number
  • Output Type: NEU
  • Medium: 6 (EDI) or A (ALE)
Run it. Boom—IDOC should be triggered.

Troubleshooting and Debugging

Not seeing the IDOC? Don’t panic—debug it.

Use function module IDOC_OUTPUT_ORDERS or IDOC_OUTPUT_PORDCR1 depending on your setup.

Set a breakpoint in SE37, then go back to ME22N, enter your PO, and trigger the output. Your debugger will catch it and let you step through the logic.

This is a great way to see if your condition records, message types, or data are missing something.

Advanced Tip: Custom Output Control

Need more than the standard? You can enhance message determination logic via user exits like EXIT_SAPLEINM_002 for fine-tuned control over IDOC population.

Also, monitor your IDOCs via:

  • WE02: For status and structure
  • WE05: For filters and overview
  • BD87: For reprocessing

Best Practices

  • Use a test vendor with external system integration before going live
  • Always include error handling in your outbound logic
  • Schedule periodic jobs to automate the sending process (via RSNAST00)
  • Document every change in message control for audits

Conclusion

Automating PO creation with IDOCs can save your business hours of manual work and reduce errors. Once you’ve got your partner profile, message control, and output types set up, the whole process becomes hands-free.

Use this setup to integrate with suppliers, third-party procurement platforms, or internal systems in real-time. The flexibility and power of IDOCs make SAP an integration powerhouse—use it to your advantage!

FAQs

1. What’s the difference between PORDCR1 and ORDERS05?
PORDCR1 is typically used in XML-based scenarios, especially with SAP PI/PO or middleware, while ORDERS05 is the classic IDOC for PO creation in EDI setups.

2. Can I automate PO changes using the same IDOC process?
Yes, you can use the same NEU output type with a change operation and optionally a different message type (like ORDCHG) for PO modifications.

3. How do I check if the IDOC was successfully created?
Use transaction WE02 or WE05 to check the status of the IDOC. Look for status 03 (sent) or 16 (error) to troubleshoot.

4. What are the common errors in WE20 setup?
Common mistakes include missing message types, incorrect process codes, or forgetting to assign the application (EF). Also, ensure the partner number matches your vendor.

5. How can I test IDOC output without sending to the vendor?
Set up a dummy logical system or use a test RFC destination. This lets you trigger and debug the IDOC flow without reaching an external system.

SAP MM Tips
 
 


See Also
Trigger an IDoc whenever a Purchase Order is Created

Get help for your SAP MM problems
SAP MM Forums - Do you have a SAP MM Question?

SAP Material Management Books
SAP MM Books - Certification, Interview Questions and Configuration

SAP Materials Management Tips
SAP MM Configuration Tips and Materials Management Discussion Forum

Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.