Sunteți pe pagina 1din 37

Utilizing LSMW for Pricing Conversions

A Different Approach
to Converting Your Legacy Pricing Records
By Matthias Liebich, MLI Solutions, LLC
Editor's Note: SAP pricing expert Matthias Liebich has found some nifty ways to convert
pricing data. And he wants SAPtips readers to know that you don't have to be a super techie to
take advantage of some of these techniques. And that's important, because as Matthias points
out, if you can avoid paying for custom conversion and use a tool that SAP provides instead, you
should be able to save some serious time and money. In this comprehensive how-to guide,
which was written for both functional and technical SAP users, Matthias explains how to use the
LSMW tool to automate the conversion of pricing data from legacy systems to R/3. This thirty-sixpage paper is comprehensive enough to serve as the main guide for such a conversion. With this
paper to refer to, SAPtips readers should have a clear understanding of each step in the process,
from the initial conversion preparation phase to the final step of running the batch data
conversion. Matthias closes the white paper with some tips for adding new condition tables after
the initial setup, and a few recommendations for optimal conversion results.
Introduction
SAP states that between twenty and forty percent of implementation costs are consumed by
data migration tasks, which can mainly be attributed to the writing and testing of custom
conversion programs. Available since R/3 Release 3.0F, SAP provides a free tool (dont we all
love that?) called the Legacy System Migration Workbench, or, for short, LSMW. This standard
tool converts legacy data to SAP and can reduce your conversion cost and time by more than
30%.
Generally speaking, the LSMW does 3 things:

Imports legacy data from spreadsheets or sequential files.


Converts data from source format to target format based on LSMW defined rules.
Imports data to R/3.

At first sight, LSMW looks technical in nature. However, please do not stop reading this white
paper if you are a functional user. Stay with me, because LSMW is designed to be used
interactively. To prove my point, this white paper will show you through step-by-step instructions
how easy it is to set up a conversion object in LSMW. I also supplemented my explanations with
lots of screen prints.
For our example, we will convert pricing condition records from a legacy system with the batch
input method. I promise you that you can set up this pricing conversion in less than three hours!
LSMW and R/3: Release Compatibility
Originally developed to support the migration from the mainframe SAP R/2 system to SAP R/3,
LSMW functionality increased throughout multiple release changes. The applicable LSMW
release for your SAP R/3 release is:

LSMW 1.0 for SAP R/3 3.0F-3.1X


LSMW 1.7 for SAP R/3 4.0-4.5
LSMW 1.8 for SAP R/3 4.6
LSMW 3.0 for SAP Systems with Web Application Server 6.10

Our example is executed with LSMW 1.7 on a SAP R/3 4.6C system (note that while you can run
LSMW 1.8 only on 4.6C, you can also run older versions such as 1.7 on 4.6C, which is what this
client did).

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 1

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
LSMW can be used for different kinds of modules (FI, SD, MM, CO, etc.) and offers different input
techniques such as batch input, direct input, IDOC, and BAPI processing.
LSMW does not provide a static conversion program. The conversion program is generated
based on the mappings and rules defined in the LSMW setup.
Although LSMW takes care of loading information to SAP, you will still need to develop extract
programs in your legacy system to provide the data to be loaded.
LSMW projects can be transported, but can also be maintained directly in each system (test,
production) individually. When transporting the project, all sub-projects and objects linked to it are
transported as well. I always recommend transporting the project to ensure consistency across
the promote-to-production path.
Detailed documentation about LSMW, as well as conversion examples, can be found at the SAP
service site http://service.sap.com/lsmw (OSS user ID required).
OSS support is available under BC-SRV-DX-LSM.
NOTE: LSMW is not delivered with the standard SAP R/3 system, but can be downloaded for free
from the service Web site mentioned above.
Authorizations
With the installation of LSMW, standard authorization objects are delivered that can divide
responsibilities between setting up the conversion objects and actually executing the conversion.
Detailed authorization information can be found in the quick reference guide on the Web page
mentioned above under LSMW-Media Center-LSMW Version 1.7 (or the version that is applicable
to your SAP R/3 release)-Literature LSMW 1.7.
Conversion Preparation
Before you start configuring LSMW, make sure that the following tasks have been completed:

