1/14/2016 8:47:29 PM
Download excel file with leading zeros using GUI_DOWNLOAD in SAP ABAP-Many SAP consultants facing the issue, when we download data into GUI and the leading zeros are truncated. There are multiple ways to address this Download excel file with leading zeros using GUI_DOWNLOAD in SAP ABAP but one of the simplest method is to use file type as DBF. Data is downloaded in dBase format. Since in this format the data types of the individual columns are stored as well, you can often avoid import problems, for example, into Microsoft Excel, especially when interpreting numeric values.
CALL FUNCTION 'GUI_DOWNLOAD'
FILENAME = v_filename
FILETYPE = 'DBF'
DATA_TAB = lint_mara
Data transfer of an internal table form the server to a file on the PC. The Gui_Download module replaces the obsolete modules Ws_Download and Download. The file dialog of the download module is available in the class Cl_Gui_Frontend_Services.
During download, the data can be transferred in other formats, depending on the value of the FILETYPE parameter.
ASCII format. The table is transferred as text. Conversion exits are performed. The output format additionally depends on the parameters CODEPAGE, TRUNC_TRAILING_BLANKS, and TRUNC_TRAILING_BLANKS_EOL.
ASCII format with IBM codepage conversion (DOS). This format corresponds to the 'ASC' format when using target codepage 1103. This codepage is frequently used for data exchange via floppy disk.
Column-by-column transfer. With this format, the data is transferred as text as with ASC. However, no conversion exits are performed and the columns are separated by tab characters. This format generates files than can be uploaded again using gui_upload or ws_upload.
Data is downloaded in dBase format. Since in this format the data types of the individual columns are stored as well, you can often avoid import problems, for example, into Microsoft Excel, especially when interpreting numeric values.
Data is downloaded in Lotus 1-2-3 format.
Binary format. Data is transferred binarily. There is no formatting and no codepage conversion. The data is interpreted row by row; it is not formatted by columns. Specify the data length in parameter BIN_FILESIZE. The table should consist of a column of type X, because especially in Unicode systems, the conversion of structured into binary data causes errors.
If you like this blog, please share (Facebook/LinkedIn/Google+) to click below links so it will reach to others.