Skip to Content
Author's profile photo Sarvottam Darshan

Purchase Order upload from Legacy to SAP with purchase order history

Executive Summary

An important exercise during SAP implementation project cutover is Purchase Order (PO) migration from legacy to SAP. The legacy POs may be in various stages of processing. Some might be partially delivered while others might be partially invoiced. The scenario becomes challenging as the corresponding stock postings for such histories is already posted in legacy. While businesses would like to bring these histories into SAP they would not like to post to stock accounts or update stock quantities in the material master however they would like to post to GR/IR clearing accounts to record all open items.

This blog discusses proven SAP standard solution of open PO upload with history based on live project experiences and proposes some practical check points and processes to ensure a seamless PO history upload in SAP.

Note: Sound understanding of SAP MM-FI integration is a pre-requisite to this reading.

Business Requirements

During cutover of purchase orders from legacy to SAP businesses face challenging requirements with respect to transferring histories of the purchase orders to SAP. Legacy POs could be carrying varied PO histories as mentioned below:

 Open POs

 Partially Delivered POs (partial GR done)

 Partially Invoiced POs (Partial IR done)

In general, businesses are suggested to close all open POs in legacy and not to bring any histories along in SAP. However in some cases the PO histories become mandatory for businesses. The challenge in such cases is to bring the histories without creating any stock posting while still posting the open items in GR/IR clearing accounts along with its contra postings.

SAP Standard Solution

SAP provides standard programs to upload POs along with their histories from legacy system. It is possible to transfer open, partially delivered, and partially invoiced POs from legacy to SAP. The set of programs operate to load the PO master as a first step followed by history and item text uploads. During this process, the SAP standard automatic account determination and postings to stock and GR/IR clearing accounts based on OBYC setup is circumvented by SAP and postings are done to a user specified GR/IR clearing account (which is open for non-automatic postings) and contra accounts. Dedicated for this upload process business users need to provide the following accounts:



GR/IR Clearing Account

Contra Account Vendor Items

Contra Account Goods Receipt

The relevant accounting entries posted during cutover are as follows:


1) At the time of Inventory upload (as conducted using separate upload tool)

          Inventory account Dr

          Inventory Upload A/c Cr

2) At the time of PO History upload (using the process discussed in this whitepaper)

     a. Partial GR carry forward from legacy to SAP

         Contra Accounts GR Dr

          GR/IR clearing A/c Cr


b. Partial IR carry forward from legacy to SAP

          GR/IR clearing A/c Dr

          Contra Vendor A/c cr

3) Vendor balances upload (as conducted using separate upload tool)

          Contra vendor A/C Dr

          Vendor A/c Cr

Note that the PO history upload SAP programs do not post to stock accounts or create any material quantity updates in material masters during this upload process.

Business Benefits

Clean open item migration from Legacy to SAP with desired PO history

Clear Audit trail

Standard SAP solution

Detailed Mechanism


The transfer of POs is affected via the data transfer workbench using the following programs in the sequence as presented:

SAP programs table.png


The steps to be followed for the upload are as listed below:


Step 1: Create a sequential LSMW using Programs mentioned above:


As a first step Program “RM06EEI0″ (upto 4.6c) and BAPI “BAPI_PO_CREATE1″ (for all versions after 4.6c) are used to create PO headers in SAP. These programs are used at the time of LSMW creation as shown below:

PO LSMW page2.png


This LSMW requires a sequential data transfer relation. PO header gets transferred first followed by PO line item in a sequential manner. Per PO header, a record of the structure MBEPOH is created and per PO item, a record of the structure MBEPOI is created. Each PO line item attaches itself with a PO header item and hence the structure relationship that gets created in LSMW is as shown below:

Structure relationship.png


Note: Detailed source structure for a quick reference is available from the author over mail.

Rest of the steps of LSMW creation process remain same as any other LSMW.

Step2: Define Number Range for PO Upload- OMH6

As a best practice it is recommended to define a unique external number range for ease of identification of legacy purchase orders Vis-a-Vis purchase Orders created in SAP after go-live. Note that this is a client open activity.


Step3: Upload file to Logical Destination (SAP Application server)


The PO upload file is usually very bulky and hence need to be uploaded on the SAP application server by BASIS team for the LSMW to pick it up . SAP standard transaction CG3Z cannot be used to upload the file on application server as it has been observed that the upload files get truncated due to beyond normal file size.

Note:Sample  upload file is available from the author over mail.

  Data preparation for this upload file needs to be done with the following checks in mind.



Step4: Check Uploaded File in application Server-AL11


As a sanity check the upload file destination should be re-verified on the application server.


Step5: Display Transfer file (Optional)-OMQ5


To locate possible data errors in the upload file display the content of the sequential file in structured form using transaction OMQ5. Changes to data structure are possible at this instance.


Step6: Deactivate Statistics Update (Optional)-OM02


Deactivate the statistics updating process in order to reduce the runtime of the programs for transferring purchase orders


Step7: PO Master data Upload


Execute the LSMW created in Step 1 using the upload file on the application server.

Check that the PO headers are created in the backend but not yet released post the LSMW upload. No histories exist at this instance.


Step8: PO History Upload-SA38 (RM06EEI1)


