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

reading stat file

Former Member
0 Likes
1,036

Hi guru's

I am using open dataset to read a stat file. It always gives me the binary format of the data. Below is the code snippet.

OPEN DATASET dset for INPUT IN TEXT MODE ENCODING DEFAULT.

IF sy-subrc <> 0.

WRITE:/ 'Error in opening file'.

ELSE.

DO.

READ DATASET dset into wa_upload MAXIMUM LENGTH 2000.

IF sy-subrc <> 0.

EXIT.

ENDO.

ENDIF.

The "wa_upload" has the same format as the stat file. How to read as a text format.

Please advise.

regards

Raja

2 REPLIES 2
Read only

mvoros
Active Contributor
0 Likes
776

Hi,

you need to read lines into character type variable and then parse it into your structure if your program is unicode. Here is one paragraph from ABAP documentation.

This statement exports data from the file specified in dset into the data object dobj. For dobj, variables with elementary data types and flat structures can be specified. In Unicode programs, dobj must be character-type if the file was opened as a text file.

Check also ABAP documentation for statements like OPEN DATASET and READ DATASET. There are some examples as well.

Cheers

Read only

Former Member
0 Likes
776

Thanks Martin.

I did have the object as character type.

data wa_upload(2000) type C .

But it still gives the binary format. It looks like:

22########RSCONN01##8RSSYSTDB##4####SESA<#####

Please suggest

Raja.