Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Read Table : Error Stating mandt field is not filled.

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

5 REPLIES 5

JozsefSzikszai
Active Contributor
0 Kudos

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

0 Kudos

Thank You Eric and others,

I got it, closed the thread and alloted points ..

Thank You.

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

former_member387317
Active Contributor
0 Kudos

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