Application Development and Automation 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 only

SQL error:field is unknown

Former Member
0 Likes
2,836

Hi, the coding is as blew: and there's an error happening.

Field"LDT_VAL-MATNR" is unknown. It is neither in one of the specified tables nor defined by a "Data" statement.

How to deal with it?

Thanks!

Types:
  Begin of GTS_VAL,
    MATNR TYPE MARA-MATNR,
  End of GTS_VAL.
  GTT_VAL Type table of GTS_VAL.

Data LDT_VAL type GTT_VAL.

Select ~
for all entries in LDT_VAL
Where MSEG-MATNR = @LDT_VAL-MATNR
1 ACCEPTED SOLUTION
Read only

joltdx
Active Contributor
0 Likes
2,278

Hi!

You need to escape LDT_VAL everywhere, so change to this:

for all entries in @LDT_VAL

Next, you need to use the ~ to indicate fields from specific tables (or table aliases). In this example, change to:

Where MSEG~MATNR = @LDT_VAL-MATNR
2 REPLIES 2
Read only

joltdx
Active Contributor
0 Likes
2,279

Hi!

You need to escape LDT_VAL everywhere, so change to this:

for all entries in @LDT_VAL

Next, you need to use the ~ to indicate fields from specific tables (or table aliases). In this example, change to:

Where MSEG~MATNR = @LDT_VAL-MATNR
Read only

Sandra_Rossi
Active Contributor
2,278

Your syntax is completely wrong. One possibility:

SELECT * FROM MSEG
INTO TABLE @DATA(ITAB)
FOR ALL ENTRIES IN @LDT_VAL
WHERE MATNR = @LDT_VAL-MATNR.

(but instead of *, specify the columns you really need)