‎2007 Jun 21 1:15 PM
Hi friends,
I want to upload the data from a flat file into internal table , but the problem is that all the columns in that flat file are seperated by "|" character instead of tabs.
Plz help me out.........
‎2007 Jun 21 1:18 PM
HEllo,
DO like this.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = LV_FILENAME
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X' " Check here
* HEADER_LENGTH = '1'
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
DATA_TAB = IT_COJRNL
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.
VAsanth
‎2007 Jun 21 2:02 PM
My fields are seperated by a symbol "|" not tab .
and the file is in TXT format.
so this line HAS_FIELD_SEPARATOR = 'X' " Check here
is not working here
‎2007 Jun 21 3:12 PM
Hi
i have a problem with PERNO ,
in role EMP PERNo is a standard field, when i entered data in BP it is taking input , but in table BUT000 it is not desplaying,
i added the same field for MKK role , which has a additional field ,
but this accepting the data BP , but showing in 00 in BUT000,
is this a mistake in config or it is done by abap code only ?
please , its urgent
full points will be in waiting
‎2007 Jun 21 3:55 PM
Hello Archit
First of all you should use the static method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD instead of the function module because the method is already Unicode-enabled.
You have to set parameter HAS_FIELD_SEPARATOR = ' ' (space) because your data are NOT separated by Tabs.
Check in the debugger how the character "|" is represented. Based on the character table on my Windows XP desktop "I" corresponds to U+007C.
For converting the data you can use function module TEXT_CONVERT_TEX_TO_SAP using "|" as field separator (parameter I_FIELD_SEPERATOR). However, if the converted data contain any "#" the SAP system interprets the field separator different in your ABAP program and the uploaded file data.
Regards
Uwe