Learn how to automate the uploading of procurement objects in your SAP project using the SAP Legacy System Migration Workbench. Walk through the steps for uploading data for the Purchase Requisition (PReq) object, including how to prepare the data for uploading. Then learn how to easily apply the process to your other procurement objects: purchase orders, scheduling agreements, contracts, purchasing information records, and source lists.
Key Concept
Purchasing master data and transactional data are two of the most critical objects one to consider when implementing an SAP system, upgrading from an older SAP system to SAP ERP Central Component (ECC), or any other scenario in which you have to upload data into an SAP system. One of the most efficient ways of performing these tasks is by using the SAP Legacy System Migration Workbench (LSMW). SAP LSMW is a free tool that supports data migration from non-SAP legacy systems to SAP systems. It allows you to read, convert, and import data.
Requirements for uploading data of procurement objects are unique based on the specific scenario. For example, your company is moving from a non-SAP system or upgrading from an older version of an SAP system (such as SAP R/3 4.7) to a newer version of SAP ERP Central Component (ECC). Another example would be a company with an SAP system that acquires another company with a non-SAP system and now must face integrating the two systems.
To achieve this, you have to migrate data from that acquired company’s system to your SAP ECC system or merge the other company’s code into your SAP system-based company code. In this scenario, you might also need to change organizational data, such as plants, on existing purchasing master data or re-create purchase orders (POs) in your existing system. In yet another scenario, procurement data may need to be uploaded to your SAP system. When performing these necessary tasks, having a single guide that contains all the details of all the programs that are used for procurement object uploading saves you hours of time and effort.
I show you how to use BAPI and IDoc methods in the data migration of procurement objects via SAP Legacy System Migration Workbench (SAP LSMW). I also provide you with guidelines for uploading data for a purchase requisition (PReq), purchase order (PO), scheduling agreement (SA), contract (MK), purchasing information record (PIR), and source list (SL), including:
- The complete end-to-end steps involved in migration of a purchase requisition via SAP LSMW
- Detailed data transfer methods for each object
- The source structure in SAP LSMW for each object
- The source fields to be maintained for each object
Note
For information on the SAP LSMW tool and its functionality, read the following articles:
Note
At the end of this article, I provide sample text files for each object that you can use for your company-specific projects.
Configuring SAP LSMW for Purchase Requisition
Before you begin, you have to perform a few basic SAP LSMW steps. These include defining the project, subproject, and object, and setting partner roles for your program. To learn more about how to configure SAP LSMW for data uploading projects, refer to the SAPexperts articles mentioned earlier. If you select the BAPI or Intermediate Document (IDoc) method, the system automatically checks to see if a partner profile for the default partner and the selected message type (which you specify in the setup) already exist when you save the data. If they don’t, the system tries to create them.
In this section, I take you through the steps to create a purchase requisition via SAP LSMW as an example of how to migrate a procurement object. For the other objects, most of the steps are the same, so you only need to focus on major settings that need to be configured that are specific to that object. After showing you how to create a purchase requisition in SAP LSMW, I detail the specific settings that need to be made for each of the other five objects, without going through the entire process again.
To start the LSMW, you do not need any technical help, but you have to make sure that you have authorization to execute transaction code LSMW. Enter transaction code LSMW in your SAP main menu screen, as shown in Figure 1. After entering transaction LSMW, press Enter or click the execute icon
.

Figure 1
Start the LSMW
Note
If the Legacy System Migration Workbench welcome screen appears, click the check box next to No longer Display This Message, and then press Enter or click the execute icon.
Create a Project, Subproject, and Object Name
Once you press Enter, the SAP LSMW main screen appears. This is where you define your project, subproject, and object (Figure 2).

Figure 2
Define the project, subproject, and object
Click the create icon
and enter a project name and description. Make sure the description is meaningful and describes the project clearly. Repeat the same process for the subproject and object.
Selection of Method for Purchase Requisition
Once you create the project, subproject, and object, the SAP LSMW main screen with all 16 steps appears (Figure 3).

Figure 3
SAP LSMW main screen
Select the radio button next to the first step, Maintain Object Attributes, and click the execute icon
. For a purchase requisition, both the BAPI and IDoc methods options are available. In this example, select the BAPI method and then populate the purchase requisition BAPI details (Figure 4).