As a next step, PO line item uploads are conducted using program RM06EEI1 as shown below:

PO History upload screen.png




File Name: is the application server address of the upload file that has been uploaded in step 4 

Without database update: This is for doing a test run. No documents get posted when the program is executed in this mode. It is recommended to conduct this run to check any possible errors ahead of the actual update run.


With Database update: This run updated the PO history and created accounting entries as applicable. It shows a log of the activity indicating POs loaded successfully, POs with error as well as the detailed reasons for the errors. It needs to be scheduled in the background. An upload file with approximately 6000 line items takes about 5 minutes. The SAP MM tables EKKO and EKPO tables get updated during this run.  

GL Accounts: GR/IR clearing account, Contra account for Vendor items, Contra accounts Goods receipt are GL accounts to be provided by business and to which accounting postings are expected due to the PO history upload.  

Document Types: Specify the SAP document types which are intended to be used for the above postings.

Scope of Error log: Choose “log with error message” to get detailed errors log for failed cases. Note that for POs which fail during their history upload even the PO header is not created. The POs with error can be corrected and a second upload with only the delta POs can be executed.  

Step 9: Conduct a sample data check:

Post the upload, it is recommended to check some sample POs for each detail and the accounting documents posted. For detailed check EKKO, EKPO table from MM side, Documents posted in accounts provided by business for this purpose can be analyzed.


Step 10: Deactivate ext number range for PO- OMH6


Post the upload it is mandatory to deactivate external number ranges so that the same don’t get consumed in Post go-live PO creation process.




SAP’s solution for PO history upload has been used successfully in large multi-country implementations with a mandate to upload PO histories from Legacy to SAP for various business reasons. The setup for this upload is a one-time exercise with full reusability for each successive roll-out. A clear strong point of this upload process is the ability of this functionality to check errors ahead of actual database update. This gives users the ability to make corrections and allow only correct values to update SAP database.


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Sridhar Bolisetti
      Sridhar Bolisetti

      Hi Sarvottam Darshan,

      Wonderful document on legacy data migration process for POs.  Thanks for sharing.



      Author's profile photo Former Member
      Former Member

      Hi Sarvottam,

      Its a wonderful Document.

      I have a query.

      Right now, I am facing a problem of data conversion from Legacy to SAP. This is for Service PO History conversion. We are not facing any issues in Material PO History conversion using program RM06EEI1. We don’t have a approach for service PO history upload, since the program don’t support uploading Service PO History. Can you kindly suggest any LSMW program or approach for uploading the Service PO History?



      Author's profile photo Former Member
      Former Member

      Thank you Sarvottam,

      I have the same issue as Manas for Service PO. Do we have any Std. solution?

      Many thanks for you...



      Author's profile photo Former Member
      Former Member

      Dear Sarvottam,

      I have one question: What will be the case for the G/L accounts ? How can the finance handle them?

      Many thanks for you...



      Author's profile photo Former Member
      Former Member

      Hi @sarvottam.darshan,


      Can I get your email address so I could request for a Sample  upload file? Or email me at Thanks.




      Author's profile photo Former Member
      Former Member


      Please disregard request. Found out how to generate a sample file thru SPRO

      Author's profile photo Former Member
      Former Member

      Hi Sarvottam,

      Would you be able to send me a sample upload file for this please. My email id



      Author's profile photo Former Member
      Former Member

      Hi Sarvottam,


      Nice blog on the whole process.  Can you please share the input file format for the LSMW on my mail id


      That would help me to try this.




      Author's profile photo Former Member
      Former Member

      Hi Sarvottam,

      Excellent blog.

      Could you send me an example of the upload file please?

      I would appreciate your assistance.




      Author's profile photo Chi-John Hwang
      Chi-John Hwang

      Hi Sarvottam,

      Could you send me sample upload file ?  Thank You !


      Author's profile photo Suresh Kumar Natarajan
      Suresh Kumar Natarajan



      can you send me a sample file to

      Author's profile photo SAMPATH KUMAR G VEERAPPA



      Please share sample upload file to

      Author's profile photo rohini thakur
      rohini thakur



      Please share sample upload file for multiple PO items to


      It's urgent.




      Author's profile photo Privilege Mudzinge
      Privilege Mudzinge

      Dear Sarvottam,


      Thank you for a concise documentation of the process

      Please share the sample upload files to

      Best regards,


      Author's profile photo Marko Tadic
      Marko Tadic

      Dear Sarvottam,

      Thank you for this great blog entry.

      Could you please send me the sample upload file to

      Thank you very much,

      Best regards,


      Author's profile photo Sriram Vangipuram
      Sriram Vangipuram

      Hello Sarvottam,

      Do you have any documentation on this process? If it so can you please share me with all the details like file format, what are the fields that needs to be updated to migrate the PO history to S4 system etc.?



      Author's profile photo SWAPNIL WAWGE

      Hello Sarvottam,

      Very nice and interesting blog!!!

      Could you please send all the documents related to this blog on
      It would be very helpful.



      Author's profile photo Mannu Kumar
      Mannu Kumar

      Dear Sarvottam,

      Knowledgeful blog!!!

      If possible can you share documents related to this blog including upload file on mail


      Thanks in advance