Create a ME21N Multiline Template

The steps below explain how to create a ME21N Multiline Template. Before proceeding, it is recommended that you know how to Perform a Simple Upload and you have read over the recording Tips and Tricks.

  1. Go to the Data Page in Syniti Data Workbench.
  2. Click Record a Template.
  3. On the Template Information tab, enter the transaction code to record. The following steps use ME21N as an example.
  4. In the Template Type field, select BDC Template.
  5. On the Recording Options tab, make sure that Batch Input is checked.
  6. Give the template a meaningful name, typically a brief description of what actions you are performing during the recording.
  7. Optionally, add a description. This may be helpful if you have notes to add about the recording or you want to distinguish this recording from other similar recordings.
  8. Uncheck Create Load File on the Load File Options tab. The load file is created later in the tutorial.
  9. Click Record Template. The SAP GUI opens with the initial screen for the transaction.
  10. Fill out the header data, making sure to "touch" all the fields to use for the upload.


    Figure 1 – ME21N Initial Screen
  11. Once all the header data is complete, press <ENTER>.
  12. Now add the first line item to the grid. It is important that it is done a specific way to make a repeatable process for the loop.
  13. Enter the details for the first line item in the first row of the grid. If necessary, enter data into the Item Details section for the selected item as you normally would. See Figure 2 below.


    Figure 2 – ME21N Adding the first line item before pressing ENTER
  14. After entering data for the first line item, press <ENTER> to enable the filter icon () on the toolbar below the item section.


    Figure 3 – ME21N With the Filter button Enabled
  15. Click on the filter icon to set the filter criteria.

    The trick with this transaction is to set a filter on the grid that will not return any records. This makes it possible to always add new line items in row 1.

  16. In the Define Filter Criteria dialog shown in Figure 4 below, move the Item column into the Filter Criteria list by selecting the row with the text “Item” from the Column Set and then clicking on the left pointing triangle.


    Figure 4 – Define Filter Criteria Dialog
  17. Click the Filter Icon [] in the dialog. If the dialog does not have this filter icon, click the green checkmark shown in Figure 4 to provide filter criteria.
  18. In the "Determine values for filter criteria" dialog shown in Figure 5 below, enter a value in the item field which will always result in no matches. In this example 99999 is used to ensure that any items in the grid without an item number of 99999 are hidden, effectively causing the grid to remain empty while adding new items.


    Figure 5 – Determine Vales for the filter criteria dialog
  19. Click the green checkmark to proceed. Notice that the item grid section is empty.
  20. Enter another line item in the grid so that a pattern can be identified when editing the template.
  21. Press <ENTER>. The data disappears from the grid again. See Figure 6 below.


    Figure 6 – ME21N with the Filter Applied
  22. Click Save in the SAP GUI or end the transaction however you normally would. The SAP GUI closes and Data Workbench creates the template.
  23. Go to the the Templates page.
  24. Select the newly created template and click Edit.
  25. Go to the BDC Contents tab.
    In the next steps, the line item portion of the recording will be placed into a loop. As shown below in Figure 7, the five screens that should be placed in a loop are:
    • Enter data into the first line item of the grid.
    • Press <ENTER>.
    • Click Filter.
    • Define the filter column criteria.
    • Enter values for the filter criteria.
  26. Select the first instance of the pattern, right click and select Increment Loop Level as shown in Figure 7. This identifies that part of the template as repetitive and allows you to enter a variable number of line items.


    Figure 7 - Template Editor Incrementing the Loop Level
  27. Delete the extra screen where the second line item was entered. The screen(s) appear after the loop and before the Save press. In this example, the repeated screen is highlighted below in Figure 8.


    Figure 8 -Template Editor Deleting the Extra Screens

    During the recording process, the filter setting steps were performed only once. Now that the filter actions are in the loop, they would ordinarily get executed once for each line item. To prevent this, set a condition so that the filter functionality only occurs the first time the loop is executed.

  28. Select the screens that represent pressing the filter button and selecting the criteria, and click Properties as shown in Figure 9.


    Figure 9 -Template Editor Applying Properties to the Filter Screens
  29. In the Edit Item Properties dialog, check Only Execute every x Line items and then every y line items.
  30. Enter the value 1 for x and 9999 for y so that the filter button press executes once on the first line item, then again on the 9999th line item. Set the y value to exceed the maximum number of line items anticipated.


    Figure 10 –Edit Item Properties Dialog
  31. Click OK to return to the Templates page.
  32. Select the edited template and click Create Load File.
  33. Select the Create a Single Sheet option.
  34. Press OK to create an Excel file that contains a single worksheet containing both the header and the line item columns.


    Figure 11 – Create Load File Dialog
  35. To add data to the load file, enter the header information and the detail for the first line item in the first row of the load file.
  36. Enter the remaining line items for the transaction in the following rows.
  37. To begin another record, start the next row with the header information and repeat. Data Workbench will keep adding line items until it detects new data in the header columns. See Figure 12 for an example.


    Figure 12 - Excel Populating Data
  38. After populating the data in the load file, and saving it, go to the Upload Data to SAP Page.
  39. Select the file and click Upload as show in Figure 13 below.


    Figure 13 – Upload Section

NOTE: If records fail, see Troubleshoot Error Messages.