09-16-2008 3:48 PM
Dear members,
I am get syntax error when using Read table statement saying mandt field is not filled, however if I remove the KEY field. it is working fine.
please let me know, where I am doing mistake. thank you.
Data : spfli_tab like STANDARD TABLE OF spfli with HEADER LINE.
SELECT *
FROM spfli
INTO TABLE spfli_tab
WHERE carrid = 'LH'.
READ TABLE spfli_tab
WITH TABLE KEY carrid = 'LH'
connid = '2402'.
IF sy-subrc = 0.
...
ENDIF.
09-16-2008 3:54 PM
Hi,
The problem occurred since, you used the "WITH TABLE KEY" extension for "Read table".
This extension, will prompt the user to include all the table keys(in SPFLI, the table keys are MANDT,CARRID,CONNID).
If you don't want to compare with your system id...go for "WITH KEY" extension for "Read table" statement.
Try this.
Thanks
Sumi
09-16-2008 3:51 PM
hi,
the client field (MANDT) is also part of the table key, so you have two ways to go:
1. with full table key
READ TABLE spfli_tab
WITH TABLE KEY mandt = sy-mandt
carrid = 'LH'
connid = '2402'.
2. simply with key fields
READ TABLE spfli_tab
WITH KEY carrid = 'LH'
connid = '2402'.
hope this helps
ec
09-16-2008 5:02 PM
Thank You Eric and others,
I got it, closed the thread and alloted points ..
Thank You.
09-16-2008 3:54 PM
Hi,
The problem occurred since, you used the "WITH TABLE KEY" extension for "Read table".
This extension, will prompt the user to include all the table keys(in SPFLI, the table keys are MANDT,CARRID,CONNID).
If you don't want to compare with your system id...go for "WITH KEY" extension for "Read table" statement.
Try this.
Thanks
Sumi
09-16-2008 3:55 PM
Hi,
If you use WITH TABLE KEY addition with Read table then you have to all the primery keys.
Or other way you can go for WITH KEY addition , here you can specify any key.
09-16-2008 4:01 PM
Hi...
As Eric Said there are two ways...
For your case use WITH KEY...
SELECT *
FROM spfli
INTO TABLE spfli_tab
WHERE carrid = 'LH'.
READ TABLE spfli_tab
WITH KEY carrid = 'LH'
connid = '2402'.
IF sy-subrc = 0.
WRITE : 'DONE'.
ENDIF.
If u specify WITH TABLE KEY then u will hv to pass all key fields mentioned in DDIC...
Hope it will solve your problem..
Thanks & Regards
ilesh 24x7