Determine if LSMW should be used. Identify which conversion technique will work best. For
example, small amounts of data might not warrant the effort to set up the LSMW object.
Converting with the batch input technique might not be suitable for converting large amounts
of data either, so in these cases, you might opt to use IDOCs or BAPIs.
SAPs rule of thumb for processing data with batch input is about 10.000 records per hour,
which can greatly vary depending on your hardware. At the end of this white paper, I will
make some suggestions on how to speed up processing time by setting up your conversion
files. I was able to convert 700,000 condition records in less than 24 hours, which is three
times SAPs guideline.

Complete pricing configuration. All condition types with their respective access sequences
and condition tables have to be in place.

Map all legacy fields to SAP R/3 fields. Write down all fields of all condition tables that should
be converted. This will help to define the file structure that you are going to load to SAP. An
example of such a structure, and the one we will use in our example, is shown in Figure 1. In
this case, we are going to convert condition types PR00, K005, and K007 with their
respective condition tables A005 and A007. This structure needs to be filled by the extraction
program from the legacy system.

NOTE: A detailed checklist for preparation tasks can be found on the LSMW service Web site
under LSMW-Media Center-your applicable version-Literature LSMW.
Copyright 2004 by Klee Associates, Inc.
www.SAPtips.com

Page 2

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
Cond Table Sales Dist
SAP
Material
type
Nbr
Org
Chnl Division Customer Number
PR00 005
1000 01
101619 mat-001
PR00 005
1000 01
101619 mat-002
PR00 005
1000 01
101619 mat-003
PR00 005
1000 01
101620 mat-004
PR00 005
1000 01
101621 mat-002
PR00 005
1000 01
101621 mat-003
K005 005
1000 01
101619 mat-001
K005 005
1000 01
101619 mat-002
K005 005
1000 01
101619 mat-003
K005 005
1000 01
101620 mat-004
K005 005
1000 01
101621 mat-002
K005 005
1000 01
101621 mat-003
K007 007
1000 01
02
101622
K007 007
1000 01
02
101621
K007 007
1000 01
02
101619
Figure 1: Pricing Conversion File Layout

Price
Rate UOM
100.00 EA
75.00 EA
34.00 EA
100.00 EA
75.00 EA
34.00 EA
1.50 EA
3.00 EA
4.50 EA
5.00 EA
2.00 EA
0.75 EA
5.00
3.50
2.75

Rate
Unit
USD
USD
USD
USD
USD
USD
USD
USD
USD
USD
USD
USD

Valid on
Date
20040101
20030615
20030930
20040101
20030615
20030930
20040101
20030615
20030930
20040101
20030615
20030930
20040101
20030615
20030930

Valid to
Date
20051231
20051231
20051231
20051231
20051231
20051231
20051231
20051231
20051231
20051231
20051231
20051231
20051231
20051231
20051231

Conversion Steps
The LSMW conversion project can be divided into two main steps. Step 1 is the set up of the
conversion project that includes defining the conversion technique (BDC, IDOC or BAPI), the
source structure, and the field mappings. Step 2 is the actual execution of the conversion.

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 3

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
Step 1: LSMW Setup
a. Set Up Conversion Project
Entering transaction LSMW will bring you to the Legacy System Migration Workbench. Enter a
project name, a sub-project, and an object. The combination of these three values identifies the
unique rules for a specific conversion, in our case, the conversion of stock prices. There are no
naming conventions. For our example, we assume that our project is Conversion, our subproject is Pricing and our object is Stockprice. Click on the Create entry button
be asked to enter a description for each of the fields (See Figure 2).

. You will

NOTE: A customer master object could be created later with its own rules and conversion
technique under the same project.

Figure 2: Legacy System Migration Workbench

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 4

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
After selecting the Execute button
, the system will show the interactive process guide with
all necessary conversion steps in chronological order (see Figure 3). The steps shown are the
minimum steps required for a successful LSMW conversion. This screen also shows when a step
was last executed and by whom.

Figure 3: LSMW Steps for Setup and Conversion

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 5

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
Selecting the
button opens a selection screen that allows the option to add
additional steps (see Figure 4). If you would like to revert to the minimum steps required, select
.

