Skip to Content
Technical Articles
Author's profile photo Bayu Setyawan

Create Data File for Inventory Count with Batch-Input Method

In this blogpost, I want to share my method and some tips on how to create the data file for Inventory Count with Batch-Input Method. Some of you might have read the tutorial from Jürgen Lins. If you haven’t, I highly recommend it. Here, I am using the MI39 transaction.

As the tutorial explained, we have to create text file respecting the field length of the BISEG structure. Natively, this cannot be done with Excel. But with some workaround, we can create it.

My objective here is to create a blank template file with guidance for users to input the inventory count data.

First, we need to know the field sequence and field length of structure BISEG. Check with SE11.

BISEG%20Structure

BISEG Structure

Copy and transpose this structure; the field name, field length, and description to an empty Excel file. These serves as table headings. We can use them to help adjusting the column width and later as field guidance when users want to input the data.

Excel%20File%20with%20BISEG%20Structure

Excel File with BISEG Structure

Adjust each column width with the respective field length from BISEG. For example here, BLDAT length is 8, so adjust the column width to 8. Do this to all fields.

Example%20BLDAT%20Length%208

Example BLDAT Length 8

At this point we have created a blank template inventory count file with the required field length. I recommend to protect the sheet before giving this file to users, so that they cannot change the column width. This is very important as the batch input method cannot work with incorrect column width / field length.

Protect%20the%20Sheet

Protect the Sheet

But checked/marked the “Delete Rows” option, because later we need to remove the headings, as it is only to be used for data input guidance.

Allow%20Delete%20Row

Allow Delete Rows

Now, users can input the inventory count data in that file, with the help of the field description as guidance.

Tips: be sure to have the same/one pair of plant and storage location code in the table or data lines, or else SAP will automatically split the inventory count document when different code is detected between the lines.

Data%20Table%20Populated

Data Table Populated

When the file is completed and ready to be uploaded to SAP, the headings can be deleted, as it is no longer needed.

Delete%20Headings

Delete Headings

Then the data file is (almost) ready.

Data%20Ready

Data Ready

We need to export or save this file to formatted file with space delimited format, or PRN.

Save%20as%20PRN%20File

Save as PRN File

If you open this PRN file with Excel, it will lose the column width. But If you open this PRN file with notepad, it will have the field length needed for batch input.

Tips: you can also use Notepad++ to edit the file after it has been exported to PRN. Notepad++ can show you the cursor/pointer coordinate so you can check if any field’s starting position has been misplaced after editing.

Open%20with%20Notepad

Open with Notepad

Finally you can use this file in the batch input proses, by uploading it with CG3Z. Be sure to check the correct target name “phyinv39_40” and select “ASC” as format.

Upload%20with%20CG3Z

Upload with CG3Z

Check the message after the file upload is finished.

Finished%20Upload

Finished Upload

After that, proceed to execute the MI39. Be sure to check the maximum number of items not exceeding 333, as it is the limit of lines for each document. Here, I use 300. You can also use the “Test Data” option before the real execution.

Ready%20for%20MI39

Ready for MI39

A session will be created. The number of items will reflect the number of lines in the file. Proceed to process the session.

Session%20Created

Session Created

The rest of the process will be done similarly to any other batch input via SM35.

Session%20Overview

Session Overview

Process%20Session

Process Session

If all goes well, system will pop the completion message.

Session%20Done

Session Done

And it is done. Check the result as usual, from MI22, MI24, MB51, MB52. As I have mention in the beginning, this whole example is done for MI39 but I am sure it is applicable to other inventory count batch input method.

Leave a comment if you have any feedback, and check out the SAP MM Community for other inquires. Thank you.

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Raphael Sommer
      Raphael Sommer

      Hello, nice post, thank you!

      I am not sure if it is possible, can LSMW be used to read a file (text file) and then format it suitable and call program RM07II34 ?

      Then everything would be in SAP / LSMW and we do not have to make such an excel file?

      Best regards, Raphael

      Author's profile photo Milan Djordjevic
      Milan Djordjevic

      Many thanks, quite useful tutorial for structuring the files.