‎2006 Sep 28 5:19 PM
Hi,
I am facing a curious problem where I'd appreciate a helping hand: when I read data from a dataset into a variable of fixed-length, everything works fine. When I try to do the same with a variable-length type, nothing is read.
This code works fine:
<i>DATA binarydata(32000) TYPE x,
alen TYPE i.
OPEN DATASET filename FOR INPUT IN BINARY MODE.
READ DATASET filename INTO binarydata ACTUAL LENGTH alen.</i>
Here alen contains the correct number of bytes read (eg. 19000).
But if I try:
<i>DATA binarydata TYPE xstring,
alen TYPE i.
OPEN DATASET filename FOR INPUT IN BINARY MODE.
READ DATASET filename INTO binarydata ACTUAL LENGTH alen.
</i>
Here alen is 0.
Can anybody tell me what's wrong here ?
Thanks & Regards
Heiko
‎2006 Sep 29 12:05 AM
Hi,
For the string one try giving mode as TEXT instead of BINARY.
DATA binarydata TYPE xstring,
alen TYPE i.
OPEN DATASET filename FOR INPUT IN <b>TEXT</b> MODE.
READ DATASET filename INTO binarydata ACTUAL LENGTH alen.
Thanks,
Naren
‎2006 Sep 29 7:35 AM
Hi Naren,
sorry, if I do that, I get a shortdump saying "For the statement 'READ DATASET ... INTO f' only character-type data objects are supported at the argument position 'f'".
Thanks,
Heiko
‎2006 Sep 29 8:07 AM
Hello Heiko
If you are using NON-UNICODE system, please try by unselecting the checkbox "Unicode Checks Active" in program attributes.
While using UNICODE system, need to use as STRING.
Reason:
In UNICODE enabled or when Unicode Checks is active, system can transfer data between structures only when both are of characater format.
In your case, the data is read in text mode i.e character format but trying to move to XSRTING which is sequence of 'X' type characters. Hence resulting in dump.
Just for your info:
<b>The elementary data type STRING is similar to data type C and refers to a variable-length string. Accordingly, the elementary data type XSTRING is similar to data type X and refers to a variable-length byte sequence.</b>
Hope the above info clarifies you.
Kind Regards
Eswar
‎2006 Sep 29 10:15 AM
Hello Eswar,
thanks for your answer which helps to clarify the issue. But I already face the next problem: when I unselect "Unicode Checks Active" (I am using a non-unicode system), I cannot activate my report. I get an error saying "The program 'Z_HEIKO_UPLOAD' is not Unicode-compatible, according to its program attributes". Any hints on how to solve that ?
Thanks a lot,
Kind Regards
Heiko
‎2006 Sep 29 10:24 AM
Dear Heiko
This error will be encountered in UNICODE system. To check the same, you can use menupath System->Status.
In tab SAP System Data, if <b>Unicode System</b> has value 'YES', the system is unicode enabled. Please check whether the value is YES or NO in your system.
Kind Regards
Eswar
‎2006 Oct 06 8:37 PM
Hello Eswar,
sorry for the late reply but I have been gone last week.
But regarding my problem: I had already checked System->Status and for Unicode System it says "No".
Any ideas ?
Thanks & Regards
Heiko
‎2006 Oct 06 9:23 PM
Hello Heiko
Check you report using transaction <b>UCCHECK</b> and see what the report tells you about unicode-errors.
Regards
Uwe