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

dataset problems

alejandro_romero2
Participant
0 Likes
491

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

4 REPLIES 4
Read only

former_member214857
Contributor
0 Likes
464

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

Read only

0 Likes
464

thanks , but i still have the same problem i think the dataset cant be cleared any idea?

Read only

0 Likes
464

Hi alejandro

Can you copy OPEN DATASET , READ AND CLOSE DATASET block and attach to this thread ?

Thank you

Read only

0 Likes
464

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.