‎2007 Mar 09 7:22 AM
Hi all,
I am getting this error message :
Unable to interpret "4# " as a number
when i am splitting data from text file. Here with the code am using. PLZ suggest
ORM DATA_SELECTION .
DATA : L_MENGE(17).
OPEN DATASET P_FILE FOR INPUT IN TEXT MODE ENCODING UTF-8.
IF SY-SUBRC = 0.
DO.
READ DATASET P_FILE INTO WA_ITAB.
IF SY-SUBRC = 0.
SPLIT WA_ITAB AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB INTO ITAB-WERKS
ITAB-MATNR
ITAB-EKGRP
ITAB-LIFNR
ITAB-EVERS
L_MENGE.
ITAB-MENGE = L_MENGE.
APPEND ITAB.
CLEAR ITAB.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
CLOSE DATASET P_FILE.
ENDFORM. " DATA_SELECTION
‎2007 Mar 09 7:28 AM
Hi,
Looks like there is another column available after the menge..Add a string variable for the last column..
Try this..
DATA: V_STRING TYPE STRING..
SPLIT WA_ITAB AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB INTO ITAB-WERKS
ITAB-MATNR
ITAB-EKGRP
ITAB-LIFNR
ITAB-EVERS
L_MENGE
<b>V_STRING</b>.
ITAB-MENGE = L_MENGE.
Thanks,
Naren
‎2007 Mar 09 7:32 AM
‎2007 Mar 09 7:38 AM
If it is a syntax error that may be due to a multibyte character going into program text and the compiler raising a false alarma.
I would suggest you to copy the code into notepad, delete the abap code and again reupload.
‎2007 Mar 09 7:51 AM
hi
u r reading the data from text file into work area.....
u read it into another field v_record
and then split it into the table fields
read dataset 'xyz' into v_record.
split v_record at space into itab-f1 itab-f2..........
append itab.
the workarea and the line are not compatible as the line from text file contains separators
Message was edited by:
Premalatha G
‎2007 Mar 09 8:31 AM
UNABLE TO INTERPRET "40" AS A NUMBER.
>>>>>>>>>cODE
DATA : L_MENGE(17) TYPE C.
OPEN DATASET P_FILE FOR INPUT IN TEXT MODE ENCODING UTF-8.
IF SY-SUBRC = 0.
DO.
READ DATASET P_FILE INTO WA_ITAB.
IF SY-SUBRC = 0.
SPLIT WA_ITAB AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB INTO
ITAB-WERKS
ITAB-MATNR
ITAB-EKGRP
ITAB-LIFNR
ITAB-EVERS
L_MENGE.
ITAB-MENGE = L_MENGE.
APPEND ITAB.
CLEAR ITAB.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
CLOSE DATASET P_FILE.
ENDFORM. " DATA_SELECTION