‎2007 Jun 12 12:09 PM
Hi All,
I am trying to upload flat file data into appl server.but it is uploading some unwanted characters at the end.The code and data is given below.plz let me know the solution.
DATA : file type rlgrap-filename.
data : begin of itab occurs 0,
rec(500) type c,
end of itab.
file = '/lz01/fin/in/bop_Checkrecon1.txt'.
clear : itab.
refresh : itab.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\bop3.txt'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = itab
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
open dataset file for input in text mode encoding default.
clear itab.
loop at itab.
transfer itab-rec to file.
clear itab.
endloop.
close dataset file.
The exact structure and the data present in the flat file is as follows:
078041953 0000000001000000052507 0000070000 R
078041953 0000000003000000052507 0000199500 R
078041953 0000000005000000052507 0000530000 R
078041953 0000000007000000052507 0000005000 R
078041953 0000000008000000052507 0000004000 R
078041953 0001000000000000052507 0000058250 R
029005582 0001000000000000052507 0000012300 R
029005582 0001000001000000052507 0009438200 R
030404975 0001000000000000052507 0000056700 R
030404975 0001000001000000052507 0000004500 R
314018577 0001000002000000052507 0000001500 R
314018577 0001000003000000052507 0000435300 R
314018577 0001000007000000052507 0000066600 R
Thanks,
Rakesh.
‎2007 Jun 12 1:07 PM
Hello Rakesh
If you display your flat file using an editor (like Notepad) then the file may look ok. However, there may be special characters at the end of every line that are not displayed.
Use the following approach to analyze your flat file:
(1) Start Microsoft Excel
(2) Open your flat file from with Excel. Be careful to choose the right <b>Codepage</b> in the <i>Text Converter Assistent</i>. For example, located in Switzerland I would most like choose Codepage = Windows(ANSI) or 1250 Middle European (Windows)
(3) Scroll to the end of lines and check if there are special characters
Regards
Uwe
‎2007 Jun 12 1:09 PM
Hello Rakesh
Forgotten to mention: do no longer use fm GUI_UPLOAD but use the static methods of class <b>CL_GUI_FRONTEND_SERVICES</b>:
- GUI_UPLOAD
- GUI_DOWNLOAD
The class in <b>Unicode</b>-compatible whereas the fm is not.
Regards
Uwe
‎2007 Jun 15 2:44 PM
Before start of selection add below lines. then i think it will work
CLASS cl_abap_char_utilities DEFINITION LOAD.
g_tab = cl_abap_char_utilities=>horizontal_tab.
that g_tab is your internall table.
and also check once with cg3z
go to transaction cg3z there you give your file path and target path
put ascii mode not bin mode
and upload file .
now you go to your application server and check the data if it is same format in which you want , then problem is with your code .