Figure 4
Select the BAPI method and details
Available Methods in SAP LSMW
The Business Object and Method details are specific to an object. You can search for the relevant details by pressing F4 against a business object. For example in Figure 4, Business object for Purchase requisition is BUS2105 and it has been selected after opening the search screen via F4. The Message Type, PREQCR1 in this example, represents the Create Enjoy Purchase Requisition truncation, which is equivalent to transaction ME51N – the transaction used to create a purchase requisition. After selection of method and details, click the save icon, which returns you to the main screen (Figure 3).
Maintain Source Structures
The second LMSW step is to maintain the source structures. Here you identify the structure or structures of your object. For example, the purchase requisition always has multiple structures (e.g., a header and an item), but some objects have only one structure (e.g., a purchase info record has only a data structure).
- Click the Maintain Source Structures radio button on the LSMW main screen (Figure 3), and then click the execute icon.
- Click the create icon in the screen that appears, and then enter a name for the header structure (not shown).
- Click the change and display icon
, and then click the create icon. Enter the header name you just created as the Source Structure and then add a description (Figure 5).

Figure 5
Create the header structure
- Click the enter icon
to display the header structure details (Figure 6).

Figure 6
Header structure created
- Click the PREQ_HEADER source structure, and click the create icon to define the second structure of the purchase requisition (not shown). Click the Lower Level radio button option (Figure 7).

Figure 7
Select the lower level structure option
- Click the enter icon and enter the item structure name (i.e., PREQ_ITEM in the Source Structure field) and Description (i.e., ITEM DATA), as shown in Figure 8.

Figure 8
Create the lower level item structure
- Click the enter icon and then the save icon
. Figure 9 displays the structures for the purchase requisition.

Figure 9
Final source structure for the purchase requisition
Maintain Source Fields
With the source structure is defined, you define the source fields that need to be assigned to the source structure. Figure 10 shows an example of a source field for the purchase requisition. A description of the field appears to the right (e.g., BSART is the document type). Take the following steps:
- To create source fields, execute the third step, Maintain Source Fields (Figure 3). The source field screen displays the header and item structures.
- Click the change and display icon, highlight the header structure (PREQ_HEADER, in this example) with your cursor, and click the table maintenance icon
.
- Enter the necessary field names, the data type (C), the length of each field, and the field descriptions. Repeat these steps for the PREQ_ITEMS item structure and then save the changes (Figure 6).

Figure 10
Source fields for PReq
You can define more fields based on your requirements. For example, if your requisition is an account assignment, then you can add an account assignment category field. If you want to create subcontracting or consignment PReq fields, you need to add an item category field. To add extra fields, click the table maintenance icon and enter the new field name with its data type, character length, and description.
Maintain Structure Relations
The next step is to maintain structure relations. Here you assign your header and item structures to predefined SAP system segments for this BAPI.
- Execute the fourth step, Maintain Structure Relations (Figure 3). The screen in Figure 11 appears with all the predefined segments for the PREQ BAPI. These segments appear automatically based on the BAPI selected in the first step. The only thing you have to do is assign your structures (i.e., header and item) to their respective segments.

Figure 11
PREQ BAPI segments
- To assign your header structure, click the change and display icon. Highlight the header segment with your cursor and click the Relationship button (Figure 11). Select PREQ_HEADER in the pop-up dialog box and press the enter icon (Figure 12).

Figure 12
Assign structure to segments
- Repeat the previous step for all segments (Figure 13). Save the assigned structures.

Figure 13
Structure relationships completed
Maintain Field Mapping and Conversion Rules
Next, you assign the source fields you created with step 3 to SAP defined fields. For more detail about this step, refer to the earlier referenced articles
Maintain Fixed Values, Translations, and User Defined Routines
This step applies only if you are using subroutines. No action is needed here when you are using standard BAPIs or IDocs, so you can skip this step.
Specify Files
Before performing this step in SAP LSMW, you need to prepare two Excel files: one for the header data and one for the item data. These files contain all the fields as defined in the third step (Maintain Source Fields) of the LSMW (Figure 3). Because the LSMW can only pass a text file, you need to copy the header-related source fields (Figure 10) into an Excel spreadsheet and then save it as a text (tab delimited) file. You then have to enter the item-related source fields into an Excel spreadsheet and save it as a text (tab delimited) file as well.
Open an Excel spreadsheet, and enter the information related to the header. Cell A1 displays the ID field with a value of 1 in cell A2; cell B1 displays the document type field BSART (Figure 14). In the example, NB is the standard purchase requisition document type.

