When we download the data from the SAP using FMs like GUI_DOWNLOAD or WA_DOWNLOAD (absolute); or the method of class CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD and open that file in the Microsoft Excel, we loose some important information like leading zero, long numbers will come as exponents. Most of the times we don't want this because we will use this File as input of some program or we will use it for future analsys.
When we use the .xls extension to save the file and open it directly in the Excel, the file will look like this:
We will see how to stop Excel removing our precise information which we have downloaded from SAP. We need to follow this Steps:
1. We will save our file with .txt extension instead of the .xls extension.
2. Start Excel. Start > Run > Enter Excel.
3. Open the downloaded file by Selecting it from the Open File dialog box.
4. Once we open the file, excel will bring "Text to column" wizard.
5. Select the "Delimilated" option in the first screen. Move to the 3rd Step of the wizard by pressing the Next button two times.
6. In the 3rd step, select all the columns. To select all the columns do like: Click on first column, Hold the shift key, scroll to last column, click on last column. This way all the columns gets selected. The colums which got selected will have black background. Now, select the Option "Text" in the format.
7. Finish the Wizard.
Our file after opening in Excel will look like this:
This is the code snippet I have used to generate the test file.
Code Snippet |
|