Figure 4: Selection of LSMW Steps

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 6

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
b. Maintain Object Attributes
After selecting all desired steps, it is time to start setting up the LSMW rules for the pricing
conversion. First, the conversion object attributes have to be defined. To do this, select step
Maintain Project Attributes (see Figure 3). The object name is proposed from the initial LSMW
screen as well as the user maintaining the object. For our purposes, we want to select the data
transfer once since we are not making periodic changes. Select the object type and the import
technique. For our pricing conversion example, select 0070 (condition record) as the object.
Choosing the pull-down on the Method field will automatically bring in the standard SAP pricing
conversion program RV14BTCI, which can be reviewed when selecting the detail glasses next
to it. Save the settings as shown in Figure 5.
NOTE: This is the area where you could choose BAPI or IDOC import techniques for other object
types like sales orders or customers.

Figure 5: Definition of Object Attributes

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 7

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
c. Maintain Source Structures
Now we select the Maintain Source Structures option. The name of the structure is freely
definable. Since all of our data will be stored in one file, we only set up structure
PRICE_RECORD (see Figure 6). If data would be stored in multiple files, all of these files and
their hierarchical relation to each other would have to be defined here. Save the structure.

Figure 6: Definition of Source Structures

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 8

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
d. Maintain Source Fields
Next, we need to Maintain Source Fields. There are several techniques on how to do that.

Fields can be entered manually one by one as shown in Figure 7 by clicking the Create field
button

To enter the data in table format all at once, select the Table maintenance button
(see
Figure 8).
Another possible way to create source fields is through copying (for example, from KNA1 for
. Fields then can be
customer master data) by selecting the Copy Source Fields button
copied from a tab delimited text file, standard SAP Data Dictionary tables, or from another
object (see Figure 9).

After all necessary fields of the structure are defined, they can be altered, if necessary, after
double clicking their field name. A separate window opens, showing field information like field
length, type, and its description. For example, you might have copied a field from a standard SAP
structure and want to make it a selection field for subsequent steps (we will see the effect during
Read/Convert Data). To do this, mark the check box for Selection parameter for Read
data/convert data. After all necessary modifications are done, save the source fields.
NOTE: The structure defined here has to match the structure of our conversion file (see Figure
1). This means besides the fields of the condition tables, all other fields like condition type, rates,
and validity dates have to be defined here as well.

Figure 7: Definition Of Source Fields

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 9

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records

Figure 8: Maintain Source Fields in Table Format

Figure 9: Copying Source Fields


Copyright 2004 by Klee Associates, Inc.
www.SAPtips.com

Page 10

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
e. Maintain Structural Relationships
The next step in the set-up process is Maintain Structure Relations which defines the
relationships between the source and target data structures. Depending on which conversion
object was selected in the object attributes (in our example, condition records), SAP proposes all
applicable structures and their hierarchy (see Figure 10). It is indicated which structures are
mandatory to be populated (in our example BGR00 and BKOND1) and which ones are optional
(for example, in our conversion we are not dealing with scales, therefore we dont need to assign
a source structure to target structure BKOND3). To assign the structure we previously defined in
step Maintain Source Fields, select each applicable BDC structure and then click the
button. Since we only have one structure, it will be automatically assigned. If
we had had multiple source tables, a pop-up would have let us select which structure to assign.
After all structures are assigned, save the configuration.

Figure 10: Assigning Source Structures to Target Structures

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 11

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
f.

Maintain Field Mappings And Conversion Rules

Maintain Field Mapping And Conversion Rules is the most difficult part of the setup, but also the
most important one. Depending on the structures that were selected in the previous step to be
used in the conversion, more or fewer fields are displayed. Although SAP mentions that no ABAP
is needed to accomplish a successful LSMW conversion, we will need to add some code for the
pricing conversion. This is due to the nature of the condition technique and the variable key of the
condition tables. (The key differs per condition table depending on which fields are in the table.)
ABAP is needed to fill this key correctly. I will limit the ABAP sections to a minimum (since you
can get really creative if you want).
When accessing this LSMW step for the first time, not all options might be displayed (for
example, you are not able to add any kind of custom ABAP code). To enable additional options,
, which lets you select up to six additional options. Select
click on the Display Variant button
all of them and click on the check mark (see Figure 11).

