‎2005 Oct 25 3:34 PM
Hi friends,
Please provide me some sample program how to use "code page" statement in "READ OPENDATASET" command to create/modify the application server files.
Thanks & Regards,
Thayalan
‎2005 Oct 25 5:42 PM
Hi!
In general you can make something like the following(extend SAP-help):
data:
begin of STRUC2,
F1 type c,
F2(20) type c,
end of STRUC2.
* Put data into text format
move-corresponding STRUC to STRUC2.
* Write data to file
open dataset DSN in text mode for output encoding utf-8.
transfer STRUC2 to DSN.
close dataset DSN.
* Read data from file
clear STRUC.
open dataset DSN in text mode for input encoding utf-8.
read dataset DSN into STRUC2.
close dataset DSN.
move-corresponding STRUC2 to STRUC.
write: / STRUC-F1, STRUC-F2.
The textual storage in UTF-8 format ensures that the created files are platform-independent.
Case 2: Old non-Unicode format must be retained
* Write data to file
open dataset DSN in legacy text mode for output.
transfer STRUC to DSN.
close dataset DSN.
* read from file
clear STRUC.
open dataset DSN in legacy text mode for input.
read dataset DSN into STRUC.
close dataset DSN.
write: / STRUC-F1, STRUC-F2.
Using the LEGACY TEXT MODE ensures that the data is stored and read in the old non-Unicode format. In this mode, it is also possible to read or write non-character-type structures. However, be aware that data loss and conversion errors can occur in Unicode systems if there are characters in the structure that cannot be represented in the non-Unicode codepage.
Instead of legacy text mode you can define a specific codepage. Have a look in table TCP00 for available codepages in SAP.
Regards,
Christian