How to create ASCII text file for upload to SAP BW
From time to time we have a request in SDN asking about such files creation.
The last one was recently:
Here is a small VBA program that creates such ASCII file from CSV file.
I assume that a user can set up Excel security, create buttons in Excel and place code into subroutines. — if not — refer to any manual/book dedicated to Excel or look at my previous blog:
Long Texts in SAP BW: Displaying in BEx Analyzer. Introduction to Excel Workbooks Formatting. Part I.
My code takes some parameters from the first Excel sheet:
- Number of fields in the file
- Source File Name
- Target File Name
- Delimiter of fields in the source file
- Number of rows in the source file to ignore
- Fixed length of fields in the ASCII file – the same as field lengths in the transfer structure.
The code expects values of these parameters exactly as it is shown in the picture above (in the same cells).
Certainly, one can create one or two buttons with a code that will allow to browse to the source file and choose a target file. It’s up to you.
The program may work with long files (more than 65535 rows).
So, here is a code attached to the “Create ASCII file” button.