Figure 11: Additional Conversion Options

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 12

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
The first area to maintain is _GLOBAL_DATA_. This is the place to define global data definitions
and declarations like variables, internal tables, etc. Here we will define internal tables for the key
of each condition table we are trying to convert. In order to add this code, double click on
GLOBAL_DATA_. This opens the ABAP editor (see Figure 12). For our example, we are using
the standard condition tables A005 (Sales organization, Distribution Channel, Customer, Material)
and A007 (Sales organization, Distribution Channel, Division, Customer). In addition, we define
internal tables for temporary fields and the variable key. After adding all necessary code, save the
editor and click the green arrow back. You can see the added code now under the
_GLOBAL_DATA_ section (see Figure 13). Save the changes.

Figure 12: ABAP Editor for _GLOBAL_DATA_

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 13

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records

Figure 13: Defining Global Data Structures

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 14

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
The first target structure to map is BGR00, which includes general batch input objects (see Figure
14). Depending on your preferences, the default settings can be changed. For our example, I
changed the BGR00-XKEEP field from a space to X, which will keep the BDC session after it is
successfully processed. The space setting would have deleted the session. To make the change,
double click on the field as described above to get into the ABAP editor. Another suggestion,
which is not described in detail for this white paper, would be to change the BDC session name
(BGR00-GROUP) to something more meaningful than the default object name, such as the
condition type that is converted or a date stamp.

Figure 14: Batch Input Structure for BDC Session BGR00

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 15

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
In structure BKOND1, we are going to fill the variable condition key with the individual condition
tables depending on which table number is defined in our conversion file record (see Excel
conversion file in Figure 1). We define this in _BEGIN_OF_RECORD_. As before, double click on
the field to add code in the ABAP editor.
Fill the target table number with the number in our conversion file record (PRICE_RECORDTABNUM). Then call a perform routine (we are getting to the code for this later in the form routine
section) that will retrieve the respective condition table key, with which we fill the BDC structure
variable key (G_VAKEY-VAKEY). We are doing this for every condition table needed in our
conversion (A005 and A007). The complete code can be seen in Figure 15.

Figure 15: Batch Input Structure for BDC Header Data

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 16

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
For fields in this structure that always have the same field value, we can define fixed values such
as the transaction code we want to use for the conversion. To add a fixed value, right-click a field
(for example, TCODE) and select Insert Rule. From the proposed options, select Fixed value
(reusable) (see Figure 16).

Figure 16: Setting Fixed Values

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 17

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
On the next screen, confirm that you want to change the transaction code. The following screen
displays the details about the transaction code field. Under Value, enter VK15 and click the
check mark (see Figure 17). Save the setting. For our example, repeat these steps for field
KVEWE (field value A) and KAPPL (field value V for those of you who always wondered, the
V stands for the German word for Sales = Vertrieb).

Figure 17: Maintaining Fixed Value VK15 for Field Transaction Code

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 18

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
For the remaining fields in structure BKOND1, we need to assign the source fields of our source
structure to the target fields of the SAP BDC structure. In order to do this, select a field (for
example KSCHL) and click on the Assign source field button
. A pop-up screen
(see Figure 18) will show all fields of the source structure we defined above (see Figure 7). Select
KSCHL to assign our condition type. Repeat this step for field KOTABNR and assign our
condition table number field. Save the settings.

Figure 18: Assigning Source Fields to Target Fields

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 19

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
In structure BKOND2, no development is needed. We only need to assign our source fields, as
described above for the following target fields (see Figure 19):
Assign PRICE-RECORD-DATBI to DATBI
Assign PRICE-RECORD-DATAB to DATAB
Assign PRICE-RECORD-RATE to KBETR
Assign PRICE-RECORD-RATEUNIT to KONWA
Assign PRICE-RECORD-PRICEUOM to KMEIN

Figure 19: Batch Input Structure for Main Data

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 20

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
In _BEGIN_OF_RECORD_ we added perform commands for structure BKOND1. The respective
form routines are maintained under _FORM_ROUTINES_ (you are correct; double-clicking that
field opens the ABAP editor). To populate standard SAP table A005, we fill the variable condition
table key as shown in Figure 20 with the sales organization, distribution channel, customer, and
material number of our source structure. We create one form routine per condition table to be
converted. Save your settings.

Figure 20: Form Routines to Populate Variable Pricing Key

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 21

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
g. Maintain Fixed Values, Translations, User-Defined Routines
The last step in the LSMW setup is to Maintain Fixed Values, Translations and Individual
Routines. In case we would not have maintained fixed values in step f) above, we would be able
to manually add them here (see Figure 21). After saving the settings, the LSMW setup for our
pricing conversion is complete.

