‎2009 May 13 7:20 PM
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
‎2009 May 14 3:06 AM
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
‎2009 May 14 10:08 PM
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.