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

syntax error

Former Member
0 Likes
1,074

types:BEGIN OF typ_tecs,

matnr_lo LIKE tecs-matnr_lo,

sernr_lo LIKE tecs-sernr_lo,

techs LIKE tecs-techs,

aufnr type mdfa-aufnr,

pspel LIKE mdfa-pspel,

END OF typ_tecs.

data:it_tecs TYPE STANDARD TABLE OF typ_tecs.

DATA:wa_tecs TYPE typ_tecs.

SELECT a~matnr_lo

a~sernr_lo

a~techs

b~aufnr

b~pspel

FROM tecs AS a INNER JOIN mdfa AS b ON atechs = btechs

INTO TABLE it_tecs.

SELECT projn

aufnr

FROM afpo

INTO TABLE it_afpo

WHERE aufnr EQ it_tecs-aufnr.

Im getting syntax error that it_tecs is atable without header line and therefore has no component called aufnr

6 REPLIES 6
Read only

Former Member
0 Likes
929

Hi,

The Problem Here is that you have Given a Internal Table's Field in Where Condition whereas it should be a Work Area.

To solve this there are 3 options given below :

First Option is :

data:it_tecs TYPE STANDARD TABLE OF typ_tecs WITH HEADER LINE.

Second Option is :

SELECT projn
aufnr
FROM afpo
INTO TABLE it_afpo
For All Entries IN IT_TECS
WHERE aufnr EQ it_tecs-aufnr.

or Third Option is:

write the Below CODE:

types:BEGIN OF typ_tecs,
matnr_lo LIKE tecs-matnr_lo,
sernr_lo LIKE tecs-sernr_lo,
techs LIKE tecs-techs,
aufnr type mdfa-aufnr,
pspel LIKE mdfa-pspel,
END OF typ_tecs.

data:it_tecs TYPE STANDARD TABLE OF typ_tecs.
DATA:wa_tecs TYPE typ_tecs.
DATA:wa_projn LIKE LINE OF it_afpo.
     
SELECT a~matnr_lo
a~sernr_lo
a~techs
b~aufnr
b~pspel
FROM tecs AS a INNER JOIN mdfa AS b ON a~techs = b~techs
INTO TABLE it_tecs.

LOOP AT it_tecs INTO wa_tecs.
SELECT SINGLE projn
       aufnr
  FROM afpo
  INTO wa_afpo
 WHERE aufnr EQ wa_tecs-aufnr.
  APPEND wa_afpo TO it_afpo.
ENDLOOP.

Reagrds,

Sunil

Read only

Former Member
0 Likes
929

hi,

do this way

types:BEGIN OF typ_tecs,

matnr_lo LIKE tecs-matnr_lo,

sernr_lo LIKE tecs-sernr_lo,

techs LIKE tecs-techs,

aufnr like mdfa-aufnr,

pspel LIKE mdfa-pspel,

END OF typ_tecs.

or

types:BEGIN OF typ_tecs,

matnr_lo LIKE tecs-matnr_lo,

sernr_lo LIKE tecs-sernr_lo,

techs LIKE tecs-techs,

aufnr type aufnr,

pspel LIKE mdfa-pspel,

END OF typ_tecs.

Read only

Former Member
0 Likes
929

change it like this:

data:it_tecs TYPE STANDARD TABLE OF typ_tecs occurs 0 with header line.

reghards,

madhu

Read only

Former Member
0 Likes
929

SELECT projn

aufnr

FROM afpo

INTO TABLE it_afpo

For All Entries IN IT_TECS

WHERE aufnr EQ it_tecs-aufnr.

you forgot the FOR ALL ENTRIES IN Stmt

santhosh

Read only

Former Member
0 Likes
929

Hi,

i am not getting the error what you got, but it says that "Field "IT_AFPO" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement . . . . . . . . . . "

That means that it_afpo is not declared.

Thanks & Regards,

Khan.

Read only

Former Member
0 Likes
929

Hi

use this select statement

SELECT projn

aufnr

FROM afpo

INTO TABLE it_afpo

for all entries in it_tecs

WHERE aufnr EQ it_tecs-aufnr.

thanks and regards,