Figure 21: Maintaining Fixed Values

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 22

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
Step 2: LSMW Conversion
a. Specify Files
Now it is time to convert the legacy data from our conversion file. Save the Excel file in Figure 1
as a tab delimited text file on your PC. Make a note of where you saved the file. In LSMW step
Specify Files, select Legacy data On the PC (frontend) and click on the Create entry button
. The following screen allows you to browse your PC and network directories to select the file
you just stored as the tab delimited file. Select all the fields as shown in Figure 22 (make sure you
select the Tabulator delimiter), click on
file that you would like to convert.

, and save your settings. Repeat this process for each

Figure 22: Specify Conversion Files

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 23

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
b. Assign Files
In this step, we assign the file we just specified as our source file. When the source data is read
in the next step, the system knows which file to process. To create the assignment, select the
button. If multiple files were
source structure PRICE_RECORD and click on the
specified in the previous step, all of them are proposed in a pop-up screen (see Figure 23). Select
the file you wish to process. Once the file is assigned, save.
After one file is successfully processed (in the next steps), its assignment needs to be deleted
before we can assign a new file. To do this, select the actual file and click on the Delete
Assignment button

(see Figure 24).

Figure 23: Selecting Files for Source Structures

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 24

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records

Figure 24: File Conditions_Convert.txt Assigned to Conversion File

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 25

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
c. Read Data
In the Read Data step, the assigned source file is read. As I mentioned in step 1(d) above, all
source fields with the selection of the Selection parameter for Read data/convert data field are
shown here as available selection fields. These can be used to segment the type of data to be
read. Also, the selection field Transaction Number can be used to limit the number of records to
be read. To eliminate the header line of our source file to be processed, exclude Cond as a
condition type. Execute this step with the settings as shown in Figure 25. The resulting report will
display the number of records read and written (see Figure 26).

Figure 25: Selection Screen for Read Data

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 26

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records

Figure 26: Results of the Read Data Step

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 27

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
d. Display Read Data
The source file we just read in the previous step can now be displayed in table form. This is a
good control step to see if any corrupted or unnecessary data was selected. The selection screen
lets you limit the number of records to be displayed, which can be useful when processing a large
number of records (From line and To line, see Figure 27).

Figure 27: Limiting Number of Records to Be Read in Step Read Data


The resulting display (see Figure 28) shows each individual record with its respective fields.
Clicking on a line will display all information for this line in a separate screen (see Figure 29). This
might be useful if the record length would exceed the width of your screen.

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 28

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records

Figure 28: Read Data in Table Form

Figure 29: Read Data Record in Detail View

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 29

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
e. Convert Data
In this step, the conversion program is being generated based on the rules specified in the LSMW
setup. As in the Read Data step, you see selection fields based on the settings in the source
fields (see Figure 30). There is no need to specify any selections. Execute the program. The
resulting report (see Figure 31) shows how many records were processed and how many records
were written

Figure 30: Selection Screen for Converting Data

Figure 31: Results of Data Conversion

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 30

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
f.

Display Converted Data

As in the Display Read Data step, the converted data can be displayed. The number of records
can be limited here as well (with From line and To line see Figure 32).

Figure 32: Selection Screen for Displaying Converted Data


The resulting display shows the conversion structures BGR00, BKOND1, and BKOND2
(remember, these are the structures we defined and mapped fields for in the setup stage) with
their respective data (see Figure 33). It is also possible to see the detail of an individual record by
clicking on it once (see Figure 34).

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 31

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records

Figure 33: Displayed Converted Data

Figure 34: Converted Data Record in Detail View

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 32

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
g. Create Batch-Input Session
Finally, after all the hard work, this step will create the batch-input session based on the
converted data from the object above. The sessions that are being generated are named the
same way as the LSMW object (STOCKPRICE). The selection screen defaults the maximum
number of records per transaction and other counters as seen in Figure 35. Leave the settings as
is. After executing the program, a message indicates the opening of a BDC session. After
processing the data, another message indicates when the BDC session is closed. Confirm both
messages.
NOTE: If there are more records in the conversion file than the limit indicated below, a second
session is opened and closed. This continues until all records of the conversion file are
processed.
CAUTION: If this step is executed twice, the number of BDC sessions and their content are
duplicated.

