Professional Documents
Culture Documents
Track8 Session4
Track8 Session4
2
What Is Data Conversion Really?
3
Data Conversion Used to Be...
• A one-time activity
! Usually only during initial SAP implementation
! Or to bring in data from non-SAP systems
• ABAP-focused
! Single-use ABAP programs were developed to perform highly
specialized conversions
• Expensive
! One-time activity – not much attention paid to it
! Part of the huge SAP implementation budget
4
Data Conversion Is Now a Day-to-Day Activity
• Example scenarios
! Mass updating customer master records to reflect a revised
organizational structure
! Mass updating sales orders to reflect changes in pricing/
expected delivery/account assignments
! Uploading batches of purchasing requisitions/orders
! Uploading batches of customer/vendor invoices
5
Today’s Data Conversion Toolbox
6
Today’s Data Conversion Toolbox (cont.)
• Computer Aided Test Tool (CATT)
! Part of ABAP Development Workbench for testing SAP
transactions
! Single test cases can be linked together to test an entire process
! New eCATT in Web Application Server (WAS) can test cross-
system and Web applications as well!
• Limitations
! Limited conditional (if-then-else) processing t-code
! Data massaging not possible SCAT
7
Today’s Data Conversion Toolbox (cont.)
8
Today’s Data Conversion Toolbox (cont.)
• Mass Maintenance
! Generic (cross-application) tool to change large quantity of data
o Mass Maintenance or Mass Updates
! Introduced in Release 4.5A as a part of standard system
o Refer to OSS# 126198 to retrofit to Release 4.0B
• Limitations t-code
! Limited to specific SAP objects only MASS
o Customers, vendors
o Material master records
o Purchasing info records
o etc.
! Cannot use conditional processing
o i.e., if..then..else logic
9
Today’s Data Conversion Toolbox (cont.)
• Mass Maintenance
10
Today’s Data Conversion Toolbox (cont.)
12
Key LSMW Features
13
LSMW Load Process – Overview
14
LSMW Load Process – Overview (cont.)
Conversion Rules
Read Data
1 : 1 Translation
Interval Translation Read Data
Initial value
Constant Convert program
Assign Source field
converts (reformats) the
Prefix/Suffix
source data into an R/3-
Concatenate …. Converted Data
specific format
Standard programs
upload converted SAP R/3 System
data to R/3 tables
OR
Batch Input Direct Input IDocs
Data is loaded via
batch input using
your recording 15
Loading Data with LSMW – A Quick Example
• Scenario
! You need to regroup many of your customers
o i.e., change a customer’s sales office, sales group, or
customer groups
• How it’s done in SAP
! Use transaction XD02 to update customer’s sales view
manually
o Provide customer key
# Customer number, sales organization, distribution
channel, division
o Update relevant fields on sales view screen
• Let’s do it instead with LSMW...
16
Conversion Prerequisite: Create a New Object
t-code
LSMW
17
Conversion Process Overview: Steps We’ll Cover
18
Step 1 – Maintain Object Attributes
20
Step 3 – Maintain Source Fields
21
Step 4 – Maintain Structure Relations
22
Step 5 – Maintain Field Mapping, Conversion Rules
23
5 – Maintain Field Mapping, Conversion Rules (cont.)
22
11
33
24
5 – Maintain Field Mapping, Conversion Rules (cont.)
25
5 – Maintain Field Mapping, Conversion Rules (cont.)
26
Step 6 – Maintain Fixed Values, Translations, etc.
• Fixed values
! e.g., company code 0001
• Translations
! e.g. if-then-else formatting
o If source A then target 0010
• User-defined routines
! ABAP coding for more complex custom logic
27
Step 7 – Specify (and Prepare) Source Files
28
Step 8 – Assign Files to Source Structures
29
Step 9 – Tell LSMW to Read the Source Data
30
Step 10 – Display Read Data
Double-click to
display the field
contents
31
Steps 11/12 – Convert and Display Converted Data
• The step “Convert data” converts the data into R/3 format
! LSMW uses conversion rules to reformat the data per R/3
definitions
! Optionally, you can display the converted data
o View how the source fields are reformatted to target
definitions, with conversion rules
32
11/12 – Convert and Display Converted Data (cont.)
Double-click to
display the field
contents
33
Steps 13/14 – Create and Execute Batch Input
34
Detailed Instructions Are on Your Take-Home CD
35
What We’ll Cover …
36
Getting LSMW Up and Running at Your Company
39
How Others Are Using LSMW
42
LSMW Tips and Tricks
43
LSMW Tips and Tricks: If-Then-Else Processing
44
Typical LSMW for VA02 Recording
VA02_REC
Transaction recording
for VA02 transaction
Assign plant
number from
source data file
45
If-Then-Else Processing (cont.)
• LSMW trick
! Use SKIP_RECORD or TRANSFER_RECORD
o SKIP_RECORD ignores the input record for processing
Solution
o TRANSFER_RECORD forwards the input row for processing
! Create a transaction recording and map fields from source
structure
• Double-click on “Maintain field mapping and rules”
1. Click on Extras
2. Click on Display variant
3. Choose Processing points checkbox
4. Review the _END_OF_RECORD_ section
o By default, coding is set as TRANSFER_RECORD
o Double-click on Coding and write a simple code with
SKIP_RECORD or TRANSFER_RECORD
46
Example: If-Then-Else Processing
47
LSMW Tips and Tricks: Variable Number of Lines
• Scenario
! You want to update all line items for specific sales orders, but
you don’t know how many line items there are
o i.e., there are variable numbers of lines
• Typical solution
! Create an input file with specific sales order numbers and all
line items for those orders
! Drawback:
o You first have to collect all orders and items in a single
file
# e.g., separate SE16 for sales order header table, and
then for order items table for these specific orders
48
Variable Number of Lines (cont.)
11 10001 10
Sales Order 10001 20
(VBAK-VBELN) 22
10001 30
10001 10013 20
10013 10013 30
10013 50
10024
10013 70
10025
10024 20
10025 40
10025 50 50
Variable Number of Lines (cont.)
VA02
Transaction
Recording
Assign Order
Number from
Source data file
Assign Item
Number
Change Plant to
1000
51
Variable Number of Lines (cont.)
• LSMW trick
! Use an input file with just sales order numbers
! Within LSMW, loop through the sales order item table (VBAP)
and use TRANFER_RECORD multiple times
SELECT POSNR
INTO VA02_REC-POSNR
FROM VBAP
WHERE VBELN = VA02S-ORDERNO.
TRANSFER_RECORD
ENDSELECT.
Solution
52
Example: Variable Number of Lines
53
Example: Variable Number of Lines (cont.)
54
Example: Variable Number of Lines (cont.)
• Extended scenario
! You want to update all line items for specific sales orders that
are not shipped yet
• Challenge
! Preparing an input file with sales order and item number
! For example:
o Prepare a data file with sales order numbers (SE16 on
VBAK)
o Based on sales order numbers, get the item numbers
(SE16 on VBAP)
o Based on sales orders and item numbers, get item status
(SE16 on VBUP)
o Prepare an input file with sales order and item numbers
56
LSMW Tips and Tricks: Variable Number of Lines (cont.)
10025 40 10025 40 C
10025 50 10025 50 B
57
Variable Number of Lines (cont.)
• LSMW trick
! Use an input file with just sales order numbers
! Within LSMW
o Loop through sales order item table (VBAP); get item
numbers
o Find the delivery status from VBUP table
o If delivery status <> complete
# Use TRANSFER_RECORD
Solution
58
Example: Variable Number of Lines (cont.)
59
LSMW Tips and Tricks (cont.)
60
Resources
62
7 Key Points to Take Home (cont.)
63
Your Turn!