Mass change of customers
Let's suppose we want to change for a specific company code the accounting clerks in a series of customer master data.
Step 1. Make an Excel sheet with numbers of the customers to update.
We create with XLR3 Data Extractor or SE16 an Excel sheet with 3 columns: customer number, company code and accounting clerk like in the following example:
Step 2. Create a record type for customer change transaction FD02.
Launch the XLR3 data injector if it is not yet done and in the menu Record Types, choose the command Add from transaction recorder. Enter the transaction code FD02 and your sap system identificator.
Once the transaction has finished you come back to the XLR3 Data Injector and you should have a record type created similar to the following one:
You see that the record type created is a recording called FD02_1 that contains 2 screens containing each some fields with initial (or default) values.
Pay attention that all the fields in the record type will be assigned values at run time. If you have other fields included in your record type that you don't want to overwrite in SAP, you should delete them from the record type to keep only the fields that need values for the purpose of your mass change.
Step 3. Linking the record type with the Excel sheet.
Our record type beging ready, we may link it to an Excel sheet. As we want to make one transaction (FD02) call per row of the Excel sheet, we need to assign the Excel sheet containing our data directly to the record type (highest level). For this purpose we select the record type name (FD02_1) and the menu command Record Types -> Assign Excel sheet like in the following picture.
Once the Excel sheet is assigned to the record type you notice that a loop arrow icon is placed in front of the name of the record type in the left pane of the XLR3 Data Injector Window.
Step 4. Assignment of Excel sheet columns to fields of the record type.
An Excel sheet being assigned to the record type, it is now possible to assign columns of this Excel sheet to fields of the record type.
We have 2 possibilities for this purpose. Both methods are going to be shown here.
Method 1: manual assignment of record type fields.
This method lets you choose manually which fields in the record type must be mapped to which columns of the Excel sheet.
To proceed this way, you need to select the fields of the record type to which you want to assign Excel columns and select the menu command Record Types -> Assign constant or Excel values
In the displayed dialog box, you need to select the option Assign Excel values from specifying the Excel sheet assigned to the record type. You also need to specify the column that you want to assign by entering either its letter (A, B, C, ...), its number or the column header name (if the sheet has a header row). As we have defined a header row, we are going to specify the name of the column in the header row. For the field RF02D-KUNNR, it is the column KUNNR so we enter KUNNR in the column header name field.
Once a record type field is assigned to an Excel sheet column, you see that its appearance is changed to reflect the assignment. You may proceed the same way to assign record type field RF02D-BUKRS to Excel column BUKRS and field KNB1-BUSAB to column BUSAB.
Method 2: automatic field mapping.
When the number of fields to assign between the record type and the Excel sheet is more important, the assignment operation becomes time-consuming and you should in this case use the automatic mapping of fields.
The automatic mapping requires that the Excel sheet header fields names be identical to the record type fields names. So to use automatic mapping, we need to change the header row of our Excel sheet to have RF02D-KUNNR, RF02D-BUKRS and KNB1-BUSAB as titles of the columns to assign to the corresponding record type fields.
As we want to map the fields contained in all the screens (we have only 2) of the record type, we select the record type name (FD02_1) and the menu command Record Types -> Automapping. The three Excel columns are then automatically assigned to the 3 record type fields having the same names and the result corresponds to what is show here:
Step 5. Generation of records.
Based on the record type, we can now generate the records that will be injected into the SAP system. To do this, select the record type named FD02_1 and the Data Generation in the tab control and select the menu option Record Types -> Generate Code. Choose Yes when you get a confirmation message and you should get a default XLR3Script code in the coding window.
The code generated suits our needs so we don't have to modify it before executing it. Press the toolbar button Execute to generate the records. If everything happens correctly, you should see the number of records created next to the record type name. This number should correspond to the number of data rows in the Excel sheet (minus the header row). In our case we have 45 records created.
Step 6. Check of generated records.
Before injecting your records into your SAP system, you should verify them to be sure you didn't make any mistake during the generation. This can be done in the tab Data Inspection selecting alternatively the differents screens of the record type in the left pane of the window.
You should also note that selecting the record type name in the left pane gives you an overview of the statuses all the records generated for that record type. And selected a record type sceen field lets you modify that field in one or several generated record(s).
Step 7. Injection of data records.
When your records are ready, you may inject them in your SAP system by selecting the Data Injection tab.
You may use either direct transaction calls (most efficient method) or the batch input method.
When using the transaction calls, you may use parallel processing simply by specifying a number of tasks greater than one. You must use this option with care because each task requires a dialog task on the SAP server. It is adviseable not to go over 5 tasks for parallel processing but this is a mean value, all depends on the performance of your SAP installation. You may also choose to inject the records in background (invisible to you) in display errors only or foreground mode.
Alternatively, you may want to create one or several batch input file(s) that will be imported afterwards in your SAP system using the transaction SM35 and the command Import from file.
Step 8. Correction of data records.
Depending on the input method used (call transaction or batch input) the correction of errors will occur in the XLR3 Data Injector (Call Transaction) or in SAP (Batch Input).
When using the call transaction method, you should check the result of the data input when the data injection has finished. You may get the status of injected records by selecting the record type name in the left pane of the window and the Data Injection tab in the right pane. By selecting the Display errors only in the toolbar, you will see only records in error.
The correction of errors will usually be a progressive task due to the multiplicity of the sources of errors. These sources may be:
- Related to SAP technics. It is possible that some resources be unavailable when you try to access it. For example, records that you want to update may be temporarily locked by other users or even by yourself in the case of parallel processing. You should consequently launch several times the data input until the number of errors remain constant. Then there is a great likelyhood that remaining errors are due to the data and not to the framework anymore.
- The SAP configuration. All errors due to SAP configuration, customizing, ... must be solved in SAP before restart of the data injection.
- The data records content. When data records are incorrectly filled in, they must be modified. If the needed modification is simple (put a constant in a field, ...), it may be treated directly in the Data Injection tab manually. In more complex cases, you should use the Data Correction tab and generate a default XLR3Script correction code. It is then up to you to adapt this code based on the needed modifications to the records. Please refer to XLR3Script reference for more information on how to adapt your script.
|