‎2010 May 27 10:56 PM
Hi gurus i have a problem when i use a dataset to read a file.
Sometimes the dataset read fine the file , but sometimes it doesnt, sometimes the dataset is not clear, it has garbage
i dont know why, any idea?
The problem is that for example if i read a file named "Invoice", the dataset read sometimes the file "invoice" and sometimes
the dataset doesnt read the invoice file content the dataset read another content .
Do i have to clear the dataset? or what should i do any idea?
READ DATASET lv_arcor
INTO lv_linea.
SPLIT lv_linea
AT c_csep
INTO:
gs_zt00_dcobcli-eannr
gs_zt00_dcobcli-docnr
gs_zt00_dcobcli-docty
gs_zt00_dcobcli-belnr
gs_zt00_dcobcli-cdesc
gs_zt00_dcobcli-cpago
gs_zt00_dcobcli-fpago
gs_zt00_dcobcli-waers
gs_zt00_dcobcli-folio
gs_zt00_dcobcli-codig
gs_zt00_dcobcli-nota1
gs_zt00_dcobcli-nota2
gs_zt00_dcobcli-no_provedor
gs_zt00_dcobcli-NO_CHEQUE.
CLOSE DATASET lv_arcor.
Edited by: Alejandro Romero on May 28, 2010 12:28 AM
‎2010 May 28 12:39 AM
Hi Alejandro.
As fas as I could understand you are facing issues on READ DATASET statment right ?
If so, it depends on which OS you are using, if file system is case sensitive you can use files with same name however with diferent case (like Invoice and invoice) will be diferent., if not, the file will be the same.
On the other hand you can use full path and instead of server name you can use IP adress.
DATA:
x_file TYPE string.
x_file = '\\192.168.10\usr\test\myfile.txt'.
OPEN DATASET x_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
READ x_file INTO my_var.Regards
‎2010 May 28 2:47 PM
thanks , but i still have the same problem i think the dataset cant be cleared any idea?
‎2010 May 28 3:25 PM
Hi alejandro
Can you copy OPEN DATASET , READ AND CLOSE DATASET block and attach to this thread ?
Thank you
‎2010 May 28 3:32 PM
Hi ..
This should work ..
OPEN DATASET LV_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC IS INITIAL.
DO.
READ DATASET LV_FILE INTO IT_FILE-LINE.
IF SY-SUBRC = 0.
APPEND IT_FILE.
CLEAR IT_FILE.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
CLOSE DATASET LV_FILE.