‎2006 Jan 23 5:17 PM
Hi,
I have this code which runs fine in our non-unicode SAP system.
REPORT ECC5_OFFSETS.
DATA: W_KONV TYPE KONV.
DATA: TKOMK LIKE STANDARD TABLE OF KOMK
WITH KEY KEY_UC
INITIAL SIZE 2
WITH HEADER LINE.
DATA: TKOMK2 type STANDARD TABLE OF KOMK
WITH KEY KEY_UC
INITIAL SIZE 2.
* Get some test data
SELECT SINGLE * INTO W_KONV FROM KONV
WHERE KNUMV = '0000000061'.
MOVE-CORRESPONDING W_KONV TO TKOMK.
APPEND TKOMK.
tkomk2[] = TKOMK[].
* Original non-Unicode compliant code
DATA: LENGTH_KEY_TKOMK(3) TYPE P.
FIELD-SYMBOLS: <TKOMK_KEY> like TKOMK2.
DESCRIBE DISTANCE BETWEEN TKOMK-MANDT AND TKOMK-SUPOS
INTO LENGTH_KEY_TKOMK
* ( Original Unicode syntax fix! )
IN BYTE MODE.
* Copy all the fields between these two into TKOMK_KEY field-symbol.
* ( In Unicode this assignment fails, causing short dump at read )
ASSIGN TKOMK2(LENGTH_KEY_TKOMK) TO <TKOMK_KEY>.
* Read the current record.
READ TABLE TKOMK2 WITH KEY <TKOMK_KEY>.
But I get the following error message in our UNICODE complaint SAP system:
<b>"<TKOMK_KEY>" cannot be a table, a reference, a string, or contain any of these objects.</b>
Does anyone know how I could get around this/suggest a solution?
Thanks in advance!
‎2006 Jan 23 5:20 PM
‎2006 Jan 23 5:20 PM
‎2006 Jan 23 5:24 PM
Hi Sam,
I tried your suggestion and the exact same error came up
Any other ideas...
‎2006 Jan 23 5:28 PM
Ok...the problem is in this line:
<b>READ TABLE tkomk2 WITH KEY <tkomk_key>.</b>
You have to do:
READ TABLE tkomk2 WITH KEY fieldname = somevalue.
‎2006 Jan 23 5:41 PM
Hi Sam,
Yep that's as far as I got. This code works fine in 4.6b but in ECC5, that line you mentioned failes the syntax check.
The only reason why I don't waht to do what you suggest is becasue I'll have to code each of the 283 fields that it currently uses in the read!
I was hoping that there would be an easier way to do the same thing...
Any other ideas...?
‎2006 Jan 23 5:49 PM
‎2006 Jan 23 6:17 PM
Hi,
Sorry if I'm being unclear.
My requirements are twofold:
1)the line of code:
ASSIGN TKOMK2(LENGTH_KEY_TKOMK) TO <TKOMK_KEY>does not assign anything to the fields symbol <TKOMK_KEY>
2)The read statement does not like the fields symbol <TKOMK_KEY> being used as a key.
Both these bits of code worked in our 4.6b system but now in the ECC5 environemtn I get syntax errors.
Let me know if you need anything else!
‎2006 Jan 23 6:44 PM
Do this change in your code:
DATA: tkomk2 TYPE STANDARD TABLE OF komk
WITH KEY key_uc
INITIAL SIZE 2
<b>WITH HEADER LINE</b>.
‎2006 Jan 23 8:43 PM
The solution is to type the Field-Symbol with the table type:
FIELD-SYMBOLS: <TKOMK_KEY> like line of TKOMK2.
Best Regards
Klaus