Figure 35: Selection Screen for Creating Batch-Input Sessions

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 33

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
h. Running the BDC session
Since we did not change the group name of the BDC session in the LSMW setup, our created
BDC session is displayed after executing this step, named like the LSMW object STOCKPRICE
button. You can then decide if
(see Figure 36). Select the session and click on the
you want to run the session in foreground or in batch. If you are running the session for the first
time, I always recommend doing so in the foreground. Step through at least one full transaction to
verify that all fields are in the right place. If there are issues, you can easily exit out of the session,
fix the problem, and re-run the conversion steps.
The conversion program groups the data from our file automatically in a way that a separate
transaction is executed for each condition type, condition table, customer, and potentially different
validity period (see Figure 37 and 38).

Figure 36: BDC Session Overview

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 34

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records

Figure 37: Pricing Create Transaction Part 1

Figure 38: Pricing Create Transaction Part 2


The completion of the BDC session completes our pricing conversion.
Copyright 2004 by Klee Associates, Inc.
www.SAPtips.com

Page 35

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
"But I want to convert a new condition table what now?"
Relax. The main work is already done. Lets assume that you have a condition table A900 that
includes the sales area, customer group, and material group.
First, you have to decide where in your Excel spreadsheet these fields should be inserted.
Assume for now that the customer group is placed right after the customer field and the material
group right after the material. Going back to our initial LSMW conversion setup, complete the
following additional steps:
1)d): Add the two new fields to your source fields. It is important that these fields are inserted in
the same order as they appear in the Excel spreadsheet.
1)f): Changes need to be made in three places:

_GLOBAL_DATA_: Add an internal table G_VAKEY_900 for table A900


_BEGIN_OF_RECORD_: Add perform for table A900
_FORM_ROUTINE_: Fill variable key with the fields of table A900

Voil. You see, once the LSMW object is set up, it is really easy to expand it.
A Few Recommendations
We used a simple structure for our example with only a few records for multiple condition types.
Obviously, you will use the LSMW tool for larger amounts of data than this. I advise using one
spreadsheet per condition type. You could still include multiple condition tables for this particular
condition type in the same spreadsheet. As indicated in step 1)f), the BDC session name could
be coded to include the condition type, making the identification of the BDC sessions easier.
Otherwise every BDC session would be called STOCKPRICE. In addition, you will be able to
run multiple BDC sessions in parallel, making the conversion process even faster.
Conclusion
I sincerely hope that this white paper showed you the benefits and power of the LSMW tool and
provides a viable option for your conversions. Remember, besides converting legacy data, LSMW
can also be used for loading master data or documents based on information that is stored in
spreadsheets.
One last thing. Did it take you longer than 3 hours to set up your LSMW object? I hope not, since
I like to keep my promises.
Matthias Liebich, MLI Solutions, LLC. Matthias has over 12 years of SAP SD consulting
experience, acquired during numerous full life cycle implementations in the US and Germany. He
is SD certified and has extensive hands-on experience in new implementations, upgrades,
mergers, divestitures and bolt-on integration. Beyond the core SD functionality, Matthias is an
expert in the areas of Pricing, Contracts and Rebates. In addition to his cross-module functional
knowledge, he is also proficient in ABAP, enabling him to play a leading role as link between
functional and technical teams. He can be reached at Matthias.Liebich@SAPtips.com.

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 36

Utilizing LSMW for Pricing Conversions


A Different Approach
to Converting Your Legacy Pricing Records
The information in our publications and on our Website is the copyrighted work of Klee Associates, Inc. and is owned by
Klee Associates, Inc.
NO WARRANTY: This documentation is delivered as is, and Klee Associates, Inc. makes no warranty as to its accuracy
or use. Any use of this documentation is at the risk of the user. Although we make every good faith effort to ensure
accuracy, this document may include technical or other inaccuracies or typographical errors. Klee Associates, Inc.
reserves the right to make changes without prior notice.
NO AFFILIATION: Klee Associates, Inc. and this publication are not affiliated with or endorsed by SAP AG. SAP AG
software referenced on this site is furnished under license agreements between SAP AG and its customers and can be
used only within the terms of such agreements. SAP AG and mySAP are registered trademarks of SAP AG.
All other company and product names used herein may be trademarks or registered trademarks of their respective
owners.

Copyright 2004 by Klee Associates, Inc.


www.SAPtips.com

Page 37

S-ar putea să vă placă și