Figure 14
Header data file for PReq
Next, open another Excel spreadsheet —this time to define the item data field (Figure 10). As shown in Figure 15, you enter the information as it relates to the items (e.g., BNFPO is the prerequisite item number with a value of 10).

Figure 15
Item data file for PReq
Be sure you save each file as a text (tab delimited) file. See the sidebar “Save an Excel Spreadsheet as a Text File.”
Save an Excel Spreadsheet as a Text File
Click Save As in Microsoft Excel to open the Save As dialog box (Figure 16).
Then select the type of file you want to save it as (i.e., Excel
Workbook or Excel Macro-Enabled Workbook). Enter a File name, then click
the Save as type arrow, and select the Text (Figure 17).
Once you’ve saved your file, close Excel. Navigate to the location
where you saved the file and click the text file, which opens it in
Notepad (Figure 18).

Figure 16
Excel Home tab with Save As option

Figure 17
Save spreadsheet as a text file

Figure 18
Item text file for purchase requisition
Keep the text files handy as you need to use their contents as input in a later step in the SAP LSMW process.
Note
You can download sample files with PReq header and item data at the end of this article.
Once you create the text files, execute the Specify Files step. Click the change and display icon, then highlight the first row with your cursor ((i.e., Legacy Data). Click the create icon (Figure 19).

Figure 19
Specify the text files
The File on Front End: Maintain Properties screen appears. Select the Excel file from your desktop that you saved earlier (Figure 16) as shown in Figure 20.

Figure 20
Specify the header text file
Once you are done with the header file, highlight the HEADER FILE field and again click the create icon. Open the Excel item file and specify the indicators, as shown in Figure 21.

Figure 21
Specify the item file
Save your changes (Figure 22).

Figure 22
Specify files step completed
Assign Files
In the previous step, you specified the necessary files. Now you assign them to the structures (i.e., header and item). Execute the assign files step by selecting the Assign Files radio button (Figure 3), which displays the screen with your structures. Click the change and display icon, highlight PREQ_HEADER, and click the assignment button (Figure 23).

Figure 23
Assign the header and item files
Once you assign both files to their respective structures, save the changes. Figure 24 displays the final screen of the assign files step.

Figure 24
Assign files step completed
Remaining Steps in the SAP LSMW
There are several more steps you need to complete before you’re finished (Figure 25). Just execute them one by one in this order — no data entry is needed, you just need to execute each step as follows.

Figure 25
Remaining LSWM steps
After you take the Create IDoc Overview step, you see results of the data creation process (Figure 26). If the light in the Status field is green, then you know the data was created successfully.
Note
Please refer to SPA LSMW articles mentioned earlier for more details about analyzing IDoc results.

Figure 26
IDoc results
The following section explains how to use a BAPI or IDoc method for migrating the remaining five procurement objects. Each screenprint is intended to replace Figure 4 in the process above. The rest of the process is the same as the one you just completed for the purchase requisition object.
PO
To upload data into an SAP system for a PO, you can use either the BAPI (Figure 27) or IDoc method (Figure 28).

Figure 27
BAPI method for a PO

Figure 28
IDOC method for a PO
Scheduling Agreement (SA)
To upload data into an SAP system for a scheduling agreement (SA), you can choose either the BAPI method (Figure 29) or the IDoc method (Figure 30).

Figure 29
BAPI method for an SA

Figure 30
IDoc method for an SA
Contract (MK)
The LSMW BAPI method and IDoc method are shown n Figures 31 and 32, respectively.

Figure 31
BAPI method for a MK

Figure 32
IDOC method for a MK
Purchasing Information Record (PIR)
There is no standard BAPI method provided by SAP LSMW for a PIR. Therefore, the best method for a PIR upload is the LSMW IDoc method (Figure 33).

Figure 33
IDoc method for PIR
Source List (SL)
The following IDoc method is used to create an SL via LSMW (Figure 34).

Figure 34
IDoc method for an SL
Sample Header and Item Data Files
- Purchase Requisition
- Purchase Order
- Scheduling Agreement
- Contract
- Purchase Order Information Record (only one file is needed as there is no need to have separate header and item data files)
- Source List
Yogesh Lohiya
Yogesh Lohiya is a senior SAP MM consultant with Infosys. He is currently working on a large data migration project for a Fortune 500 client. He has more than nine years of consulting experience. He also has worked on various SAP global rollouts and data migration projects in the materials management area.
You may contact the author at ymlohiya@gmail.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.