Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

open dataset error

Former Member
0 Likes
489

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

5 REPLIES 5
Read only

Former Member
0 Likes
464

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

Read only

0 Likes
464

naren i tried that same eror

Read only

0 Likes
464

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.

Read only

Former Member
0 Likes
464

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

Read only

Former Member
0 Likes
464

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